aboutsummaryrefslogtreecommitdiffstats
path: root/test/sortglos.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-11-16 19:54:57 +0200
committerArnold D. Robbins <arnold@skeeve.com>2014-11-16 19:54:57 +0200
commit31c6051694d3152e50eb037e20c4734c7321eac6 (patch)
treea23c8200da6761a90b63a7c6b79961c72162f084 /test/sortglos.awk
parent82e7082d1653a2143fc29d405fe40329188828b5 (diff)
downloadegawk-31c6051694d3152e50eb037e20c4734c7321eac6.tar.gz
egawk-31c6051694d3152e50eb037e20c4734c7321eac6.tar.bz2
egawk-31c6051694d3152e50eb037e20c4734c7321eac6.zip
Add field reference changes. Currently breaks sortglos test.
Diffstat (limited to 'test/sortglos.awk')
-rwxr-xr-xtest/sortglos.awk51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/sortglos.awk b/test/sortglos.awk
new file mode 100755
index 00000000..e4f910d7
--- /dev/null
+++ b/test/sortglos.awk
@@ -0,0 +1,51 @@
+BEGIN {
+ pr="y";
+ npre=0;
+ po="n";
+ npos=0;
+ }
+
+pr=="y" { npre++; pre[npre]=$0; }
+$1=="@table" && $2=="@asis" { pr="n";nite++; next; }
+
+po=="y" { npos++; pos[npos]=$0; }
+$1=="@end" && $2=="table" {
+ po="y";
+ npos++;
+ pos[npos]=$0;
+ # last item...
+ vec[nite]=nlin;
+}
+
+ { nite++; }
+
+END {
+ for ( i=1; i<=npre; i++ ) { print pre[i]; }
+ if ( srt=="y" ) {
+ n=asorti(entr,ital);
+ ##print "n=",n;
+ for ( i=1; i<=n; i++ ) {
+ #printf("=========> %3.3d %s\n",i,ital[i]);
+ # ital[i] is the sorted key;
+ j=entr[ital[i]];
+ # j is the original item number
+ for ( k=1; k<=vec[j]; k++ ) {
+ print dat[j,k];
+ }
+ }
+ }
+ if ( srt=="n" ) {
+ for ( i=1; i<=nite; i++ ) {
+ printf("=========> %3.3d %2.2d %s\n",i,vec[i],titl[i]);
+ for ( j=1; j<=vec[i]; j++ ) {
+ print dat[i,j];
+ }
+ }
+ print "========================= END";
+ }
+ for ( i=1; i<=npos; i++ ) { print pos[i]; }
+ print "@c npre=" npre;
+ print "@c nite=" nite;
+ print "@c npos=" npos;
+}
+