TestUtils: add test case for curl() (thanks to httpbin.org)

--- test/TestUtils.awk
+++ test/TestUtils.awk
@@ -30,6 +30,15 @@
         assertTrue(newerVersion("2", "1.9.9999"))
     }

+    T("curl()", 1)
+    {
+        delete tokens; delete ast
+        tokenize(tokens, curl("https://httpbin.org/get"))
+        parseJson(ast, tokens)
+        assertEqual(unparameterize(ast[0 SUBSEP "url"]),
+                    "https://httpbin.org/get")
+    }
+
     T("dump()", 3)
     {
         delete group


Java bindings: The DOT constants should be ints (not bytes) so that DOTC (256) can be represented. (dm)

--- Bindings/Java/constants.awk
+++ Bindings/Java/constants.awk
@@ -58,7 +58,7 @@
 }

 function brlDot(number, symbol, value, help) {
-  writeJavaConstant("byte", "DOT" number, "(byte) (" value ")", help)
+  writeJavaConstant("int", "DOT" number, value, help)
 }

 function apiConstant(name, symbol, value, help) {


- get rid of undefined variable error

- get rid of undefined variable error

--- scripts/modpost.awk
+++ scripts/modpost.awk
@@ -992,6 +992,9 @@
 		if (fields[1] == "format") {
 		    values["format"] = fields[2]
 		} else
+		if (fields[1] == "kabi") {
+		    values["kabi"] = fields[2]
+		} else
 		if (fields[1] == "sym") {
 		    if (n<3) { print_error("syntax error in cachefile: line = \"" line "\""); continue }
 		    for (i=9;i>n;i--) { fields[i] = "" }; n = 9
@@ -1024,6 +1027,7 @@
     if ("PWD" in ENVIRON) sub("^" ENVIRON["PWD"] "/", "", file)
     print_vinfo(1,"w: cachefile, file = \"" file "\"")
     print "format:" values["format"] > file
+    print "kabi:" values["kabi"] > file
     for (sym in syms) {
 	line = "sym:" sym
 	line = line ":"; if (sym in mods) { line = line mods[sym] }
@@ -1123,7 +1127,7 @@
 	    }
 	    continue
 	}
-	if (!(sym in kabi) && havekabi) {
+	if (!(sym in kabi) && values["kabi"]) {
 	    if (ownr[sym] != values["pkgdirectory"])
 		if (values["unsupported"])
 		    print_vinfo(1,sprintf(fmt, base, "unsupportd", sym))
@@ -1155,7 +1159,7 @@
 	    }
 	    continue
 	}
-	if (!(sym in kabi) && havekabi) {
+	if (!(sym in kabi) && values["kabi"]) {
 	    if (ownr[sym] != values["pkgdirectory"]) {
 		if (values["unres-weak"])
 		    print_vinfo(1,sprintf(fmt, base, "weak unsup", sym))
@@ -1823,6 +1827,7 @@
     longopts["weak-symbols" ] = "w"  ;								   defaults["weak-symbols" ] = 1						; descrips["weak-symbols" ] = "resolve weak symbols (useful with -r and -U)"
     longopts["weak-versions"] = "W"  ;								   defaults["weak-versions"] = 1						; descrips["weak-versions"] = "version weak symbols (useful with -w)"
     longopts["weak-hidden"  ] = "H"  ;								   defaults["weak-hidden"  ] = 0						; descrips["weak-hidden"  ] = "weak symbol versions are hidden (used with -W)"
+    longopts["kabi"         ] = ""   ;								   defaults["kabi"         ] = 0						; descrips["kabi"         ] = "distribution has a kABI"
     longopts["format"       ] = "f:" ;								   defaults["format"       ] = "auto"						; descrips["format"       ] = "symsets file format (suse,redhat,auto)"
     longopts["unload"       ] = "u"  ; environs["unload"       ] = "CONFIG_MODULE_UNLOAD"	 ; defaults["unload"       ] = 0						; descrips["unload"       ] = "module unloading is supported"
     longopts["modversions"  ] = "m"  ; environs["modversions"  ] = "CONFIG_MODVERSIONS"		 ; defaults["modversions"  ] = 0						; descrips["modversions"  ] = "module versions are supported"
@@ -1962,15 +1967,15 @@
 		print_error("r: moduledir, directory not found")
 	}
 	if (("ksymsets" in values) && values["ksymsets"])
-	    havekabi = read_symsets(values["ksymsets"], "kabi", "syssymset")
+	    values["kabi"] = read_symsets(values["ksymsets"], "kabi", "syssymset")
 	else {
-	    havekabi = 0
+	    values["kabi"] = 0
 	    file = "symsets-" kversion ".tar.gz"
 	    if (system("test -r /boot/" file) == 0) {
-		havekabi = havekabi + read_symsets("/boot/" file, "kabi", "syssymset")
+		values["kabi"] = values["kabi"] + read_symsets("/boot/" file, "kabi", "syssymset")
 	    }
 	    if (system("test -r /lib/modules/" kversion "/build/" file) == 0) {
-		havekabi = havekabi + read_symsets("/lib/modules/" kversion "/build/" file, "kabi", "syssymset")
+		values["kabi"] = values["kabi"] + read_symsets("/lib/modules/" kversion "/build/" file, "kabi", "syssymset")
 	    }
 	}
     }


Switch to tags for node properties.

Switch to tags for node properties.

--- share/bin/plain2mp.awk
+++ share/bin/plain2mp.awk
@@ -43,17 +43,19 @@
 	# TODO: common stuff for multiple graphs
 	print "pair S[];"
 	print "pair q[];"
-	print "path nS[];"
 	print "path e;"
-
-	# diameter of node
-	print "numeric dS[];"
-
-	# number of self-edges
-	print "numeric lS[];"

 	print "ahlength := 10bp;"
 	print "ahangle  := 45;"
+
+	print "path S[].n;"
+
+	# diameter of node
+	print "numeric S[].diam;"
+
+	# number of self-edges
+	print "numeric S[].loops;"
+

 #	print "secondarydef v projectedalong w =";
 #	print "	if pair(v) and pair(w):";
@@ -82,7 +84,7 @@
 	shape  = $9;
 	# TODO: label delimited by <>, may contain spaces

-	printf "\tl%s := 0;\n", name
+	printf "\t%s.loops := 0;\n", name

 	printf "\t%s := (%fin, %fin);\n", name, x, y

@@ -96,20 +98,20 @@
 	diam = 0.3 + length(label) * 0.05;

 	if (shape == "doublecircle") {
-		printf "\td%s = %fin + 8bp;\n", name, diam;
+		printf "\t%s.diam = %fin + 8bp;\n", name, diam;
 	} else {
-		printf "\td%s = %fin;\n", name, diam;
+		printf "\t%s.diam = %fin;\n", name, diam;
 	}

 	if (shape == "doublecircle") {
-# TODO: would rather && together paths to n%s or somesuch
-		printf "\tdraw fullcircle scaled (d%s - 8bp) shifted %s withpen pencircle scaled 1bp;\n", name, name
-	}
-
-	printf "\tn%s := fullcircle scaled d%s shifted %s;\n", name, name, name
+# TODO: would rather && together paths to %s.n or somesuch
+		printf "\tdraw fullcircle scaled (%s.diam - 8bp) shifted %s withpen pencircle scaled 1bp;\n", name, name
+	}
+
+	printf "\t%s.n := fullcircle scaled %s.diam shifted %s;\n", name, name, name

 	if ($2 != "start") {
-		printf "\tdraw n%s withpen pencircle scaled 1bp;\n", name
+		printf "\tdraw %s.n withpen pencircle scaled 1bp;\n", name

 		if (label != "") {
 			printf "\tlabel(\"%s\", %s);\n", label, name
@@ -169,8 +171,8 @@

 	# TODO: better explain this
 	# TODO: explain reversed for q, else we'd find p again, where head == tail
-	printf "pair p; p = e intersectionpoint n%s;\n", head;
-	printf "pair q; q = (reverse e) intersectionpoint n%s;\n", tail;
+	printf "pair p; p = e intersectionpoint %s.n;\n", head;
+	printf "pair q; q = (reverse e) intersectionpoint %s.n;\n", tail;

 	# XXX: assuming no space in label
 label = slabel(a[n * 2 + 5]);
@@ -189,9 +191,9 @@

 		# extend loop 1.25 * diameter
 		# count number of self-loops for this node, and increment extension
-		printf "\tl%s := l%s + 1;", head, head
+		printf "\t%s.loops := %s.loops + 1;", head, head
 		print "l := length pp;"
-		printf "\tpair m; m := (0.5 + 2 * mlog(l%s + 1) / 256) * d%s * unitvector(direction l of pp) shifted %s;\n", head, head, head
+		printf "\tpair m; m := (0.5 + 2 * mlog(%s.loops + 1) / 256) * %s.diam * unitvector(direction l of pp) shifted %s;\n", head, head, head
 # u3 = u1 projectedalong u2;
 		printf "\tdraw %s -- m withpen pencircle scaled 0.5bp withcolor green;\n", head


Only use POSIX Awk features.

Only use POSIX Awk features.

--- sys/conf/kmod_syms.awk
+++ sys/conf/kmod_syms.awk
@@ -10,7 +10,7 @@
 }

 # De-list symbols from the export list.
-// {
+{
         if (ARGIND == 1)
                 nextfile
         delete syms[$0]


msg_parser.awk: generate two parser tables, default and extended

darcs-hash:20070919214030-65a35-56c54d9f070bdc3d32acfb7089d970050a3d921e.gz

--- libsofia-sip-ua/msg/msg_parser.awk
+++ libsofia-sip-ua/msg/msg_parser.awk
@@ -54,24 +54,25 @@
   split("", NAMES);
   split("", Comments);
   split("", COMMENTS);
-  split("", experimental);

   # indexed by the C name of the header
   split("", Since);		# Non-NUL if extra
   split("", Extra);		# Offset in extra headers

+  total = 0;
+  ordinary = 0;
+  basic = 0;
+  extra = 0;
   without_experimental = 0;
+
   template="";
   template1="";
   template2="";
   template3="";
   prefix="";
   tprefix="";
-  extra=0;
   failed=0;
   success=0;
-
-  extra_struct = "msg_pub_extra";

   ERRNO="error";
 }
@@ -159,7 +160,6 @@
   symbols[name] = comment;
   if (since) {
     Since[name] = since;
-    Extra[name] = extra++;
   }

   expr = (without_experimental > 0 && do_hash);
@@ -210,7 +210,7 @@

 #
 # Repeat each line in the footer containing the magic replacement
-# pattern with a instance of all headers
+# pattern with an instance of all headers
 #
 function process_footer (text)
 {
@@ -368,9 +368,14 @@
 }

 /^#### EXTRA HEADER LIST STARTS HERE ####$/ { HLIST=1; templates(); }
+HLIST && /^#### DEFAULT HEADER LIST ENDS HERE ####$/ { basic=total; }
 HLIST && /^#### EXPERIMENTAL HEADER LIST STARTS HERE ####$/ {
-  without_experimental=total; }
-HLIST && /^[a-z]/ { protos($1, $0, 0, $2); headers[total++] = $1; }
+  without_experimental = total; }
+
+HLIST && /^[a-z]/ { protos($1, $0, 0, $2);
+  headers[total++] = $1;
+  Extra[$1] = extra++;
+}
 /^#### EXTRA HEADER LIST ENDS HERE ####$/ { HLIST=0;  }

 /^ *\/\* === Headers start here \*\// { in_header_list=1;  templates(); }
@@ -396,95 +401,26 @@
   if (!NO_MIDDLE)
     protos(n, $0, 0);

