aboutsummaryrefslogtreecommitdiff
path: root/libXaw/spec/fixindex.awk
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-11-06 11:03:40 +0000
committermarha <marha@users.sourceforge.net>2009-11-06 11:03:40 +0000
commit08cb4425442ca65ec28d6a2f023f885e35a7f0ed (patch)
treea9061a472d247bce27d7fb6c700c5b7e2755d036 /libXaw/spec/fixindex.awk
parentccdb20929567c70c1bbdd5df275ca7bea5c747a7 (diff)
parentace7902333b6f61aab5a6035dbcb222763bff186 (diff)
downloadvcxsrv-08cb4425442ca65ec28d6a2f023f885e35a7f0ed.tar.gz
vcxsrv-08cb4425442ca65ec28d6a2f023f885e35a7f0ed.tar.bz2
vcxsrv-08cb4425442ca65ec28d6a2f023f885e35a7f0ed.zip
Added libXaw
Diffstat (limited to 'libXaw/spec/fixindex.awk')
-rw-r--r--libXaw/spec/fixindex.awk73
1 files changed, 73 insertions, 0 deletions
diff --git a/libXaw/spec/fixindex.awk b/libXaw/spec/fixindex.awk
new file mode 100644
index 000000000..e8849f3bd
--- /dev/null
+++ b/libXaw/spec/fixindex.awk
@@ -0,0 +1,73 @@
+BEGIN {
+ FS = ":";
+ BD = "\\s+1\\fB";
+ ED = "\\fP\\s-1";
+}
+
+NR == 1 {
+ if ($3 != "")
+ printf(".Ib \"%s\"\n", $2);
+ major = $2;
+ minor = $3;
+ if ($4 == "@DEF@") {
+ pagelist = BD $1 ED;
+ }
+ else {
+ pagelist = $1;
+ }
+ pageno = $1;
+ oldpageno = $1;
+ oldpagelist = "";
+}
+
+NR != 1 {
+ if ($2 == major && $3 == minor) # neither has changed
+ {
+ if ($1 != pageno) { # new page number, append
+ oldpageno = $1;
+ oldpagelist = pagelist;
+ if ($4 == "@DEF@") {
+ pagelist = pagelist ", " BD $1 ED;
+ }
+ else {
+ pagelist = pagelist ", " $1;
+ }
+ }
+ else { # old page, but check for def
+ if ($4 == "@DEF@") {
+ if (pageno == oldpageno) {
+ if (oldpagelist != "")
+ oldpagelist = oldpagelist ", "
+ }
+ pagelist = oldpagelist BD $1 ED;
+ }
+ }
+ }
+ else # one has changed
+ {
+ if (minor != "") # dump full record
+ printf(".I< \"%s\" \"%s\" \"%s\"\n", major, minor, pagelist);
+ else
+ printf(".I> \"%s\" \"%s\"\n", major, pagelist);
+ if ($4 == "@DEF@") { # restart pagelist
+ pagelist = BD $1 ED;
+ }
+ else {
+ pagelist = $1;
+ }
+ oldpagelist = "";
+ oldpageno = $1;
+ if ($2 != major && $3 != "") # major has changed, minor not null
+ printf(".Ib \"%s\"\n", $2);
+ }
+ major = $2;
+ minor = $3;
+ pageno = $1;
+}
+
+END {
+ if (minor != "") # dump full record
+ printf(".I< \"%s\" \"%s\" \"%s\"\n", major, minor, pagelist);
+ else
+ printf(".I> \"%s\" \"%s\"\n", major, pagelist);
+}