-  headers[total++] = n;
-}
-
-END {
-  if (failed) { exit };
-
-  if (without_experimental == 0)
-    without_experimental = total;
-
-  if (!NO_LAST) {
-    protos("unknown", "/**< Unknown headers */", -3);
-    protos("error", "/**< Erroneous headers */", -4);
-    protos("separator", "/**< Separator line between headers and body */", -5);
-    protos("payload", "/**< Message payload */", -6);
-    if (multipart)
-      protos("multipart", "/**< Multipart payload */", -7);
-  }
-
-  if (PR) {
-    process_footer(footer);
-  }
-  else if (PT) {
-    if (FLAGFILE)
-      read_header_flags(FLAGFILE);
-
-    if (TEMPLATE == "") { TEMPLATE = PT ".in"; }
-    RS0=RS; RS="-\n";
-    getline theader < TEMPLATE;
-    getline header < TEMPLATE;
-    getline template < TEMPLATE;
-    getline footer < TEMPLATE;
-    RS=RS0;
-
-    module_struct = module "_t";
-
-    sub(/.*[\/]/, "", TEMPLATE);
-    gsub(/#AUTO#/, auto, header);
-    gsub(/#DATE#/, "@date Generated: " date, header);
-    print header > PT;
-
-    print "" > PT;
-    print "#define msg_offsetof(s, f) ((unsigned short)offsetof(s ,f))" > PT;
-    print "" > PT;
-
-    if (MC_SHORT_SIZE) {
-      printf("static msg_href_t const " \
-	     "%s_short_forms[MC_SHORT_SIZE] = \n{\n",
-	     module) > PT;
-
-      for (i = 1; i <= MC_SHORT_SIZE; i = i + 1) {
-	c = (i == MC_SHORT_SIZE) ? "" : ",";
-	if (i in shorts) {
-	  n = shorts[i];
-        flags = header_flags[n]; if (flags) flags = ",\n      " flags;
-
-	  printf("  { /* %s */ %s_%s_class, msg_offsetof(%s_t, %s_%s)%s }%s\n",
-		 substr(lower_case, i, 1),
-		 tprefix, n, module, prefix, n, flags, c)	\
-	    > PT;
-	}
-	else {
-	  printf("  { NULL }%s\n", c) \
-	    > PT;
-	}
-      }
-      printf("};\n\n") > PT;
-    }
-
-    # printf("extern msg_hclass_t msg_multipart_class[];\n\n") > PT;
-
-    if (extra > 0) {
-      printf("struct %s {\n", extra_struct) > PT;
-      printf("  %s base;\n", module_struct) > PT;
-      if (total - without_experimental < extra) {
-	printf("  msg_header_t *extra[%u];\n",
-	       extra - (total - without_experimental)) > PT;
-      }
-      if (total - without_experimental > 0) {
-	print "#if SU_HAVE_EXPERIMENTAL" > PT;
-	printf("  msg_header_t *experimental[%u];\n",
-	       total - without_experimental) > PT;
-	print "#endif" > PT;
-      }
-      printf("};\n\n") > PT;
-      module_struct = "struct " extra_struct;
-    }
-
-    printf("msg_mclass_t const %s_mclass[1] = \n{{\n", module) > PT;
+  headers[total] = n; total++; ordinary++;
+}
+
+function print_parser_table(struct, scope, name, N, N_EXPERIMENTAL)
+{
+  if (PT) {
+    printf("/* Ordinary %u, extra %u, experimental %u */\n",
+	   ordinary, N - ordinary, N_EXPERIMENTAL - N) > PT;
+    printf("struct %s {\n", struct) > PT;
+    printf("  %s_t base;\n", module) > PT;
+    printf("  msg_header_t *extra[%u];\n", N - ordinary) > PT;
+    if (N != N_EXPERIMENTAL) {
+      print "#if SU_HAVE_EXPERIMENTAL" > PT;
+      printf("  msg_header_t *extra[%u];\n", N_EXPERIMENTAL - N) > PT;
+      print "#endif" > PT;
+    }
+    printf("};\n\n") > PT;
+
+    printf("%s\n", scope) > PT;
+    printf("msg_mclass_t const %s[1] = \n{{\n", name) > PT;
     printf("# if defined (%s_HCLASS)\n", toupper(module)) > PT;
     printf("  %s_HCLASS,\n", toupper(module)) > PT;
     printf("#else\n") > PT;
@@ -497,7 +433,7 @@
     printf("#else\n") > PT;
     printf("  0,\n") > PT;
     printf("#endif\n") > PT;
-    printf("  sizeof (%s),\n", module_struct) > PT;
+    printf("  sizeof (struct %s),\n", struct) > PT;
     printf("  %s_extract_body,\n", module) > PT;

     len = split("request status separator payload unknown error", unnamed, " ");
@@ -519,15 +455,123 @@
       printf("  NULL, \n") > PT;
     }
     printf("  %d, \n", MC_HASH_SIZE) > PT;
-    printf ("#if SU_HAVE_EXPERIMENTAL\n" \
-	    "  %d,\n" \
-	    "#else\n" \
-	    "  %d,\n" \
-	    "#endif\n", \
-	    total, without_experimental) > PT;
+    if (N != N_EXPERIMENTAL) {
+      print "#if SU_HAVE_EXPERIMENTAL" > PT;
+      printf("  %d,\n", N_EXPERIMENTAL) > PT;
+      print "#else" > PT;
+    }
+    printf("  %d,\n", N) > PT;
+    if (N != N_EXPERIMENTAL) {
+      print "#endif" > PT;
+    }
+
     printf("  {\n") > PT;

-    for (i = 0; i < total; i++) {
+    for (j = 0; j < MC_HASH_SIZE; j++) {
+      c = (j + 1 == MC_HASH_SIZE) ? "" : ",";
+      if (j in header_hash) {
+	n = header_hash[j];
+	i = index_hash[j];
+
+        flags = header_flags[n]; if (flags) flags = ",\n      " flags;
+
+	if (i >= N) {
+	  print "#if SU_HAVE_EXPERIMENTAL" > PT;
+	}
+
+	if (i >= ordinary) {
+	  printf("    { %s_%s_class,\n" \
+		 "      msg_offsetof(struct %s, extra[%u])%s }%s\n",
+		 tprefix, n, struct, Extra[n], flags, c) > PT;
+	}
+	else {
+	  printf("    { %s_%s_class, msg_offsetof(%s_t, %s_%s)%s }%s\n",
+		 tprefix, n, module, prefix, n, flags, c) > PT;
+	}
+
+	if (i >= N) {
+	  printf("#else\n    { NULL, 0 }%s\n#endif\n", c) > PT;
+	}
+      }
+      else {
+	printf("    { NULL, 0 }%s\n", c) > PT;
+      }
+    }
+    printf("  }\n}};\n\n") > PT;
+
+    }
+}
+
+END {
+  if (failed) { exit };
+
+  if (!NO_LAST) {
+    protos("unknown", "/**< Unknown headers */", -3);
+    protos("error", "/**< Erroneous headers */", -4);
+    protos("separator", "/**< Separator line between headers and body */", -5);
+    protos("payload", "/**< Message payload */", -6);
+    if (multipart)
+      protos("multipart", "/**< Multipart payload */", -7);
+  }
+
+  if (PR) {
+    process_footer(footer);
+  }
+  else if (PT) {
+    if (FLAGFILE)
+      read_header_flags(FLAGFILE);
+
+    if (TEMPLATE == "") { TEMPLATE = PT ".in"; }
+    RS0=RS; RS="+\n";
+    getline theader < TEMPLATE;
+    getline header < TEMPLATE;
+    getline template < TEMPLATE;
+    getline footer < TEMPLATE;
+    RS=RS0;
+
+    sub(/.*[\/]/, "", TEMPLATE);
+    gsub(/#AUTO#/, auto, header);
+    gsub(/#DATE#/, "@date Generated: " date, header);
+    print header > PT;
+
+    print "" > PT;
+    print "#define msg_offsetof(s, f) ((unsigned short)offsetof(s ,f))" > PT;
+    print "" > PT;
+
+    if (MC_SHORT_SIZE) {
+      printf("static msg_href_t const " \
+	     "%s_short_forms[MC_SHORT_SIZE] = \n{\n",
+	     module) > PT;
+
+      for (i = 1; i <= MC_SHORT_SIZE; i = i + 1) {
+	c = (i == MC_SHORT_SIZE) ? "" : ",";
+	if (i in shorts) {
+	  n = shorts[i];
+        flags = header_flags[n]; if (flags) flags = ",\n      " flags;
+
+	printf("  { /* %s */ %s_%s_class, msg_offsetof(%s_t, %s_%s)%s }%s\n",
+	       substr(lower_case, i, 1),
+	       tprefix, n, module, prefix, n, flags, c)	\
+	    > PT;
+	}
+	else {
+	  printf("  { NULL }%s\n", c) \
+	    > PT;
+	}
+      }
+      printf("};\n\n") > PT;
+    }
+
+    # printf("extern msg_hclass_t msg_multipart_class[];\n\n") > PT;
+
+    if (basic == 0) basic = total;
+    if (without_experimental == 0) without_experimental = total;
+
+    split("", header_hash);
+    split("", index_hash);
+
+    for (i = 0; i < basic; i++) {
       n = headers[i];
       h = hashed[n];

@@ -543,38 +587,50 @@
       }

       header_hash[j] = n;
-      experimental2[j] = (i >= without_experimental);
-    }
-
-    for (i = 0; i < MC_HASH_SIZE; i++) {
-      c = (i + 1 == MC_HASH_SIZE) ? "" : ",";
-      if (i in header_hash) {
-	n = header_hash[i];
-        flags = header_flags[n]; if (flags) flags = ",\n      " flags;
-
-	if (experimental2[i]) {
-	  print "#if SU_HAVE_EXPERIMENTAL" > PT;
-	}
-
-	if (Since[n]) {
-	  printf("    { %s_%s_class,\n" \
-		 "      msg_offsetof(struct %s, extra[%u])%s }%s\n",
-		 tprefix, n, extra_struct, Extra[n], flags, c) > PT;
-	}
-	else {
-	  printf("    { %s_%s_class, msg_offsetof(%s_t, %s_%s)%s }%s\n",
-		 tprefix, n, module, prefix, n, flags, c) > PT;
-	}
-
-	if (experimental2[i]) {
-	  printf("#else\n    { NULL, 0 }%s\n#endif\n", c) > PT;
-	}
-      }
-      else {
-	printf("    { NULL, 0 }%s\n", c) > PT;
-      }
-    }
-    printf("  }\n}};\n\n") > PT;
+      index_hash[j] = i;
+    }
+
+    m = module "_mclass";
+    s = "_d_" module "_t";
+
+    /* Add basic headers */
+    if (ordinary == basic) {
+      print_parser_table(s, "", m, basic, basic);
+    }
+    else if (basic < without_experimental) {
+      print_parser_table(s, "", m, basic, basic);
+    }
+    else {
+      print_parser_table(s, "", m, without_experimental, basic);
+   }
+
+    /* Hash extra headers */
+   for (i = basic; i < total; i++) {
+      n = headers[i];
+      h = hashed[n];
+
+      if (h < 0)
+	continue;
+
+      j = h % MC_HASH_SIZE; if (j == -0) j = 0;
+
+      for (; j in header_hash;) {
+	if (++j == MC_HASH_SIZE) {
+	  j = 0;
+	}
+      }
+
+      header_hash[j] = n;
+      index_hash[j] = i;
+    }
+
+    if (basic < total) {
+      m = module "_ext_mclass";
+      s = "_e_" module "_s";
+      print_parser_table(s, "static", m, without_experimental, total);
+    }
+
+    printf("msg_mclass_t const * %s_extended_mclass = %s;\n", module, m) > PT;
   }

   exit success;


msg_parser.awk: not extending header structure unless needed.

Removed gawk-ish /* comments */.

darcs-hash:20071005172604-88462-534f27ddb24a0863406057e7f64cdab96830003b.gz

--- libsofia-sip-ua/msg/msg_parser.awk
+++ libsofia-sip-ua/msg/msg_parser.awk
@@ -407,17 +407,19 @@
 function print_parser_table(struct, scope, name, N, N_EXPERIMENTAL)
 {
   if (PT) {
-    printf("/* Ordinary %u, extra %u, experimental %u */\n",
-	   ordinary, N - ordinary, N_EXPERIMENTAL - N) > PT;
-    printf("struct %s {\n", struct) > PT;
-    printf("  %s_t base;\n", module) > PT;
-    printf("  msg_header_t *extra[%u];\n", N - ordinary) > PT;
-    if (N != N_EXPERIMENTAL) {
-      print "#if SU_HAVE_EXPERIMENTAL" > PT;
-      printf("  msg_header_t *extra[%u];\n", N_EXPERIMENTAL - N) > PT;
-      print "#endif" > PT;
-    }
-    printf("};\n\n") > PT;
+    if (N > ordinary) {
+      printf("/* Ordinary %u, extra %u, experimental %u */\n",
+	     ordinary, N - ordinary, N_EXPERIMENTAL - N) > PT;
+      printf("struct %s {\n", struct) > PT;
+      printf("  %s_t base;\n", module) > PT;
+      printf("  msg_header_t *extra[%u];\n", N - ordinary) > PT;
+      if (N != N_EXPERIMENTAL) {
+	print "#if SU_HAVE_EXPERIMENTAL" > PT;
+	printf("  msg_header_t *extra[%u];\n", N_EXPERIMENTAL - N) > PT;
+	print "#endif" > PT;
+      }
+      printf("};\n\n") > PT;
+    }

     printf("%s\n", scope) > PT;
     printf("msg_mclass_t const %s[1] = \n{{\n", name) > PT;
@@ -433,7 +435,12 @@
     printf("#else\n") > PT;
     printf("  0,\n") > PT;
     printf("#endif\n") > PT;
-    printf("  sizeof (struct %s),\n", struct) > PT;
+    if (N > ordinary) {
+      printf("  sizeof (struct %s),\n", struct) > PT;
+    }
+    else {
+      printf("  sizeof (%s_t),\n", module) > PT;
+    }
     printf("  %s_extract_body,\n", module) > PT;

     len = split("request status separator payload unknown error", unnamed, " ");
@@ -593,7 +600,7 @@
     m = module "_mclass";
     s = "_d_" module "_t";

-    /* Add basic headers */
+    # Add basic headers
     if (ordinary == basic) {
       print_parser_table(s, "", m, basic, basic);
     }
@@ -606,7 +613,7 @@

    if (0) {

-   /* Hash extra headers */
+   # Hash extra headers
    for (i = basic; i < total; i++) {
       n = headers[i];
       h = hashed[n];


[proofalytics] drop extra .v from links

[proofalytics] drop extra .v from links

--- proofalytics/build-times-links.awk
+++ proofalytics/build-times-links.awk
@@ -10,6 +10,6 @@
   if (NR == 1) {
     print $0
   } else {
-    printf("%s.v,%s\n", gh, $1, $1, $2)
+    printf("%s,%s\n", gh, $1, $1, $2)
   }
 }


Clean up bonus and part2 code

Clean up bonus and part2 code

--- getAcornFrom-seriesPages.awk
+++ getAcornFrom-seriesPages.awk
@@ -226,13 +226,15 @@
         showType = "S"
     # Default episodeType to "E"
     episodeType = "E"
-    # Default bonus episodeType to "X"
-    if (episodeURL ~ /bonus\//) {
+    # Default bonus & parttwo episodeType to "X"
+    if (episodeURL ~ /bonus\/|[0-9]{1,2}parttwo\//)
         episodeType = "X"
-    }
-    # Default christmasspecial episodeType to "K", don't increment seasonNumber
-    if (episodeURL ~ /christmasspecial\//) {
-        episodeType = "K"
+    # Default christmasspecial & seriesfinale episodeType to "X" & don't increment seasonNumber
+    if (episodeURL ~ /christmasspecial\/|\/seriesfinale\//) {
+        episodeType = "X"
+        split (episodeURL, part, "/")
+        printf ("==> Corrected mismatch: https://acorn.tv/%s/%s was series %d\n", \
+               part[4], part[5], seasonNumber) >> ERROR_FILE
         seasonNumber -= 1
     }
     #
@@ -247,12 +249,14 @@
     # The season number should match that in the URL
     # Birds of a Feather, Doc Martin, Murdoch, Poirot, Rebus, Vera, and others have problems
     if (episodeURL ~ \
-           /\/series[0-9]{1,2}\/|[0-9]{1,2}bonus\/|\/murdoch\/season[0-9]{1,2}/) {
+           /\/series[0-9]{1,2}\/|[0-9]{1,2}bonus\/|[0-9]{1,2}parttwo\/|\/murdoch\/season[0-9]{1,2}/) {
         split (episodeURL, part, "/")
         URLseasonNumber = part[5]
         sub (/bonus/,"",URLseasonNumber)
         # Foyle's War has sets: foyleswar/series9set8bonus/
         sub (/set[0-9]/,"",URLseasonNumber)
+        # Midsomer Murders has two parts: midsomermurders/series19parttwo/
+        sub (/parttwo/,"",URLseasonNumber)
         sub (/christmasspecial/,"",URLseasonNumber)
         sub (/[[:alpha:]]*/,"",URLseasonNumber)
         if (URLseasonNumber != seasonNumber) {


TranslatorInterface: add abstract method _PostRequestBody()

--- include/TranslatorInterface.awk
+++ include/TranslatorInterface.awk
@@ -14,10 +14,16 @@
     return @vm(text, sl, tl, hl)
 }

-# Abstract method foobarPostRequestUrl(text, sl, tl, hl: string): string
-function _PostRequestUrl(text, sl, tl, hl,    vm) {
+# Abstract method foobarPostRequestUrl(text, sl, tl, hl, type: string): string
+function _PostRequestUrl(text, sl, tl, hl, type,    vm) {
     vm = engineMethod("PostRequestUrl")
-    return @vm(text, sl, tl, hl)
+    return @vm(text, sl, tl, hl, type)
+}
+
+# Abstract method foobarPostRequestBody(text, sl, tl, hl, type: string): string
+function _PostRequestBody(text, sl, tl, hl, type,    vm) {
+    vm = engineMethod("PostRequestBody")
+    return @vm(text, sl, tl, hl, type)
 }

 # Abstract method foobarTTSUrl(text, tl: string): string


Help: update

Help: update

--- include/Help.awk
+++ include/Help.awk
@@ -247,7 +247,7 @@
         ansi("bold", "-theme [theme]") RS                               \
         ins(1, "Specify the theme to use. (default: default)") RS       \
         ansi("bold", "-no-ansi") RS                                     \
-        ins(1, "Do not use ANSI escape codes in the translation.") RS    \
+        ins(1, "Do not use ANSI escape codes in the translation.") RS   \
         ansi("bold", "-w [num], -width [num]") RS                       \
         ins(1, "Specify the screen width for padding when displaying right-to-left languages.") RS \
         ansi("bold", "-indent [num]") RS                                \
@@ -287,7 +287,7 @@
         ansi("bold", "-t [codes], -target [codes]") RS                  \
         ins(1, "Specify the target language(s) (language(s) of the translated text).") RS \
         ansi("bold", "-no-init") RS                                     \
-        ins(1, "Do not load any initialization script.") RS     \
+        ins(1, "Do not load any initialization script.") RS             \
         RS "See the man page " Command "(1) for more information."
 }


add option -nothing

add option -nothing

--- include/Main.awk
+++ include/Main.awk
@@ -195,6 +195,13 @@
                 if (group[3]) split(group[3], Option["tl"], "+")
             } else
                 split(ARGV[++pos], Option["tl"], "+")
+            continue
+        }
+
+        # -N, -nothing
+        match(ARGV[pos], /^--?(N|nothing)$/)
+        if (RSTART) {
+            InfoOnly = "nothing"
             continue
         }

@@ -568,6 +575,8 @@
     case "list":
         print getList(Option["tl"])
         exit
+    case "nothing":
+        exit
     }

     if (Option["interactive"])


change -U to -u as shorthand for option -user-agent

--- include/Main.awk
+++ include/Main.awk
@@ -339,8 +339,8 @@
             continue
         }

-        # -U [agent], -user-agent [agent]
-        match(ARGV[pos], /^--?(user-agent|U)(=(.*)?)?$/, group)
+        # -u [agent], -user-agent [agent]
+        match(ARGV[pos], /^--?(user-agent|u)(=(.*)?)?$/, group)
         if (RSTART) {
             Option["user-agent"] = group[2] ?
                 (group[3] ? group[3] : Option["user-agent"]) :


add UriSchemes

add UriSchemes

--- include/Commons.awk
+++ include/Commons.awk
@@ -295,7 +295,15 @@
     return !system("test -f " file)
 }

+# Initialize `UriSchemes`.
+function initUriSchemes() {
+    UriSchemes[0] = "file"
+    UriSchemes[1] = "http"
+    UriSchemes[2] = "https"
+}
+
 BEGIN {
     initUrlEncoding()
     initAnsiCode()
-}
+    initUriSchemes()
+}


Quick fix for parsing from pipe to be working

--- JSON.awk
+++ JSON.awk
@@ -34,10 +34,10 @@
 	# filepathnames from stdin
 	# usage: echo -e "file1\nfile2\n" | awk -f JSON.awk
 	# usage: { echo -; echo; cat; } | awk -f JSON.awk
-	while (getline ARGV[++ARGC] < "/dev/stdin") {
-		if (ARGV[ARGC] == "")
-			break
-	}
+	#while (getline ARGV[++ARGC] < "/dev/stdin") {
+	#	if (ARGV[ARGC] == "")
+	#		break
+	#}
 	# set file slurping mode
 	srand(); RS="n/o/m/a/t/c/h" rand()
 }


Ignore some commands when generating devtest.md.

Running devtest.sh will require some commands that don't make sense
in the devtest.md docs, such as toggling set +/- u when setting
$no_proxy.
extract_docs will now ignore lines that end with "#nodocs" when
writing devtest.md.

Change-Id: Ibcb6e25c23b4797a21a3b43fedd10e591f68c699

--- scripts/extract-docs.awk
+++ scripts/extract-docs.awk
@@ -31,6 +31,8 @@
             unexpected_eof()
         if (line ~ /^### --end/)
             break
+        if (match(line, ".* #nodocs$"))
+            continue
         if (substr(line, 0, 3) == "## ") {
             line = substr(line, 4)
         } else if (line != "") {


ahrf.awk: do not espace &, because gawk thinks it is a sequence

--- ahrf.awk
+++ ahrf.awk
@@ -6,7 +6,7 @@
 {
 	# Common shell symbols to HTML
 	# Two backslashes for nawk(1) and OpenBSD awk(1)
-	gsub(/\&/,"\\&")
+	gsub(/&/,"\\&")
 	gsub(/</,"\\<")
 	gsub(/>/,"\\>")
 }


Define the DOTn constants in the Java bindings as bytes (rather than as chars). (dm)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@4504 91a5dbb7-01b9-0310-9b5f-b28072856b6e

--- Bindings/Java/constants.awk
+++ Bindings/Java/constants.awk
@@ -60,7 +60,7 @@
 }

 function brlDot(number, symbol, value, help) {
-  writeJavaConstant("int", "DOT" number, value, help)
+  writeJavaConstant("byte", "DOT" number, "(byte) (" value ")", help)
 }

 function apiConstant(name, symbol, value, help) {


revise tool.hgas/calc_quad_dft.awk

revise tool.hgas/calc_quad_dft.awk


revise tool.tde2d/padInitialiCondition.awk

--- tool.tde2d/padInitialCondition.awk
+++ tool.tde2d/padInitialCondition.awk
@@ -4,11 +4,11 @@
 }
 {
     if(NR == 1) {
-        print $4, $5, $6;
+        print $1, $2, $3;
     } else {
-        dz = ($4 - prevz) / n;
-        dd = ($5 - prevd) / n;
-        dv = ($6 - prevv) / n;
+        dz = ($1 - prevz) / n;
+        dd = ($2 - prevd) / n;
+        dv = ($3 - prevv) / n;
         for(i = 0; i < n; i++) {
             posz = prevz + dz * (i + 1);
             dens = prevd + dd * (i + 1);
@@ -16,9 +16,9 @@
             printf("%+e %+e %+e\n", posz, dens, velz);
         }
     }
-    prevz = $4;
-    prevd = $5;
-    prevv = $6;
+    prevz = $1;
+    prevd = $2;
+    prevv = $3;
 }
 END{
     for(i = 0; i < n-1; i++) {


rnc2rng.awk: Support notAllowed

rnc2rng.awk: Support notAllowed

--- rnc2rng.awk
+++ rnc2rng.awk
@@ -218,6 +218,9 @@
     if (name == "empty") {
       stack[++stack_i] = "<empty/>";
     }
+    else if (name == "notAllowed") {
+      stack[++stack_i] = "<notAllowed/>";
+    }
     else {
       stack[++stack_i] = sprintf("<ref name='%s'/>", name);
     }


Skip the DECLK layout when generating the GSC maps. ok mickey@

--- arch/hppa/gsc/makemap.awk
+++ arch/hppa/gsc/makemap.awk
@@ -1,5 +1,5 @@
 #! /usr/bin/awk -f
-#	$OpenBSD: makemap.awk,v 1.2 2003/05/27 15:31:52 mickey Exp $
+#	$OpenBSD: makemap.awk,v 1.3 2005/05/04 20:07:07 miod Exp $
 #
 # Copyright (c) 2003, Miodrag Vallat.
 # All rights reserved.
@@ -34,6 +34,7 @@

 BEGIN {
 	mapnum = 0
+	declk = 0

 	# PS/2 id -> GSCKBD conversion table, or "sanity lossage 101"
 	for (i = 0; i < 256; i++)
@@ -176,12 +177,23 @@
 	print $0
 	next
 }
+# Don't bother converting the DEC LK layout.
+/declk\[/ {
+	declk = 1
+	next
+}
+/declk/ {
+	next
+}
 /pckbd/ {
 	gsub("pckbd", "gsckbd", $0)
 	print $0
 	next
 }
 /KC/ {
+	if (declk)
+		next
+
 	sidx = substr($1, 4, length($1) - 5)
 	orig = int(sidx)
 	id = conv[orig]
@@ -208,6 +220,10 @@
 	next
 }
 /};/ {
+	if (declk) {
+		declk = 0
+		next
+	}
 	if (mapnum == 0) {
 		# Add 241 to the US map...
 		print "    KC(241),\tKS_Delete"
@@ -255,5 +271,7 @@
 	printf("\tKBD_MAP(KB_US | KB_MACHDEP,\tKB_US,\tpckbd_keydesc_precisionbook),\n");
 }
 {
+	if (declk)
+		next
 	print $0
 }


Main: fix typo

Main: fix typo

--- include/Main.awk
+++ include/Main.awk
@@ -116,7 +116,7 @@
     if (!Option["width"] && detectProgram("tput", "-V")) {
         command = "tput cols" SUPERR
         command | getline temp
-        close(commnad)
+        close(command)
         Option["width"] = temp ? temp - 2 : 64
     }


Main: update

Main: update

--- include/Main.awk
+++ include/Main.awk
@@ -562,8 +562,9 @@
     }

     if (Option["interactive"]) {
-        print AnsiCode["bold"] AnsiCode[tolower(Option["prompt-color"])] getVersion() AnsiCode[0] > STDERR
-        print AnsiCode[tolower(Option["prompt-color"])] "(:q to quit)" AnsiCode[0] > STDERR
+        l(">> starting interactive shell")
+        print ansi("bold", ansi(tolower(Option["prompt-color"]), getVersion())) > STDERR
+        print ansi(tolower(Option["prompt-color"]), "(:q to quit)") > STDERR
     }

     init3() # initialization #3


Bugfix: Do not include non-existent source files.

	modified:   code/awk/generate_source_list_from_make_output.awk

--- code/awk/generate_source_list_from_make_output.awk
+++ code/awk/generate_source_list_from_make_output.awk
@@ -21,8 +21,12 @@
     {
         current_filename = new_filename;

-        # print the filename.
-        print current_filename;
+        # find out if there's a matching source file.
+        if (system("test -f " current_filename) == 0)
+        {
+            # print the filename.
+            print current_filename;
+        }

         # find out if there's a matching `*.h` header file too.
         header_filename = gensub(/(^.*\.)c(|pp)$/, "\\1h", "g", current_filename);


test: add support for arrays in assertEqual() and assertNotEqual()

--- test.awk
+++ test.awk
@@ -1,26 +1,33 @@
 #!/usr/bin/gawk -f
 @include "include/Commons"
-@include "include/Utils"

-function pass(string, ansiCode) {
+function pass(name, message, ansiCode,    string) {
+    if (!name) name = TEST
     if (!ansiCode) ansiCode = "green"
+
+    G_COUNTER++; COUNTER++; G_SUCCESS++
+    string = sprintf("(%2s/%-2s) TESTING %s", COUNTER, TOTAL, name)
+    if (message) string = string "\n       " message
     print(ansi(ansiCode, ansi("bold", "[PASS] " string)))
 }

-function fail(string, ansiCode) {
+function fail(name, message, ansiCode,    string) {
+    if (!name) name = TEST
     if (!ansiCode) ansiCode = "red"
+
+    G_COUNTER++; COUNTER++
+    string = sprintf("(%2s/%-2s) TESTING %s", COUNTER, TOTAL, name)
+    if (message) string = string "\n       " message
     print(ansi(ansiCode, ansi("bold", "[FAIL] " string)))
 }

 function assertTrue(x, name, message, ansiCode) {
-    if (!message) message = "assertTrue: FALSE"
-    if (!name) name = TEST
-    G_COUNTER++; COUNTER++
-    string = "(" COUNTER "/" TOTAL ") TESTING " name
-    if (x) {
-        G_SUCCESS++
-        pass(string, ansiCode)
-    } else fail(string "\n       " message, ansiCode)
+    if (x)
+        pass(name, "", ansiCode)
+    else {
+        if (!message) message = "assertTrue: FALSE"
+        fail(name, message, ansiCode)
+    }
 }

 function assertFalse(x, name, message, ansiCode) {
@@ -28,18 +35,71 @@
     assertTrue(!x, name, message, ansiCode)
 }

-function assertEqual(x, y, name, message, ansiCode) {
-    if (!message)
-        message = "assertEqual: " ansi("underline", x)  \
-            " IS NOT EQUAL TO " ansi("underline", y)
-    assertTrue(x == y, name, message, ansiCode)
+function assertEqual(x, y, name, message, ansiCode,    i) {
+    if (isarray(x) && !isarray(y)) {
+        if (!message)
+            message = "assertEqual: EXPECTED SCALAR VALUE " ansi("underline", y) ", GOT:"
+        fail(name, message, ansiCode)
+        da(x)
+
+    } else if (!isarray(x) && isarray(y)) {
+        if (!message)
+            message = "assertEqual: GOT SCALAR VALUE " ansi("underline", x) ", EXPECTED:"
+        fail(name, message, ansiCode)
+        da(y)
+
+    } else if (isarray(x) && isarray(y)) {
+        if (length(x) != length(y)) {
+            if (!message)
+                message = "assertEqual: ARRAY LENGTH "                  \
+                    ansi("underline", length(x)) " != " ansi("underline", length(y))
+            fail(name, message, ansiCode)
+
+        } else {
+            for (i in x) {
+                if (x[i] != y[i]) {
+                    if (!message)
+                        message = "assertEqual: ARRAY[" i "] "          \
+                            ansi("underline", x[i]) " != " ansi("underline", y[i])
+                    fail(name, message, ansiCode)
+                    return
+                }
+            }
+            pass(name, "", ansiCode)
+        }
+
+    } else {
+        if (!message)
+            message = "assertEqual: " ansi("underline", x)      \
+                " IS NOT EQUAL TO " ansi("underline", y)
+        assertTrue(x == y, name, message, ansiCode)
+    }
 }

-function assertNotEqual(x, y, name, message, ansiCode) {
-    if (!message)
-        message = "assertNotEqual: " ansi("underline", x)       \
-            " IS EQUAL TO " ansi("underline", y)
-    assertFalse(x == y, name, message, ansiCode)
+function assertNotEqual(x, y, name, message, ansiCode,    i) {
+    if (isarray(x) && isarray(y)) {
+        if (length(x) != length(y))
+            pass(name, "", ansiCode)
+        else {
+            for (i in x) {
+                if (x[i] != y[i]) {
+                    pass(name, "", ansiCode)
+                    return
+                }
+            }
+            if (!message)
+                message = "assertNotEqual: TWO ARRAYS ARE IDENTICAL"
+            fail(name, message, ansiCode)
+        }
+
+    } else if (!isarray(x) && !isarray(y)) {
+        if (!message)
+            message = "assertNotEqual: " ansi("underline", x)   \
+                " IS EQUAL TO " ansi("underline", y)
+        assertFalse(x == y, name, message, ansiCode)
+
+    } else
+        pass(name, "", ansiCode)
 }

 function T(test, total) {
@@ -49,7 +109,7 @@
 }

 function START_TEST(name) {
-    print(ansi("negative", ansi("bold", "====== TESTING FOR "   \
+    print(ansi("negative", ansi("bold", "====== TESTING FOR "           \
                                 ansi("underline", name) " STARTED")))
     G_COUNTER = G_SUCCESS = 0
 }


Update prettyjson.awk for greater compatibility

Fixes #1

--- test/prettyjson.awk
+++ test/prettyjson.awk
@@ -2,7 +2,15 @@
 BEGIN {
 	# define constants
 	STRUCTURAL_TOKEN = "^[]{:,}[]"
-	TOKEN = "[\t\n\r ]+|[]{:,}[]|null|false|true|-?(0|[1-9][0-9]*)(\\.[0-9]+|)([Ee][+-]?[0-9]+|)|\"(\\\\[\"\\\\/bfnrt]|\\\\u[0-9a-fA-F]{4}|[^\\0-\\37\"\\\\])*\""
+		# whitespace, punctuator, keyword literal, number, or string
+	TOKEN = sprintf(                                                        \
+		"[\t\n\r ]+|[]{:,}[]|null|false|true|"                              \
+		"-?(0|[1-9][0-9]*)(\\.[0-9]+)?([Ee][+-]?[0-9]+)?|"                  \
+		"\"(\\\\[\"\\\\/bfnrt]|\\\\u[0-9a-fA-F]{4}|[^\\%d-\\37\"\\\\])*\"", \
+
+		# ancient awk implementations mishandle NULL characters
+		match("", "[\\0]")                                                  \
+	)
 	MALFORMED = "Non-token input after %d characters: "
 	MAX_LINE = 72
 	INDENT = "  "
@@ -42,7 +50,7 @@
 				err = err substr(excess, 1, free)
 			}

-			print err "\n" > "/dev/stderr"
+			printf "%s\n", err > "/dev/stderr"
 			exit 65 # EX_DATAERR
 		}

@@ -51,7 +59,7 @@
 		unconsumed = substr(unconsumed, RLENGTH + 1)
 		consumed += RLENGTH

-		# skip whitespace (octal \40 is the first non-whitespace non-control character)
+		# skip whitespace (octal \41 is the first non-whitespace non-control character)
 		if ( token < "\41" ) continue

 		# detect some invalid adjancencies
@@ -65,22 +73,22 @@
 		if ( token == "]" || token == "}" ) {
 			indent = substr(indent, length(INDENT) + 1)
 			if ( new_line != "maybe" ) {
-				print "\n" indent
+				printf "\n%s", indent
 			}
 		} else if ( new_line ) {
-			print "\n" indent
+			printf "\n%s", indent
 		}

 		# output token and remember newline intent
 		if ( token == "[" || token == "{" ) {
-			print token
+			printf "%s", token
 			indent = indent INDENT
 			new_line = "maybe"
 		} else if ( token == ":" ) {
-			print ": "
+			printf ": "
 			new_line = 0
 		} else {
-			print token
+			printf "%s", token
 			new_line = ( token == "," )
 		}
 	}
@@ -89,4 +97,4 @@
 	consumed++
 }

-END { print "\n" }
+END { printf "\n" }


- use kabi whitelists

- use kabi whitelists

--- scripts/modpost.awk
+++ scripts/modpost.awk
@@ -1380,9 +1380,35 @@
 	    set_symset(set, hash, pos, ssym, scrc, own, src, "syssymset")
 	}
 	# TODO: revalidate the hash by regenerating it
+	close(tar)
     }
     print_vinfo(1,"r: syssymset, syms " count_syms ", sets " count_sets)
-    close(tar)
+    return n
+}
+# read and process kabi_whitelist_<cpu> file
+function read_whitelist(file, own, src,	    n, command, list, count_lists)
+{
+    count_syms = 0; count_lists = 0
+    print_vinfo(1,"r: whitelist, file = \"" file "\"")
+    n = 0
+    if (system("test -r " file) == 0) {
+	command = cat_command(file)
+	while ((command | getline) == 1) {
+	    if ($1~/^[[][^][]*[]]$/) {
+		list = $1
+		sub(/^[[]/,"",list)
+		sub(/[]]$/,"",list)
+		count_lists = count_lists + 1
+		continue
+	    } else {
+		set_symbol($1, "", "", "", "", 0, "", src ":" list, 1, own)
+		kabi[$1] = 1
+		n++
+	    }
+	}
+	close(command)
+    }
+    print_vinfo(1,"r: whitelist, syms " count_syms ", lists " count_lists)
     return n
 }
 function path_symvers(path,	n,files,file,i)
@@ -1928,6 +1954,7 @@
     }
     if ("kversion" in ENVIRON) { kversion = ENVIRON["kversion"] }
     else                       { kversion = getline_command("uname -r") }
+    cpu = getline_command("uname -m")
     # MODPOST_SYSVER  contains all the system  defined symbol versions
     # MODPOST_MODVER  contains all the package defined symbol versions
     # MODPOST_SYMSETS contains the new symbol sets (jltz)
@@ -1944,6 +1971,7 @@
     longopts["pkgabi"       ] = "P:" ; environs["pkgabi"       ] = "MODPOST_PKGABI"		 ; defaults["pkgabi"       ] = "package.abi"					; descrips["pkgabi"       ] = "input file containing package ABI definitions"
     longopts["symsets"      ] = "S:" ; environs["symsets"      ] = "MODPOST_SYMSETS"		 ; defaults["symsets"      ] = "symsets-openss7-" kversion ".tar.gz"		; descrips["symsets"      ] = "output file for symsets"
     longopts["ksymsets"     ] = "K:" ; environs["ksymsets"     ] = "MODPOST_KSYMSETS"		 ; defaults["ksymsets"     ] = "/boot/symsets-" kversion ".tar.gz"		; descrips["ksymsets"     ] = "input system symsets file"
+    longopts["whitelist"    ] = "L:" ; environs["whitelist"    ] = "MODPOST_WHITELIST"		 ; defaults["whitelist"    ] = "/lib/modules/kabi/kabi_whitelist_" cpu		; descrips["whitelist"    ] = "input kabi whitelist file"
     longopts["missing"      ] = "g"  ;								   defaults["missing"      ] = 0						; descrips["missing"      ] = "create missing system symsets (ksyms missing from kabi)"
     longopts["rip-symbols"  ] = "r"  ;								   defaults["rip-symbols"  ] = 1						; descrips["rip-symbols"  ] = "attempt to rip undefined symbols from system map (requires -F, implies -U)"
     longopts["rip-weak"     ] = "R"  ;								   defaults["rip-weak"     ] = 1						; descrips["rip-weak"     ] = "attempt to rip weak undefined symbols from system map (requires -F, implies -U)"
@@ -1995,7 +2023,7 @@
     values["silent"       ] = defaults["silent"       ]
     values["debug"        ] = defaults["debug"        ]
     values["verbose"      ] = defaults["verbose"      ]
-    optstring = "M:c:k:d:F:i:o:s:*P:K:S:grRbUwWHf:umaxp:enqD::v::hVC"
+    optstring = "M:c:k:d:F:i:o:s:*P:K:L:S:grRbUwWHf:umaxp:enqD::v::hVC"
     optind = 0
     #opts = ""; for (i=1;i<ARGC;i++) { if (i == 1) { opts = ARGV[i] } else { opts = opts " " ARGV[i] } }
     #print me ": D: o: command line: " opts > stderr; written[stderr] = 1
@@ -2004,7 +2032,7 @@
 	c = getopt_long(ARGC, ARGV, optstring, longopts)
 	#if (c != -1) { print me ": D: o: option -" c ", longopt --" option ", optset = " optset ", optarg = " optarg > stderr; written[stderr] = 1 }
 	if (c == -1) break
-	else if (c ~ /[MckdFiosPKSfp]/)			{ values[option] = optarg }
+	else if (c ~ /[MckdFiosPKLSfp]/)		{ values[option] = optarg }
 	else if (c ~ /[grRbUwWHumaxenq]/)		{ values[option] = optset }
 	else if (c~/[Dv]/) { if (optarg != "")		{ values[option] = optarg } else { if (optset)  { values[option]++ } else { values[option] = optset } } }
 	else if (c~/[hVC]/)	{ command = option }
@@ -2096,16 +2124,24 @@
 	    else
 		print_error("r: moduledir, directory not found")
 	}
+	values["kabi"] = 0
 	if (("ksymsets" in values) && values["ksymsets"])
 	    values["kabi"] = read_symsets(values["ksymsets"], "kabi", "syssymset")
 	else {
-	    values["kabi"] = 0
 	    file = "symsets-" kversion ".tar.gz"
 	    if (system("test -r /boot/" file) == 0) {
 		values["kabi"] = values["kabi"] + read_symsets("/boot/" file, "kabi", "syssymset")
 	    }
 	    if (system("test -r /lib/modules/" kversion "/build/" file) == 0) {
 		values["kabi"] = values["kabi"] + read_symsets("/lib/modules/" kversion "/build/" file, "kabi", "syssymset")
+	    }
+	}
+	if (("whitelist" in values) && values["whitelist"])
+	    values["kabi"] = read_whitelist(values["whitelist"], "kabi", "whitelist")
+	else {
+	    file = "kabi_whitelist_" cpu
+	    if (system("test -r /lib/modules/kabi/" file) == 0) {
+		values["kabi"] = read_whitelist("/lib/modules/kabi/" file, "kabi", "whitelist")
 	    }
 	}
     }


Allow both old and new rc.conf syntax.

Allow both old and new rc.conf syntax.

--- usr.sbin/ndc/ndcedit.awk
+++ usr.sbin/ndc/ndcedit.awk
@@ -1,4 +1,4 @@
-# $Id: ndcedit.awk,v 1.7 1998/05/03 05:14:04 peter Exp $
+# $Id: ndcedit.awk,v 1.8 1998/07/31 08:47:16 phk Exp $
 NR == 3 {
 	print "#"
 	print "# This file is generated automatically, do not edit it here!"
@@ -7,7 +7,9 @@
 	print ""

 	print "# If there is a global system configuration file, suck it in."
-	print "if [ -f /etc/rc.conf ]; then"
+	print "if [ -f /etc/defaults/rc.conf ]; then"
+	print "\t. /etc/defaults/rc.conf"
+	print "elif [ -f /etc/rc.conf ]; then"
 	print "\t. /etc/rc.conf"
 	print "fi\n"
 }


build.awk: update

build.awk: update

--- build.awk
+++ build.awk
@@ -24,9 +24,9 @@

 # Task: man
 function man() {
-    system("pandoc -s -t man " Markdown " -o " Man)
-    system("pandoc -s -t html --toc --toc-depth 1 --template " Template " " Markdown " -o " Html)
-    return 0
+    if (fileExists(Template))
+        system("pandoc -s -t html --toc --toc-depth 1 --template " Template " " Markdown " -o " Html)
+    return system("pandoc -s -t man " Markdown " -o " Man)
 }

 # Task: build


make build.awk compatible with gawk 4.0 (fix #25)

--- build.awk
+++ build.awk
@@ -1,7 +1,7 @@
 #!/usr/bin/gawk -f

-@include "include/Commons"
-@include "metainfo"
+@include "include/Commons.awk"
+@include "metainfo.awk"

 function init() {
     BuildPath = "build/"


linksets metadata

linksets metadata

--- bin/util/sameasInNT.awk
+++ bin/util/sameasInNT.awk
@@ -1,6 +1,9 @@
 # sameasFromNT
 #

-$2 == "<http://purl.org/dc/terms/isReferencedBy>" || $2 == "<http://www.w3.org/2002/07/owl#sameAs>" {
+#$2 == "<http://purl.org/dc/terms/isReferencedBy>" || $2 == "<http://www.w3.org/2002/07/owl#sameAs>" {
+#   print
+#}
+$2 == "<http://www.w3.org/2002/07/owl#sameAs>" {
    print
 }


Languages: add Oriya language

Languages: add Oriya language

--- include/Languages.awk
+++ include/Languages.awk
@@ -221,6 +221,19 @@
     Locale["om"]["iso"]                = "orm"
     Locale["om"]["glotto"]             = "nucl1736"
     Locale["om"]["script"]             = "Latn"
+
+    #? Oriya
+    Locale["or"]["name"]               = "Oriya"
+    Locale["or"]["endonym"]            = "ଓଡ଼ିଆ"
+    #Locale["or"]["translations-of"]
+    #Locale["or"]["definitions-of"]
+    #Locale["or"]["synonyms"]
+    #Locale["or"]["examples"]
+    #Locale["or"]["see-also"]
+    Locale["or"]["family"]             = "Indo-European"
+    Locale["or"]["iso"]                = "ori"
+    Locale["or"]["glotto"]             = "macr1269"
+    Locale["or"]["script"]             = "Orya"

     #1 Afrikaans
     Locale["af"]["name"]               = "Afrikaans"


gensub() isn't a portable awk function. (dm)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@4405 91a5dbb7-01b9-0310-9b5f-b28072856b6e

--- Programs/brldefs.awk
+++ Programs/brldefs.awk
@@ -45,7 +45,10 @@
 }

 /#define[ \t]*BRL_DOT/ {
-  brlDot(substr($2, 8), $2, gensub("BRL_ARG_SET\\((.*)\\)", "\\1", 1, getDefineValue()), getComment($0))
+  value = getDefineValue()
+  sub("^.*\\(", "", value)
+  sub("\\).*$", "", value)
+  brlDot(substr($2, 8), $2, value, getComment($0))
   next
 }


Distinguish single season from Season 1

Distinguish single season from Season 1

--- getBritBoxSeasonsFrom-webscraper.awk
+++ getBritBoxSeasonsFrom-webscraper.awk
@@ -26,7 +26,7 @@
     # Fields to print from current line
     $6  == "" ? URL = $4 : URL = $6
     showTitle = $9
-    $10 == "" ? seasonTitle = "Season 1" : seasonTitle = $10
+    $10 == "" ? seasonTitle = "(Only season)" : seasonTitle = $10
     Years = $11
     NumEpisodes = $12
     $14 == "" ? Description = $13 : Description = $14


shell wrapper: replace explicit argument with process substitution (fix #57)

--- build.awk
+++ build.awk
@@ -61,7 +61,6 @@
                 }
             }
         print "EOF" > Trans
-        print "export TRANS_PROGRAM" > Trans

         print "read -r -d '' TRANS_MANPAGE << 'EOF'" > Trans
         if (fileExists(Man))
@@ -69,8 +68,6 @@
                 print line > Trans
         print "EOF" > Trans
         print "export TRANS_MANPAGE" > Trans
-
-        print "export COLUMNS" > Trans

         if (type == "release")
             print "export TRANS_BUILD=release" temp > Trans
@@ -80,7 +77,7 @@
                 print "export TRANS_BUILD=git:" temp > Trans
         }

-        print "gawk \"$TRANS_PROGRAM\" - \"$@\"" > Trans
+        print "gawk -f <(echo -E \"$TRANS_PROGRAM\") - \"$@\"" > Trans

         ("chmod +x " parameterize(Trans)) | getline
         return 0


Update for source plugins.

Update for source plugins.


Languages: add endonym2 to LocaleAlias

Languages: add endonym2 to LocaleAlias

--- include/Languages.awk
+++ include/Languages.awk
@@ -267,6 +267,7 @@
     #15b Chinese (Mandarin), Traditional
     Locale["zh-TW"]["name"]            = "Chinese Traditional"
     Locale["zh-TW"]["endonym"]         = "繁體中文"
+    Locale["zh-TW"]["endonym2"]        = "正體中文"
     Locale["zh-TW"]["translations-of"] = "「%s」的翻譯"
     Locale["zh-TW"]["definitions-of"]  = "「%s」的定義"
     Locale["zh-TW"]["synonyms"]        = "同義詞"
@@ -2135,6 +2136,8 @@
         if ("name2" in Locale[i])
             LocaleAlias[tolower(Locale[i]["name2"])] = i
         LocaleAlias[tolower(Locale[i]["endonym"])] = i
+        if ("endonym2" in Locale[i])
+            LocaleAlias[tolower(Locale[i]["endonym2"])] = i
     }

     # Other aliases


prevent awk from replacing ampersand's with matched text

--- lib/render.awk
+++ lib/render.awk
@@ -58,7 +58,7 @@

   # replace yield with rendered content
   if (match($0, /{{{yield}}}/)) {
-    sub(/{{{yield}}}/, render_content(main))
+    sub(/{{{yield}}}/, escape_special_chars(render_content(main)))
   }

   if (layout == "") {
@@ -129,3 +129,9 @@

   return rendered_txt
 }
+
+# Prevent awk from replacing ampersand's with matched text
+function escape_special_chars(  txt) {
+  gsub(/&/, "\\\\&", txt)
+  return txt
+}


Translate: fix getTranslation()

Translate: fix getTranslation()

--- lib/Translate.awk
+++ lib/Translate.awk
@@ -97,7 +97,7 @@
         if (anything(phonetics))
             r = r "\n" AnsiCode["bold"] join(phonetics) AnsiCode["no bold"] # phonetic transcription

-        if (anything(altTranslations[0])) {
+        if (isarray(altTranslations[0]) && anything(altTranslations[0])) {
             # List alternative translations

             if (Locale[getCode(hl)]["rtl"] || Locale[getCode(il[0])]["rtl"])
@@ -118,7 +118,7 @@
                 r = r "\n" AnsiCode["bold"] temp AnsiCode["no bold"]
         }

-        if (anything(wordClasses)) {
+        if (isarray(wordClasses) && anything(wordClasses)) {
             # List dictionary entries

             for (i = 0; i < length(words); i++) {


chimeric script should ignore header lines in SAM files

--- SLURM/scripts/chimeric_blacklist.awk
+++ SLURM/scripts/chimeric_blacklist.awk
@@ -74,7 +74,7 @@
   OFS="\t";
   tottot = -1; # will count first non-group
 }
-{
+$0 !~ /^@/{
   # input file is sorted by read name.  Look at read name to group
   # appropriately
   split($1,a,"/");


Move content processing to 2018.

Move content processing to 2018.

--- scripts/tdb/statuses_clockss.awk
+++ scripts/tdb/statuses_clockss.awk
@@ -11,8 +11,8 @@
 #$3>date
 {
   # add a loop to add line only if either status is (wanted or testing) or ending year is gt or eq to contract year
-  # increased to 2016 July 1 2016.
-  current_year = 2017
+  # increased to 2018 July 1 ish 2018
+  current_year = 2018
   # end_year is the AU year, or the second half of a range, ie 2014 in 2013-2014
   end_year = 0
   incontract = 0


Edit awk path

Edit awk path

--- bench/compute_global_stats.awk
+++ bench/compute_global_stats.awk
@@ -1,4 +1,4 @@
-#!/bin/awk -f
+#!/usr/bin/awk -f

 # Caller must set nbscript and path values on the command line.
 # Example: compute_global_stats.awk -v path=2001-10-10@14:55:23/ -v nbscript=2 2001-10-10@14:55:23/stat_client0.html


Handle corrupted dmesg output better - sometimes, we get junk left around from the last boot, and we have more than one CPU: line. Sometimes (such as at Wisc.), the first instance contains garbage. So, instead of exiting after the first CPU: line, use a different method of handling unknown CPU speeds, modeled after chipset.awk .


Revise cppw2cpp

Revise cppw2cpp

--- scripts/cppw2cpp.awk
+++ scripts/cppw2cpp.awk
@@ -59,17 +59,39 @@
   return current_cppfile == "" || current_cppfile == cppfile
 }

-# Print a class function prototype
-function print_class_function_prototype() {
-  print_with_indent("CLASS_FUNCTION_PROTOTYPE")
-  # TODO
-}
-
 # Print a function argument
 function print_function_arg(arg,  printed_arg) {
   printed_arg = arg
   sub(/ *\/\/.*$/, "", printed_arg)
   printf(printed_arg)
+}
+
+# Print a class function prototype
+function print_class_function_prototype() {
+  print_indent_spacing(desired_indent_count)
+  print return_type " " class " ::"
+  print_indent_spacing(desired_indent_count + 2)
+  printf name
+  if (num_args == 0)
+    printf("(void)\n")
+  else if (num_args == 1) {
+    printf("(")
+    print_function_arg(args[1])
+    print ")"
+  }
+  else {
+    printf("(\n")
+    for (i = 1; i <= num_args; ++i) {
+      print_indent_spacing(desired_indent_count + 6)
+      printf(args[i])
+      if (i < num_args)
+        printf(",")
+      print ""
+    }
+    print_indent_spacing(desired_indent_count + 2)
+    print ")"
+  }
+  print_with_indent("{")
 }

 # Print a non-class function prototype
@@ -145,7 +167,6 @@
     print_non_class_function_prototype()
 }

-
 $1 == "@BEGIN" {
   begin = 1
 }


Cannnocalize episodeDuration in MHz

Cannnocalize episodeDuration in MHz

--- getMHzFromSitemap.awk
+++ getMHzFromSitemap.awk
@@ -196,6 +196,7 @@
     gsub (/'/,"'",episodeTitle)
     gsub (/"/,"\"\"",episodeTitle)
     gsub (/&/,"\\&",episodeTitle)
+    sub (/^[[:space:]]/,"",episodeTitle)
     sub (/[[:space:]]+$/,"",episodeTitle)
     # If start of episodeTitle == showTitle followed by ": " or " - ", remove the redundant part.
     if ((match (episodeTitle, showTitle ": ")) == 1 || \
@@ -272,6 +273,7 @@
     #  =HYPERLINK("https://watch.mhzchoice.com/gasmamman/season:1/videos/gasmamman-episode-01-sn-1-ep-1-1";\
     #  "Gasmamman, S01E01, Gåsmamman: Episode 01 (Sn 1 Ep 1)")
     if ($0 ~ /<\/div>/) {
+        # Make sure episodeDescription is valid
         if (episodeDescription == "") {
             if (episodeType == "T") {
                 episodeDescription = episodeTitle
@@ -285,6 +287,17 @@
         # print "==> episodeDescription = \n" episodeDescription > "/dev/stderr"
         episodeLink = sprintf ("=HYPERLINK(\"%s\";\"%s, S%02d%s%02d, %s\"\)", episodeURL, showTitle,
                     seasonNumber, episodeType, episodeNumber, episodeTitle)
+        #
+        # Make sure episodeDuration is valid
+        if (split (episodeDuration, tm, ":") == 3) {
+            # Cannnocalize episodeDuration to 3 parts like other services
+            episodeDuration = sprintf ("%02d:%02d:%02d",tm[1],tm[2],tm[3])
+        } else {
+            printf ("==> Bad episodeDuration %s in \"%s: %s\"\n", episodeDuration, showTitle,
+                    episodeTitle) >> ERRORS
+            episodeDuration = ""
+        }
+        #
         # Print "episode" line
         printf ("%s\t\t\t%s\t\t\t\t\t%s\n", episodeLink, episodeDuration, episodeDescription)
         #


revised program upload preamble

revised program upload preamble

--- program.awk
+++ program.awk
@@ -2,7 +2,8 @@
 	printf("set timeout 5\n\n");
 	printf("spawn telnet %s\n\n", host);
 	printf("expect \"'^]'.\"\n");
-	printf("send \"\\n\"\n");
+	printf("send \"NOOP\\n\"\n");
+	printf("expect \"ERROR\"\n");
 	printf("send \"PROGRAM\\n\"\n");
 	printf("expect \"OK\"\n");
 	printf("send \"LENGTH %d\\n\"\n", program_length);


build.awk: force pandoc to use non-smart markdown

--- build.awk
+++ build.awk
@@ -45,8 +45,8 @@
     writeTo(text, ManMarkdown)

     if (fileExists(ManHtmlTemplate))
-        system("pandoc -s -t html --toc --toc-depth 1 --template " ManHtmlTemplate " " ManMarkdown " -o " ManHtml)
-    return system("pandoc -s -t man " ManMarkdown " -o " Man)
+        system("pandoc -s -f markdown-smart -t html --toc --toc-depth 1 --template " ManHtmlTemplate " " ManMarkdown " -o " ManHtml)
+    return system("pandoc -s -f markdown-smart -t man " ManMarkdown " -o " Man)
 }

 function readme(    code, col, cols, content, group, i, j, num, language, r, rows, text) {


Translators/BingTranslator: fix bingWebTranslateUrl()

--- include/Translators/BingTranslator.awk
+++ include/Translators/BingTranslator.awk
@@ -11,7 +11,7 @@
     HttpPort = 80
 }

-# Retrieve the Cookie and set IG.
+# [OBSOLETE] Retrieve the Cookie and set IG.
 function bingSetIG(    content, cookie, group, header, isBody,
                        url, status, location) {
     url = HttpPathPrefix "/translator"
@@ -57,6 +57,7 @@
     }
 }

+# FIXME!
 function bingTTSUrl(text, tl,
                     ####
                     country, gender, i, group,
@@ -122,9 +123,19 @@
     return TempFile
 }

-function bingWebTranslateUrl(uri, sl, tl, hl) {
-    return "http://www.microsofttranslator.com/bv.aspx?"        \
-        "from=" sl "&to=" tl "&a=" uri
+function bingWebTranslateUrl(uri, sl, tl, hl,    _sl, _tl) {
+    # Hot-patches for language codes
+    _sl = sl; _tl = tl
+    if (_sl == "bs")    _sl = "bs-Latn" # 'bs' is not recognized as valid code
+    if (_sl == "zh")    _sl = "zh-CHS" # still old format
+    if (_sl == "zh-CN") _sl = "zh-CHS"
+    if (_sl == "zh-TW") _sl = "zh-CHT"
+    if (_tl == "bs")    _tl = "bs-Latn"
+    if (_tl == "zh")    _tl = "zh-CHS"
+    if (_tl == "zh-CN") _tl = "zh-CHS"
+    if (_tl == "zh-TW") _tl = "zh-CHT"
+
+    return "https://www.translatetheweb.com/?" "from=" _sl "&to=" _tl "&a=" uri
 }

 # Dictionary API (via HTTP GET).


modify lawson2osm.awk

modify lawson2osm.awk

--- lawson2osm.awk
+++ lawson2osm.awk
@@ -1 +1,57 @@
-# test
+
+# EUCѴƤ餳ΥץȤȤθ塢UTF᤹
+# cat tenpomaster | nkf -e | awk -F, -f lawson2osm.awk | nkf -w > tenpomaster.osm
+
+BEGIN {
+    printf("<?xml version='1.0' encoding='UTF-8'?>\n");
+    printf("<osm version='0.6'>\n");
+}
+{
+
+    if($1 !~ /^[0-9]*$/) next
+
+    cmd="echo "$11"|sed -e s//-/g -e s/*.$//g -e s//\\ /g| nkf -eZ|kakasi -Ha"
+    cmd | getline t
+    close(cmd)
+
+    cmd2="echo "$17"|sed s/^0/+81-/g"
+    cmd2|getline p
+    close(cmd2)
+
+    printf("  <node id='-%s' lat='%f' lon='%f'>\n",$1,$2/3600000,$3/3600000);
+    printf("    <tag k='shop' v='convenience' />\n");
+    printf("    <tag k='name' v=' %sŹ' />\n",$9);
+    printf("    <tag k='name:en' v='Lawson %s' />\n",t);
+    printf("    <tag k='branch' v='%sŹ' />\n",$9);
+    printf("    <tag k='branch:en' v='%s' />\n",t);
+    printf("    <tag k='operator' v='' />\n");
+    printf("    <tag k='operator:en' v='Lawson' />\n");
+    if($18==2){
+	printf("    <tag k='brand' v='ʥ' />\n");
+	printf("    <tag k='brand:en' v='Natural Lawson' />\n");
+    }else if($18==4){
+	printf("    <tag k='brand' v='󥹥ȥ100' />\n");
+	printf("    <tag k='brand:en' v='Lawson Store 100' />\n");
+    }else{
+	printf("    <tag k='brand' v='' />\n");
+	printf("    <tag k='brand:en' v='Lawson' />\n");
+    }
+    printf("    <tag k='phone' v='%s' />\n",p);
+    if($19==1){
+	printf("    <tag k='opening_hours' v='24/7' />\n");
+    }else{
+	printf("    <tag k='opening_hours' v='Mo-Su %s-%s' />\n",$20,$21);
+    }
+    if($5!=""){
+	printf("    <tag k='start_date' v='%s' />\n",$5);
+    }
+    if($6!=""){
+	printf("    <tag k='end_date' v='%s' />\n",$6);
+    }
+    printf("    <tag k='ref' v='%s' />\n",$1);
+    printf("    <tag k='source_ref' v='http://wiki.openstreetmap.org/wiki/Lawson_hackathon_2013' />\n");
+    printf("  </node>\n");
+}
+END {
+    printf("</osm>\n");
+}


Rather than casting through a (void *) to avoid the aliasing warning,
do things correctly from an aliasing perspective.  Put the
vop_generic_args element as the first element for all the vop_*_args
and adjust the code to take the address of that instead of the
structure.

OK'd based on a vague description by: phk

--- sys/tools/vnode_if.awk
+++ sys/tools/vnode_if.awk
@@ -294,7 +294,7 @@

 	if (hfile) {
 		# Print out the vop_F_args structure.
-		printh("struct "name"_args {\n\tstruct vnodeop_desc *a_desc;");
+		printh("struct "name"_args {\n\tstruct vop_generic_args a_gen;");
 		for (i = 0; i < numargs; ++i)
 			printh("\t" t_spc(types[i]) "a_" args[i] ";");
 		printh("};");
@@ -310,7 +310,7 @@
 		}
 		printh("{\n\tstruct " name "_args a;");
 		printh("\tint rc;");
-		printh("\ta.a_desc = VDESC(" name ");");
+		printh("\ta.a_gen.a_desc = VDESC(" name ");");
 		for (i = 0; i < numargs; ++i)
 			printh("\ta.a_" args[i] " = " args[i] ";");
 		for (i = 0; i < numargs; ++i)
@@ -324,7 +324,7 @@
 		printh("\t\tif (vop->"name" != NULL)")
 		printh("\t\t\trc = vop->"name"(&a);")
 		printh("\t\telse")
-		printh("\t\t\trc = vop->vop_bypass((struct vop_generic_args *)(void *)&a);")
+		printh("\t\t\trc = vop->vop_bypass(&a.a_gen);")
 		printh("\t}")
 		printh(ctrstr);
 		printh("if (rc == 0) {");


Languages: add Ewe

Languages: add Ewe

--- include/Languages.awk
+++ include/Languages.awk
@@ -411,6 +411,19 @@
     Locale["et"]["iso"]                = "est"
     Locale["et"]["glotto"]             = "esto1258"
     Locale["et"]["script"]             = "Latn"
+
+    # Ewe
+    Locale["ee"]["name"]               = "Ewe"
+    Locale["ee"]["endonym"]            = "Eʋegbe"
+    #Locale["ee"]["translations-of"]
+    #Locale["ee"]["definitions-of"]
+    #Locale["ee"]["synonyms"]
+    #Locale["ee"]["examples"]
+    #Locale["ee"]["see-also"]
+    Locale["ee"]["family"]            = "Atlantic-Congo"
+    Locale["ee"]["iso"]               = "ewe"
+    Locale["ee"]["glotto"]            = "ewee1241"
+    Locale["ee"]["script"]            = "Latn"

     #24 Filipino / Tagalog
     Locale["tl"]["name"]               = "Filipino"


Languages: use replicate()

Languages: use replicate()

--- include/Languages.awk
+++ include/Languages.awk
@@ -1358,12 +1358,8 @@
     if (code && Locale[getCode(code)]["rtl"]) {
         if (!width) width = Option["width"]
         return s(text, code, width - level * length(I))
-    } else {
-        temp = ""
-        for (i = 0; i < level; i++)
-            temp = temp I
-        return temp text
-    }
+    } else
+        return replicate(I, level) text
 }

 # Initialize strings for displaying endonyms of locales.


Update awk file to match rupa's z (#42)

Update awk file to match rupa's z (#42)

--- functions/z.awk
+++ functions/z.awk
@@ -6,50 +6,65 @@
     return rank/4
 }

-function output(files, toopen) {
-    if( option == "list" ) {
-        for( i in files ) if( files[i] ) printf "%-10s %s;", files[i], i
+function output(matches, best_match, common) {
+    # list or return the desired directory
+    if( list ) {
+        cmd = "sort -n >&2"
+        for( x in matches ) {
+            if( matches[x] ) {
+                printf "%-10s %s\n", matches[x], x | cmd
+            }
+        }
+        if( common ) {
+            printf "%-10s %s\n", "common:", common > "/dev/stderr"
+        }
     } else {
-        print toopen
+        if( common ) best_match = common
+        print best_match
     }
 }

-function common(matches, fnd, nc) {
-    for( i in matches ) {
-        if( matches[i] && (!short || length(i) < length(short)) ) short = i
+function common(matches) {
+    # find the common root of a list of matches, if it exists
+    for( x in matches ) {
+        if( matches[x] && (!short || length(x) < length(short)) ) {
+            short = x
+        }
     }
     if( short == "/" ) return
-    for( i in matches ) if( matches[i] && i !~ short ) x = 1
-    if( x ) return
-    if( nc ) {
-        for( i in fnd ) if( tolower(short) !~ tolower(fnd[i]) ) x = 1
-    } else for( i in fnd ) if( short !~ fnd[i] ) x = 1
-    if( !x ) return short
+    for( x in matches ) if( matches[x] && index(x, short) != 1 ) {
+            return
+        }
+    return short
 }

-BEGIN { split(q, a, " ") }
-    {
-        if( system("test -d \"" $1 "\"") ) next
-        if( typ == "rank" ) {
-            f = $2
-        } else if( typ == "recent" ) {
-            f = t-$3
-        } else f = frecent($2, $3)
-        wcase[$1] = nocase[$1] = f
-        for( i in a ) {
-            if( $1 !~ a[i] ) delete wcase[$1]
-            if( tolower($1) !~ tolower(a[i]) ) delete nocase[$1]
-        }
-        if( wcase[$1] > oldf ) {
-            cx = $1
-            oldf = wcase[$1]
-        } else if( nocase[$1] > noldf ) {
-            ncx = $1
-            noldf = nocase[$1]
-        }
+BEGIN {
+    gsub(" ", ".*", q)
+    hi_rank = ihi_rank = -9999999999
+}
+{
+    if( typ == "rank" ) {
+        rank = $2
+    } else if( typ == "recent" ) {
+        rank = $3 - t
+    } else rank = frecent($2, $3)
+    if( $1 ~ q ) {
+        matches[$1] = rank
+    } else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank
+    if( matches[$1] && matches[$1] > hi_rank ) {
+        best_match = $1
+        hi_rank = matches[$1]
+    } else if( imatches[$1] && imatches[$1] > ihi_rank ) {
+        ibest_match = $1
+        ihi_rank = imatches[$1]
     }
-    END {
-        if( cx ) {
-            output(wcase, cx)
-        } else if( ncx ) output(nocase, ncx)
+}
+
+END {
+# prefer case sensitive
+    if( best_match ) {
+        output(matches, best_match, common(matches))
+    } else if( ibest_match ) {
+        output(imatches, ibest_match, common(imatches))
     }
+}


datastartrow

datastartrow

--- bin/util/header2params2.awk
+++ bin/util/header2params2.awk
@@ -153,7 +153,12 @@
    if(length(nowXSD)) {
                                     printf("      dcterms:created \"%s\"^^xsd:dateTime;\n\n",nowXSD);
    }
-
+                                    printf("\n");
+                                    printf("      #conversion:enhance [\n");
+                                    printf("      #   ov:csvRow 2;\n");
+                                    printf("      #   a conversion:DataStartRow;\n");
+                                    printf("      #];\n");
+                                    printf("\n");
    #
    # Structural enhancement parameters.
    #


comments

comments

--- def-desc.awk
+++ def-desc.awk
@@ -1,4 +1,5 @@
-
+# the whole objective here is to provide a filename and return
+# Description  :: value, if any
 BEGIN {
     FS = "::";
     VALUE = 0;


simplify by using single quotes

simplify by using single quotes

--- tools/slidy.awk
+++ tools/slidy.awk
@@ -4,8 +4,8 @@

 {
     sub(/<title>Haskell: Functional Programming, Solid Code, Big Data<\/title>/, "<title>Intro \"Functional Programming\"</title>")
-    sub(/<meta name="date" content="2011-09-18" \/>/, "<meta name=\"date\" content=\"2011-10-19\" />")
-    sub(/<meta name="author" content="Bryan O'Sullivan" \/>/, "<meta name=\"author\" content=\"Gabor Greif\" />")
+    sub(/<meta name="date" content="2011-09-18" \/>/, "<meta name='date' content='2011-10-19' />")
+    sub(/<meta name="author" content="Bryan O'Sullivan" \/>/, "<meta name='author' content='Gabor Greif' />")
 }

 /^<body>/ {


Add 5 back into rotation.

Add 5 back into rotation.

git-svn-id: 293778eaa97c8c94097d610b1bd5133a8f478f36@32632 4f837ed2-42f5-46e7-a7a5-fa17313484d4


Fall back to graphviz splines where our curve is different in length beyond some threshold.

--- share/bin/plain2mp.awk
+++ share/bin/plain2mp.awk
@@ -142,15 +142,22 @@
 		# count number of self-loops for this node, and increment extension
 		printf "\tl%s := l%s + 1;", head, head
 		print "l := length pp;"
-		printf "pair m; m := (0.5 + 2 * mlog(l%s + 1) / 256) * d%s * unitvector(direction l of pp) shifted %s;\n", head, head, head
-		printf "draw %s -- m withpen pencircle scaled 0.25bp withcolor green;\n", head
+		printf "\tpair m; m := (0.5 + 2 * mlog(l%s + 1) / 256) * d%s * unitvector(direction l of pp) shifted %s;\n", head, head, head
+#		printf "\tdraw %s -- m withpen pencircle scaled 0.25bp withcolor green;\n", head

-		printf "path b; b = %s .. p .. m .. q .. %s;\n", head, tail;
+		printf "\tpath b; b = %s .. q .. m .. p .. %s;\n", tail, head;
 	} else {
-		printf "path b; b = %s .. p .. q .. %s;\n", head, tail;
+		printf "\tpath b; b = %s .. q .. p .. %s;\n", tail, head;
+
+		# TODO: explain this. we permit a 2% lengthening threshold relative to graphviz's b-spline
+		# this affects NFA especially
+		print "\tr := arclength b / arclength e;\n";
+		print "\tif (r > 1.02) or (r < 0.87):";
+		print "\t\tb := e;";
+		print "\tfi;";
 	}

-	printf "drawarrow reverse (b cutbefore p cutafter q) withpen pencircle scaled 1bp;\n";
+	printf "drawarrow b cutbefore q cutafter p withpen pencircle scaled 1bp;\n";
 }

 /^stop$/ {


Rewrite label prefixing

Rewrite label prefixing

- Prior to this change the suffix was blindly stripped and .md was
  assumed to be the label
- Allow capital letters, too (passed with one-true-awk, failed with
  mawk)

--- doxy/githublabels.awk
+++ doxy/githublabels.awk
@@ -7,6 +7,12 @@
 #
 # Get file name prefix for references.
 #
+# The prefix mimics the doxygen file naming scheme,
+# e.g. `man/loadrec.1` becomse `man_1_loadrec`.
+#
+# Equivalently the prefix for `foo/bar.md` becomes the prefix `foo_md_bar_`.
+# The trailing `_` exists as a separator to the internal reference label.
+#
 filename != FILENAME {
 	filename = FILENAME
 	# strip path
@@ -15,9 +21,14 @@
 	prefix = substr(filename, 1, length(path)) == path \
 	         ? substr(filename, length(path) + 1) \
 	         : filename
-	sub(/\.[^.]*$/, "", prefix)
-	gsub(/[^_a-z0-9]+/, "-", prefix)
-	prefix = "md_" prefix "_"
+	# put the filename suffix behind the path but in front of
+	# the file name
+	sufx = prefix
+	sub(/.*\./, "", sufx)               # get suffix
+	sub(/\.[^.]*$/, "", prefix)         # strip suffix from filename
+	sub(/[^\/]*$/, sufx "_&_", prefix)  # insert suffix
+	# sanitise characters
+	gsub(/[^_a-zA-Z0-9]+/, "_", prefix)
 }

 #


Translators/BingTranslator: improve display of error message


fix variable name

fix variable name

--- lib/render.awk
+++ lib/render.awk
@@ -107,7 +107,7 @@
   }
 }

-function run_filter(cmd, txt,   rand_date, tmpfile, rendered_txt, date_cmd, markdown_cmd, line) {
+function run_filter(cmd, txt,   rand_date, tmpfile, rendered_txt, date_cmd, filter_cmd, line) {
   date_cmd = "date +%Y%m%d%H%M%S"
   date_cmd | getline rand_date
   close(date_cmd)
@@ -115,7 +115,7 @@
   tmpfile = "/tmp/awk_render" rand_date
   filter_cmd = cmd " > " tmpfile

-  # pipe content to filter.awk
+  # pipe content to filter command
   print txt | filter_cmd
   close(filter_cmd)


Return vnode_if back to its AWK roots. It became a Perl script in rev 1.20.  This removes one more dependence on perl for the kernel build.

--- sys/tools/vnode_if.awk
+++ sys/tools/vnode_if.awk
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/awk -f

 #
 # Copyright (c) 1992, 1993
@@ -37,319 +37,263 @@
 #
 # Script to produce VFS front-end sugar.
 #
-# usage: vnode_if.pl srcfile
-#	(where srcfile is currently /sys/kern/vnode_if.src)
-#
-
-use strict;
-
-my %lockdata;
-
-my $cfile = 0;
-my $hfile = 0;
-my $srcfile;
+# usage: vnode_if.awk <srcfile> [-c | -h]
+#	(where <srcfile> is currently /sys/kern/vnode_if.src)
+#
+
+function usage()
+{
+	print "usage: vnode_if.awk <srcfile> [-c|-h]";
+	exit 1;
+}
+
+function die(msg, what)
+{
+	printf msg "\n", what > "/dev/stderr";
+	exit 1;
+}
+
+function t_spc(type)
+{
+	# Append a space if the type is not a pointer
+	return (type ~ /\*$/) ? type : type " ";
+}
+
+# These are just for convenience ...
+function printc(s) {print s > cfile;}
+function printh(s) {print s > hfile;}
+
+function add_debug_code(name, arg)
+{
+	if (debug_all_vfs_locks && lockdata[name, arg, "Entry"]) {
+		# Add assertions for locking
+		if (lockdata[name, arg, "Entry"] == "L")
+			printh("\tASSERT_VOP_LOCKED("arg", \""uname"\");");
+		else if (lockdata[name, arg, "Entry"] == "U")
+			printh("\tASSERT_VOP_UNLOCKED("arg", \""uname"\");");
+		else if (0) {
+			# XXX More checks!
+		}
+	}
+}
+
+function find_arg_with_type (type)
+{
+	for (jj = 0; jj < numargs; jj++) {
+		if (types[jj] == type) {
+			return "VOPARG_OFFSETOF(struct " \
+			    name "_args,a_" args[jj] ")";
+		}
+	}
+
+	return "VDESC_NO_OFFSET";
+}
+
+BEGIN{

 # Process the command line
-#
-while (my $arg = shift @ARGV) {
-    if ($arg eq '-c') {
-	$cfile = 1;
-    } elsif ($arg eq '-h') {
-	$hfile = 1;
-    } elsif ($arg eq '-ch' || $arg eq '-hc') {
-	$cfile = 1;
-	$hfile = 1;
-    } elsif ($arg =~ m/\.src$/) {
-	$srcfile = $arg;
-    } else {
-	print "usage: vnode_if.pl [-c] [-h] srcfile\n";
-	exit(1);
-    }
-}
-if (!$cfile and !$hfile) {
-    exit(0);		# nothing asked for..
-}
-
-# Names of the created files.
-my $CFILE='vnode_if.c';
-my $HEADER='vnode_if.h';
-
-open(SRC,     "<$srcfile")   || die "Unable to open input file";
-
-if ($hfile) {
-    open(HEADER, ">$HEADER") || die "Unable to create $HEADER";
-    # Print out header information for vnode_if.h.
-    print HEADER <<'END_OF_LEADING_COMMENT'
-/*
- * This file is produced automatically.
- * Do not modify anything in here by hand.
- *
- * Created from $FreeBSD$
- */
-
-extern struct vnodeop_desc vop_default_desc;
-END_OF_LEADING_COMMENT
-    ;
-}
-
-if ($cfile) {
-    open(CFILE,   ">$CFILE") || die "Unable to create $CFILE";
-    # Print out header information for vnode_if.c.
-    print CFILE <<'END_OF_LEADING_COMMENT'
-/*
- * This file is produced automatically.
- * Do not modify anything in here by hand.
- *
- * Created from $FreeBSD$
- */
-
-#include <sys/param.h>
-#include <sys/vnode.h>
-
-struct vnodeop_desc vop_default_desc = {
-	1,			/* special case, vop_default => 1 */
-	"default",
-	0,
-	NULL,
-	VDESC_NO_OFFSET,
-	VDESC_NO_OFFSET,
-	VDESC_NO_OFFSET,
-	VDESC_NO_OFFSET,
-	NULL,
-};
-
-END_OF_LEADING_COMMENT
-    ;
-}
-
-my %a;
-my %dirs;
-my %reles;
-my %types;
-my %args;
-my $numargs;
-my $name;
-
-line: while (<SRC>) {
-    chop;	# strip record separator
-    my @Fld = split ' ';
-    if (@Fld == 0) {
-	next line;
-    }
-    if (/^#/) {
-	if (!/^#%\s+([a-z]+)\s+([a-z]+)\s+(.)\s(.)\s(.)/) {
-	    next;
-	}
-	if (!defined($lockdata{"vop_$1"})) {
-	    $lockdata{"vop_$1"} = {};
-	}
-	$lockdata{"vop_$1"}->{$2} = {
-	    'Entry' => $3,
-	    'OK'    => $4,
-	    'Error' => $5,
-	};
-	next;
-    }
-
-    # Get the function name.
-    $name = $Fld[0];
-    my $uname = uc($name);
-    my $ln;
-    # Get the function arguments.
-    for ($numargs = 0; ; ++$numargs) {
-	if ($ln = <SRC>) {
-	    chomp;
-	} else {
-	    die "Unable to read through the arguments for \"$name\"";
-	}
-	if ($ln =~ /^\};/) {
-	    last;
-	}
-        # For the header file
-	$a{$numargs} = $ln;
-
-        # The rest of this loop is for the C file
-	# Delete comments, if any.
-	$ln =~ s/\/\*.*\*\///g;
-
-	# Delete leading/trailing space.
-	$ln =~ s/^\s*(.*?)\s*$/$1/;
-
-	# Pick off direction.
-	my $dir;
-	if ($ln =~ s/^INOUT\s+//) {
-	    $dir = 'INOUT';
-	} elsif ($ln =~ s/^IN\s+//) {
-	    $dir = 'IN';
-	} elsif ($ln =~ s/^OUT\s+//) {
-	    $dir = 'OUT';
-	} else {
-	     die "No IN/OUT direction for \"$ln\".";
-	}
-	my $rele;
-	if ($ln =~ s/^WILLRELE\s+//) {
-	    $rele = 'WILLRELE';
-	} else {
-	    $rele = 'WONTRELE';
-	}
-
-	# kill trailing ;
-	if ($ln !~ s/;$//) {
-	    die("Missing end-of-line ; in \"$ln\".");
-	}
-
-	# pick off variable name
-	if ($ln !~ s/([A-Za-z0-9_]+)$//) {
-	    die("Missing var name \"a_foo\" in \"$ln\".");
-	}
-	my $arg = $1;
-
-	# what is left must be type
-	# (put clean it up some)
-	my $type = $ln;
-	# condense whitespace
-	$type =~ s/\s+/ /g;
-	$type =~ s/^\s*(.*?)\s*$/$1/;
-
-	$dirs{$numargs} = $dir;
-	$reles{$numargs} = $rele;
-	$types{$numargs} = $type;
-	$args{$numargs} = $arg;
-    }
-
-    if ($hfile) {
-	# Print out the vop_F_args structure.
-	print HEADER "struct ${name}_args {\n\tstruct vnodeop_desc *a_desc;\n";
-	for (my $c2 = 0; $c2 < $numargs; ++$c2) {
-	    $a{$c2} =~ /^\s*(INOUT|OUT|IN)(\s+WILLRELE)?\s+(.*?)\s+(\**)(\S*\;)/;
-	    print HEADER "\t$3 $4a_$5\n",
-	}
-	print HEADER "};\n";
-
-	# Print out extern declaration.
-	print HEADER "extern struct vnodeop_desc ${name}_desc;\n";
-
-	# Print out function.
-	print HEADER "static __inline int ${uname}(\n";
-	for (my $c2 = 0; $c2 < $numargs; ++$c2) {
-	    $a{$c2} =~ /^\s*(INOUT|OUT|IN)(\s+WILLRELE)?\s+(.*?)\s+(\**\S*)\;/;
-	    print HEADER "\t$3 $4" .
-		($c2 < $numargs-1 ? "," : ")") . "\n";
-	}
-	print HEADER "{\n\tstruct ${name}_args a;\n";
-	print HEADER "\tint rc;\n";
-	print HEADER "\ta.a_desc = VDESC(${name});\n";
-	for (my $c2 = 0; $c2 < $numargs; ++$c2) {
-	    $a{$c2} =~ /(\**)([^;\s]*)([^\s]*)$/;
-	    print HEADER "\ta.a_$2 = $2$3\n",
-	}
-	for (my $c2 = 0; $c2 < $numargs; ++$c2) {
-	    if (!exists($args{$c2})) {
-		die "Internal error";
-	    }
-	    if (exists($lockdata{$name}) &&
-		exists($lockdata{$name}->{$args{$c2}})) {
-		if (defined($ENV{'DEBUG_ALL_VFS_LOCKS'}) &&
-			$ENV{'DEBUG_ALL_VFS_LOCKS'} =~ /yes/i) {
-		    # Add assertions for locking
-		    if ($lockdata{$name}->{$args{$c2}}->{Entry} eq "L") {
-			print HEADER
-			    "\tASSERT_VOP_LOCKED($args{$c2}, \"$uname\");\n";
-		    } elsif ($lockdata{$name}->{$args{$c2}}->{Entry} eq "U") {
-			print HEADER
-			    "\tASSERT_VOP_UNLOCKED($args{$c2}, \"$uname\");\n";
-		    } elsif (0) {
-			# XXX More checks!
-		    }
-		}
-	    }
-	}
-	$a{0} =~ /\s\**([^;\s]*);/;
-	print HEADER "\trc = VCALL($1, VOFFSET(${name}), &a);\n";
-	print HEADER "\treturn (rc);\n";
-	print HEADER "}\n";
-    }
-
-
-    if ($cfile) {
-	# Print out the vop_F_vp_offsets structure.  This all depends
-	# on naming conventions and nothing else.
-	printf CFILE "static int %s_vp_offsets[] = {\n", $name;
-	# as a side effect, figure out the releflags
-	my $releflags = '';
-	my $vpnum = 0;
-	for (my $i = 0; $i < $numargs; $i++) {
-	    if ($types{$i} eq 'struct vnode *') {
-		printf CFILE "\tVOPARG_OFFSETOF(struct %s_args,a_%s),\n",
-		$name, $args{$i};
-		if ($reles{$i} eq 'WILLRELE') {
-		    $releflags = $releflags . '|VDESC_VP' . $vpnum . '_WILLRELE';
-		}
-
-		$vpnum++;
-	    }
-	}
-
-	$releflags =~ s/^\|//;
-	print CFILE "\tVDESC_NO_OFFSET\n";
-	print CFILE "};\n";
-
-	# Print out the vnodeop_desc structure.
-	print CFILE "struct vnodeop_desc ${name}_desc = {\n";
-	# offset
-	print CFILE "\t0,\n";
-	# printable name
-	printf CFILE "\t\"%s\",\n", $name;
-	# flags
-	my $vppwillrele = '';
-	for (my $i = 0; $i < $numargs; $i++) {
-	    if ($types{$i} eq 'struct vnode **' &&
-		($reles{$i} eq 'WILLRELE')) {
-		$vppwillrele = '|VDESC_VPP_WILLRELE';
-	    }
-	}
-
-	if ($releflags eq '') {
-	    printf CFILE "\t0%s,\n", $vppwillrele;
-	}
-	else {
-	    printf CFILE "\t%s%s,\n", $releflags, $vppwillrele;
-	}
-
-	# vp offsets
-	printf CFILE "\t%s_vp_offsets,\n", $name;
-	# vpp (if any)
-	printf CFILE "\t%s,\n", &find_arg_with_type('struct vnode **');
-	# cred (if any)
-	printf CFILE "\t%s,\n", &find_arg_with_type('struct ucred *');
-	# thread (if any)
-	printf CFILE "\t%s,\n", &find_arg_with_type('struct thread *');
-	# componentname
-	printf CFILE "\t%s,\n", &find_arg_with_type('struct componentname *');
-	# transport layer information
-	print CFILE "\tNULL,\n};\n\n";
-    }
+for (i = 1; i < ARGC; i++) {
+	arg = ARGV[i];
+	if (arg !~ /^-[ch]+$/ && arg !~ /\.src$/)
+		usage();
+	if (arg ~ /^-.*c/)
+		cfile = "vnode_if.c";
+	if (arg ~ /^-.*h/)
+		hfile = "vnode_if.h";
+	if (arg ~ /\.src$/)
+		srcfile = arg;
+}
+ARGC = 1;
+
+if (!cfile && !hfile)
+	exit 0;
+
+if (!srcfile)
+	usage();
+
+debug_all_vfs_locks = (ENVIRON["DEBUG_ALL_VFS_LOCKS"] ~ /[Yy][Ee][Ss]/);
+
+common_head = \
+    "/*\n" \
+    " * This file is produced automatically.\n" \
+    " * Do not modify anything in here by hand.\n" \
+    " *\n" \
+    " * Created from $FreeBSD$\n" \
+    " */\n" \
+    "\n";
+
+if (hfile)
+	printh(common_head "extern struct vnodeop_desc vop_default_desc;");
+
+if (cfile) {
+	printc(common_head \
+	    "#include <sys/param.h>\n" \
+	    "#include <sys/vnode.h>\n" \
+	    "\n" \
+	    "struct vnodeop_desc vop_default_desc = {\n" \
+	    "	1,\t\t\t/* special case, vop_default => 1 */\n" \
+	    "	\"default\",\n" \
+	    "	0,\n" \
+	    "	NULL,\n" \
+	    "	VDESC_NO_OFFSET,\n" \
+	    "	VDESC_NO_OFFSET,\n" \
+	    "	VDESC_NO_OFFSET,\n" \
+	    "	VDESC_NO_OFFSET,\n" \
+	    "	NULL,\n" \
+	    "};\n");
+}
+
+while ((getline < srcfile) > 0) {
+	if (NF == 0)
+		continue;
+	if ($1 ~ /^#/) {
+		if (NF != 6  ||  $1 != "#%"  || \
+		    $2 !~ /^[a-z]+$/  ||  $3 !~ /^[a-z]+$/  || \
+		    $4 !~ /^.$/  ||  $5 !~ /^.$/  ||  $6 !~ /^.$/)
+			continue;
+		lockdata["vop_" $2, $3, "Entry"] = $4;
+		lockdata["vop_" $2, $3, "OK"]    = $5;
+		lockdata["vop_" $2, $3, "Error"] = $6;
+		continue;
+	}
+
+	# Get the function name.
+	name = $1;
+	uname = toupper(name);
+	# Get the function arguments.
+	for (numargs = 0; ; ++numargs) {
+		if ((getline < srcfile) <= 0) {
+			die("Unable to read through the arguments for \"%s\"",
+			    name);
+		}
+		if ($1 ~ /^\};/)
+			break;
+
+		# Delete comments, if any.
+		gsub (/\/\*.*\*\//, "");
+
+		# Condense whitespace and delete leading/trailing space.
+		gsub(/[[:space:]]+/, " ");
+		sub(/^ /, "");
+		sub(/ $/, "");
+
+		# Pick off direction.
+		if ($1 != "INOUT" && $1 != "IN" && $1 != "OUT")
+			die("No IN/OUT direction for \"%s\".", $0);
+		dirs[numargs] = $1;
+		sub(/^[A-Z]* /, "");
+
+		if ((reles[numargs] = $1) == "WILLRELE")
+			sub(/^[A-Z]* /, "");
+		else
+			reles[numargs] = "WONTRELE";
+
+		# kill trailing ;
+		if (sub(/;$/, "") < 1)
+			die("Missing end-of-line ; in \"%s\".", $0);
+
+		# pick off variable name
+		if ((argp = match($0, /[A-Za-z0-9_]+$/)) < 1)
+			die("Missing var name \"a_foo\" in \"%s\".", $0);
+		args[numargs] = substr($0, argp);
+		$0 = substr($0, 1, argp - 1);
+
+		# what is left must be type
+		# remove trailing space (if any)
+		sub(/ $/, "");
+		types[numargs] = $0;
+	}
+
+	if (hfile) {
+		# Print out the vop_F_args structure.
+		printh("struct "name"_args {\n\tstruct vnodeop_desc *a_desc;");
+		for (i = 0; i < numargs; ++i)
+			printh("\t" t_spc(types[i]) "a_" args[i] ";");
+		printh("};");
+
+		# Print out extern declaration.
+		printh("extern struct vnodeop_desc " name "_desc;");
+
+		# Print out function.
+		printh("static __inline int " uname "(");
+		for (i = 0; i < numargs; ++i) {
+			printh("\t" t_spc(types[i]) args[i] \
+			    (i < numargs - 1 ? "," : ")"));
+		}
+		printh("{\n\tstruct " name "_args a;");
+		printh("\tint rc;");
+		printh("\ta.a_desc = VDESC(" name ");");
+		for (i = 0; i < numargs; ++i)
+			printh("\ta.a_" args[i] " = " args[i] ";");
+		for (i = 0; i < numargs; ++i)
+			add_debug_code(name, args[i]);
+		printh("\trc = VCALL(" args[0] ", VOFFSET(" name "), &a);");
+		printh("\treturn (rc);\n}");
+	}
+
+	if (cfile) {
+		# Print out the vop_F_vp_offsets structure.  This all depends
+		# on naming conventions and nothing else.
+		printc("static int " name "_vp_offsets[] = {");
+		# as a side effect, figure out the releflags
+		releflags = "";
+		vpnum = 0;
+		for (i = 0; i < numargs; i++) {
+			if (types[i] == "struct vnode *") {
+				printc("\tVOPARG_OFFSETOF(struct " name \
+				    "_args,a_" args[i] "),");
+				if (reles[i] == "WILLRELE") {
+					releflags = releflags \
+					    "|VDESC_VP" vpnum "_WILLRELE";
+				}
+				vpnum++;
+			}
+		}
+
+		sub(/^\|/, "", releflags);
+		printc("\tVDESC_NO_OFFSET");
+		printc("};");
+
+		# Print out the vnodeop_desc structure.
+		printc("struct vnodeop_desc " name "_desc = {");
+		# offset
+		printc("\t0,");
+		# printable name
+		printc("\t\"" name "\",");
+		# flags
+		vppwillrele = "";
+		for (i = 0; i < numargs; i++) {
+			if (types[i] == "struct vnode **" && \
+			    reles[i] == "WILLRELE") {
+				vppwillrele = "|VDESC_VPP_WILLRELE";
+			}
+		}
+
+		if (!releflags)
+			releflags = "0";
+		printc("\t" releflags vppwillrele ",");
+
+		# vp offsets
+		printc("\t" name "_vp_offsets,");
+		# vpp (if any)
+		printc("\t" find_arg_with_type("struct vnode **") ",");
+		# cred (if any)
+		printc("\t" find_arg_with_type("struct ucred *") ",");
+		# thread (if any)
+		printc("\t" find_arg_with_type("struct thread *") ",");
+		# componentname
+		printc("\t" find_arg_with_type("struct componentname *") ",");
+		# transport layer information
+		printc("\tNULL,\n};\n");
+	}
 }

-if ($hfile) {
-    close(HEADER) || die "Unable to close $HEADER";
-}
-if ($cfile) {
-    close(CFILE)  || die "Unable to close $CFILE";
-}
-close(SRC) || die;
+if (hfile)
+	close(hfile);
+if (cfile)
+	close(cfile);
+close(srcfile);

 exit 0;

-sub find_arg_with_type {
-    my $type = shift;
-    my $i;
-
-    for ($i=0; $i < $numargs; $i++) {
-	if ($types{$i} eq $type) {
-	    return "VOPARG_OFFSETOF(struct ${name}_args,a_" . $args{$i} . ")";
-	}
-    }
-
-    return "VDESC_NO_OFFSET";
-}
+}


Languages: add Tigrinya language

Languages: add Tigrinya language

--- include/Languages.awk
+++ include/Languages.awk
@@ -314,6 +314,19 @@
     Locale["sn"]["iso"]                = "sna"
     Locale["sn"]["glotto"]             = "core1255"
     Locale["sn"]["script"]             = "Latn"
+
+    #? Tigrinya
+    Locale["ti"]["name"]               = "Tigrinya"
+    Locale["ti"]["endonym"]            = "ትግርኛ"
+    #Locale["ti"]["translations-of"]
+    #Locale["ti"]["definitions-of"]
+    #Locale["ti"]["synonyms"]
+    #Locale["ti"]["examples"]
+    #Locale["ti"]["see-also"]
+    Locale["ti"]["family"]             = "Afro-Asiatic"
+    Locale["ti"]["iso"]                = "tir"
+    Locale["ti"]["glotto"]             = "tigr1271"
+    Locale["ti"]["script"]             = "Ethi"

     #1 Afrikaans
     Locale["af"]["name"]               = "Afrikaans"


Languages: do not show Glottolog if no glotto code available

--- include/Languages.awk
+++ include/Languages.awk
@@ -1824,7 +1824,8 @@
                  sprintf("%-22s%s\n", "Code", ansi("bold", getCode(code))) \
                  sprintf("%-22s%s\n", "ISO 639-3", ansi("bold", iso))   \
                  sprintf("%-22s%s\n", "Ethnologue", ansi("bold", "http://www.ethnologue.com/language/" iso)) \
-                 sprintf("%-22s%s\n", "Glottolog", ansi("bold", "http://glottolog.org/resource/languoid/id/" getGlotto(code))) \
+                 sprintf("%-22s%s\n", "Glottolog", getGlotto(code) ?
+                         ansi("bold", "http://glottolog.org/resource/languoid/id/" getGlotto(code)) : "") \
                  sprintf("%-22s%s", "Wikipedia", ansi("bold", "http://en.wikipedia.org/wiki/" language "_language")))
 }


Script mean.awk now returns the mean results returned by the measure.


sb136: #i114155# partially revert fix for i108776 to avoid ABI incompatibility of jvmaccess library

--- solenv/bin/addsym.awk
+++ solenv/bin/addsym.awk
@@ -26,16 +26,29 @@
 #*************************************************************************

 # Add certain symbol patterns to the first global section.
+#
+# The below code fails with 'perverted' mapfiles (using a strange line layout,
+# or containing version UDK_3_0_0 without a global section, ...).

 BEGIN { state = 0 }
-/\{/ && state == 1 { exit 1 } #TODO: print error explanation to stderr?
-/^[\t ]*UDK_3_0_0[\t ]*\{/ && state == 0 { state = 1 }
-/^[\t ]*global[\t ]*:/ && state == 1 { state = 2 }
-{ print }
+END {
+    if (state == 0) {
+        print "# Weak RTTI symbols for C++ exceptions:"
+        print "UDK_3_0_0 {"
+        print "global:"
+        print "_ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions"
+        if (ENVIRON["USE_SYSTEM_STL"] != "YES")
+            print "_ZN4_STL7num_put*; # for STLport"
+        print "};"
+    }
+}
 state == 2 {
     print "_ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions"
     if (ENVIRON["USE_SYSTEM_STL"] != "YES")
         print "_ZN4_STL7num_put*; # for STLport"
     state = 3
 }
-END { if (state != 3) exit 1 } #TODO: print error explanation to stderr?
+# #i66636# - ???
+/^[\t ]*UDK_3_0_0[\t ]*\{/ { state = 1 }
+/^[\t ]*global[\t ]*:/ && state == 1 { state = 2 }
+{ print }


Languages: more locale aliases in initLocaleAlias()

--- include/Languages.awk
+++ include/Languages.awk
@@ -1849,6 +1849,8 @@
     LocaleAlias["zh"]      = "zh-CN" # Chinese: default to Chinese Simplified
     LocaleAlias["zh-CHS"]  = "zh-CN"
     LocaleAlias["zh-CHT"]  = "zh-TW"
+    LocaleAlias["zh-Hans"] = "zh-CN"
+    LocaleAlias["zh-Hant"] = "zh-TW"
     LocaleAlias["zho"]     = "zh-CN"
     LocaleAlias["chinese"] = "zh-CN"
     LocaleAlias["tlh-Latn"] = "tlh"


Languages: change the official name Oriya to Odia

--- include/Languages.awk
+++ include/Languages.awk
@@ -922,8 +922,8 @@
     Locale["no"]["glotto"]             = "norw1258"
     Locale["no"]["script"]             = "Latn"

-    #69 Oriya / Odia
-    Locale["or"]["name"]               = "Oriya"
+    #69 Odia / Oriya
+    Locale["or"]["name"]               = "Odia"
     Locale["or"]["endonym"]            = "ଓଡ଼ିଆ"
     #Locale["or"]["translations-of"]
     #Locale["or"]["definitions-of"]


Make IMDB scripts shfmt compatible

Make IMDB scripts shfmt compatible


get_vectors updated (take 1/1000 of all vectors by default)

--- scripts/get_vectors.awk
+++ scripts/get_vectors.awk
@@ -2,7 +2,6 @@

 ##################################################################
 BEGIN {
-    FS = "\t"
     if (ARGC != 4) {
 	printf("Incorrect number of arguments.") > "/sys/stderr"
 	exit 1
@@ -29,9 +28,8 @@
 	randarr[i] = rand() * wcl + 1
     }
     asorti(randarr, tmparr)
-    delete randarr
-    wcl = WCL / 100
-    for (i = 1; i < WCL; ++i) {
+    wcl = WCL / 1000
+    for (i = 1; i < wcl; ++i) {
 	FNR2SEEK[tmparr[i]] = ""
     }
 }


TranslatorInterface: add abstract method _PostRequestUrl()

--- include/TranslatorInterface.awk
+++ include/TranslatorInterface.awk
@@ -11,6 +11,12 @@
 # Abstract method foobarRequestUrl(text, sl, tl, hl: string): string
 function _RequestUrl(text, sl, tl, hl,    vm) {
     vm = engineMethod("RequestUrl")
+    return @vm(text, sl, tl, hl)
+}
+
+# Abstract method foobarPostRequestUrl(text, sl, tl, hl: string): string
+function _PostRequestUrl(text, sl, tl, hl,    vm) {
+    vm = engineMethod("PostRequestUrl")
     return @vm(text, sl, tl, hl)
 }


fix inconsistency for parsing option -player

--- include/Main.awk
+++ include/Main.awk
@@ -137,8 +137,8 @@
         match(ARGV[pos], /^--?player(=(.*)?)?$/, group)
         if (RSTART) {
             Option["play"] = 1
-            Option["player"] = group[2] ?
-                (group[3] ? group[3] : Option["player"]) :
+            Option["player"] = group[1] ?
+                (group[2] ? group[2] : Option["player"]) :
                 ARGV[++pos]
             continue
         }


-discontinuity mode

-discontinuity mode

--- packager/bin/anal_nginx_log_packager.awk
+++ packager/bin/anal_nginx_log_packager.awk
@@ -31,7 +31,25 @@
     }
 }

+function parseChunkName(arr){

+   if(segId && (segId+1) == b[4] && (segTime + segDuration != b[2])){
+
+        printf ("[%d] segment discontinuity: %d new { %d %d } old: { %d %d }\n",
+         segId,b[2]-(segTime+segDuration),b[2],b[3],
+         segTime,segDuration)
+   }
+
+    segTime = b[2]
+    segDuration = b[3]
+    segId = b[4]
+
+    #printf("parseChunkName segTime=%d segDuration=%d segId=%d\n",
+    #    segTime,
+    #    segDuration,
+    #    segId)
+
+}

 $0 ~ /\[debug\]/ && $0 ~ /GET \/hls\/(.*)\/playlist.json\/seg/ {
     split($10,b,"-");
@@ -42,6 +60,7 @@

     if(length(b) == 6){
         lastChunkId = b[4]
+        parseChunkName(b)
     } else {
         lastChunkId =  b[2]
     }
@@ -90,7 +109,7 @@
         if(segment_index == tmp1 - 1){
             if(segment_start_time+segment_duration != tmp2){
                 printf (" chunk %d adjucent chunks  differ: diff: %d prev={ %d  %d}  cur={%d %d}\n",tmp1,
-                (tmp2-segment_start_time+segment_duration),
+                (tmp2-segment_start_time-segment_duration),
                 segment_start_time,
                 segment_duration,
                 tmp2,
@@ -103,6 +122,8 @@
     segment_index = tmp1
     segment_start_time=tmp2
     segment_duration=tmp3
+
+  # print " debug info:  "segment_index" "segment_start_time" "segment_duration
 }

 END {


syscall: Convert errno to error after Exitsyscall.

R=iant
CC=gofrontend-dev
https://golang.org/cl/5969050

--- libgo/go/syscall/mksyscall.awk
+++ libgo/go/syscall/mksyscall.awk
@@ -199,6 +199,7 @@
     }
     printf("c_%s(%s)\n", cfnname, args)

+    seterr = 0
     if (gofnresults != "") {
 	fields = split(gofnresults, goresults, ", *")
 	if (fields > 2) {
@@ -218,13 +219,17 @@
 	    gotype = goparam[2]

 	    if (goname == "err") {
+		print "\tvar errno Errno"
+		print "\tsetErrno := false"
 		if (cfnresult ~ /^\*/) {
 		    print "\tif _r == nil {"
 		} else {
 		    print "\tif _r < 0 {"
 		}
-		print "\t\terr = GetErrno()"
+		print "\t\terrno = GetErrno()"
+		print "\t\tsetErrno = true"
 		print "\t}"
+		seterr = 1
 	    } else if (gotype == "uintptr" && cfnresult ~ /^\*/) {
 		printf("\t%s = (%s)(unsafe.Pointer(_r))\n", goname, gotype)
 	    } else {
@@ -243,6 +248,12 @@
 	print "\tExitsyscall()"
     }

+    if (seterr) {
+	print "\tif setErrno {"
+	print "\t\terr = errno"
+	print "\t}"
+    }
+
     if (gofnresults != "") {
 	print "\treturn"
     }


LanguageData: update section I

LanguageData: update section I

--- include/LanguageData.awk
+++ include/LanguageData.awk
@@ -965,9 +965,7 @@
     Locale["hu"]["spoken-in"]          = "Hungary"
     Locale["hu"]["supported-by"]       = "google; bing; yandex"

-
-
-    #39 Icelandic
+    # Icelandic
     Locale["is"]["name"]               = "Icelandic"
     Locale["is"]["endonym"]            = "Íslenska"
     Locale["is"]["translations-of"]    = "Þýðingar á %s"
@@ -976,11 +974,14 @@
     Locale["is"]["examples"]           = "Dæmi"
     Locale["is"]["see-also"]           = "Sjá einnig"
     Locale["is"]["family"]             = "Indo-European"
+    Locale["is"]["branch"]             = "North Germanic"
     Locale["is"]["iso"]                = "isl"
     Locale["is"]["glotto"]             = "icel1247"
     Locale["is"]["script"]             = "Latn"
-
-    #40 Igbo
+    Locale["is"]["spoken-in"]          = "Iceland"
+    Locale["is"]["supported-by"]       = "google; bing; yandex"
+
+    # Igbo
     Locale["ig"]["name"]               = "Igbo"
     Locale["ig"]["endonym"]            = "Igbo"
     Locale["ig"]["translations-of"]    = "Ntụgharị asụsụ nke %s"
@@ -989,9 +990,12 @@
     Locale["ig"]["examples"]           = "Ọmụmaatụ"
     Locale["ig"]["see-also"]           = "Hụkwuo"
     Locale["ig"]["family"]             = "Atlantic-Congo"
+    Locale["ig"]["branch"]             = "Igboid"
     Locale["ig"]["iso"]                = "ibo"
     Locale["ig"]["glotto"]             = "nucl1417"
     Locale["ig"]["script"]             = "Latn"
+    Locale["ig"]["spoken-in"]          = "southeastern Nigeria"
+    Locale["ig"]["supported-by"]       = "google"

     # Ilocano
     Locale["ilo"]["name"]              = "Ilocano"
@@ -1002,11 +1006,14 @@
     #Locale["ilo"]["examples"]
     #Locale["ilo"]["see-also"]
     Locale["ilo"]["family"]            = "Austronesian"
+    Locale["ilo"]["branch"]            = "Malayo-Polynesian"
     Locale["ilo"]["iso"]               = "ilo"
     Locale["ilo"]["glotto"]            = "ilok1237"
     Locale["ilo"]["script"]            = "Latn"
-
-    #41 Indonesian
+    Locale["ilo"]["spoken-in"]         = "the northern Philippines"
+    Locale["ilo"]["supported-by"]      = "google"
+
+    # Indonesian
     Locale["id"]["name"]               = "Indonesian"
     Locale["id"]["endonym"]            = "Bahasa Indonesia"
     Locale["id"]["translations-of"]    = "Terjemahan dari %s"
@@ -1015,12 +1022,34 @@
     Locale["id"]["examples"]           = "Contoh"
     Locale["id"]["see-also"]           = "Lihat juga"
     Locale["id"]["family"]             = "Austronesian"
+    Locale["id"]["branch"]             = "Malayo-Polynesian"
     Locale["id"]["iso"]                = "ind"
     Locale["id"]["glotto"]             = "indo1316"
     Locale["id"]["script"]             = "Latn"
-
-    #42 Irish
+    Locale["id"]["spoken-in"]          = "Indonesia"
+    Locale["id"]["supported-by"]       = "google; bing; yandex"
+
+    # Interlingue
+    Locale["ie"]["name"]               = "Interlingue"
+    Locale["ie"]["name2"]              = "Occidental"
+    Locale["ie"]["endonym"]            = "Interlingue"
+    #Locale["ie"]["translations-of"]
+    #Locale["ie"]["definitions-of"]
+    #Locale["ie"]["synonyms"]
+    #Locale["ie"]["examples"]
+    #Locale["ie"]["see-also"]
+    Locale["ie"]["family"]             = "Constructed language"
+    #Locale["ie"]["branch"]
+    Locale["ie"]["iso"]                = "ile"
+    Locale["ie"]["glotto"]             = "occi1241"
+    Locale["ie"]["script"]             = "Latn"
+    Locale["ie"]["spoken-in"]          = "worldwide"
+    Locale["ie"]["description"]        = "an international auxiliary language"
+    Locale["ie"]["supported-by"]       = ""
+
+    # Irish
     Locale["ga"]["name"]               = "Irish"
+    Locale["ga"]["name2"]              = "Gaelic"
     Locale["ga"]["endonym"]            = "Gaeilge"
     Locale["ga"]["translations-of"]    = "Aistriúcháin ar %s"
     Locale["ga"]["definitions-of"]     = "Sainmhínithe ar %s"
@@ -1028,11 +1057,14 @@
     Locale["ga"]["examples"]           = "Samplaí"
     Locale["ga"]["see-also"]           = "féach freisin"
     Locale["ga"]["family"]             = "Indo-European"
+    Locale["ga"]["branch"]             = "Celtic"
     Locale["ga"]["iso"]                = "gle"
     Locale["ga"]["glotto"]             = "iris1253"
     Locale["ga"]["script"]             = "Latn"
-
-    #43 Italian
+    Locale["ga"]["spoken-in"]          = "Ireland"
+    Locale["ga"]["supported-by"]       = "google; bing; yandex"
+
+    # Italian
     Locale["it"]["name"]               = "Italian"
     Locale["it"]["endonym"]            = "Italiano"
     Locale["it"]["translations-of"]    = "Traduzioni di %s"
@@ -1041,10 +1073,15 @@
     Locale["it"]["examples"]           = "Esempi"
     Locale["it"]["see-also"]           = "Vedi anche"
     Locale["it"]["family"]             = "Indo-European"
+    Locale["it"]["branch"]             = "Italo-Dalmatian"
     Locale["it"]["iso"]                = "ita"
     Locale["it"]["glotto"]             = "ital1282"
     Locale["it"]["script"]             = "Latn"
     Locale["it"]["dictionary"]         = "true" # has dictionary
+    Locale["it"]["spoken-in"]          = "Italy; Switzerland; San Marino; Vatican City"
+    Locale["it"]["supported-by"]       = "google; bing; yandex"
+
+

     #44 Japanese
     Locale["ja"]["name"]               = "Japanese"
@@ -2227,20 +2264,6 @@
     Locale["mhr"]["iso"]               = "mhr"
     Locale["mhr"]["glotto"]            = "east2328"
     Locale["mhr"]["script"]            = "Cyrl"
-
-    #? Interlingue
-    Locale["ie"]["support"]            = "unstable"
-    Locale["ie"]["name"]               = "Interlingue"
-    Locale["ie"]["endonym"]            = "Interlingue"
-    #Locale["ie"]["translations-of"]
-    #Locale["ie"]["definitions-of"]
-    #Locale["ie"]["synonyms"]
-    #Locale["ie"]["examples"]
-    #Locale["ie"]["see-also"]
-    Locale["ie"]["family"]             = "Constructed language"
-    Locale["ie"]["iso"]                = "ile"
-    Locale["ie"]["glotto"]             = "occi1241"
-    Locale["ie"]["script"]             = "Latn"

     #? Occitan
     Locale["oc"]["support"]            = "unstable"