Mark labels by their time along a curve, calculated by mirroring the origional graphviz label to find a vector.

--- share/bin/plain2mp.awk
+++ share/bin/plain2mp.awk
@@ -41,6 +41,7 @@

 	# TODO: would be simpler to gvpr to rename start to S0
 	# TODO: common stuff for multiple graphs
+
 	print "pair S[];"
 	print "pair q[];"
 	print "path e;"
@@ -66,6 +67,7 @@
 #	print "enddef;";

 	# TODO: centralise to my equivalent of automata.mp, and include that
+	# TODO: can use 'scantokens' to eval a string, .: don't need to pass diam etc

 	print "vardef fsmnode(expr node, diam, final, lab) =";
 	print "	draw fullcircle scaled diam shifted node withpen pencircle scaled 1bp;"
@@ -78,7 +80,7 @@
 	print "enddef;";

-	print "vardef fsmedge(expr tail, head, e, lab) =";
+	print "vardef fsmedge(expr tail, head, e, t, lab) =";

 	print "	drawarrow e withpen pencircle scaled 1bp;";

@@ -86,14 +88,17 @@
 	print "		pair bl;";
 	print "		pair ml; ml := .5[tail, head];"

-	# TODO: new idea; draw right angle from midpoint, and use that to find intersection with b
-	# this way it should always align for multiple edges, even if on a slant
-
-	print "		draw point (length b / 2) of b withpen pencircle scaled 4bp withcolor blue;"
+	print "		if t <> -1:"
+	print "			bl := point t of e;"
+	print "			draw bl withpen pencircle scaled 4bp withcolor blue;"
+	print "		else:"
+	print "			bl := point (length e / 2) of e;"
+	print "			draw bl withpen pencircle scaled 2bp withcolor blue;"
+	print "		fi;"
+
+#	print "		draw bl withpen pencircle scaled 3bp withcolor blue;"
 #	print "		draw tail -- head withpen pencircle scaled 1bp withcolor green;"
 #	print "		draw ml withpen pencircle scaled 5bp withcolor green;"
-
-	print "		bl := point (length b / 2) of b;"

 	# TODO: plus label delta, distancing it from point. make a label function
 	# TODO: maybe an "extend" function, to extend a path in its direction. use dotprod for that?
@@ -114,8 +119,8 @@

 	print "vardef fsmloop(expr node, diam, p, q, lab, loops) ="
 	print "	path pp; pp = node -- 0.5[p, q];"
-	print "	draw p -- q withpen pencircle scaled 0.5bp withcolor green;"
-	print "	draw 0.5[p, q] withpen pencircle scaled 0.8bp withcolor green;"
+#	print "	draw p -- q withpen pencircle scaled 0.5bp withcolor green;"
+#	print "	draw 0.5[p, q] withpen pencircle scaled 0.8bp withcolor green;"
 	print "	draw node -- 0.5[p, q] withpen pencircle scaled 0.8bp withcolor green;"

 	# extend loop 1.25 * diameter
@@ -126,11 +131,11 @@
 	print "	draw node -- m withpen pencircle scaled 0.5bp withcolor green;"

 	print "	path b; b := node .. q .. m .. p .. node;"
-	print "	fsmedge(node, node, b cutbefore q cutafter p, lab);"
+	print "	fsmedge(node, node, b cutbefore q cutafter p, -1, lab);"

 	print "enddef;";

-	print "vardef fsmgvedge(expr tail, taildiam, head, headdiam, e, lab, loops) =";
+	print "vardef fsmgvedge(expr tail, taildiam, head, headdiam, e, pp, lab, loops) =";
 	print "	draw e withpen pencircle scaled 0.25bp withcolor red;";

 	# TODO: better explain this
@@ -141,17 +146,46 @@
 	print "	pair q; q = (reverse e) intersectionpoint st;\n";

 	print "	if head = tail:"
+	# TODO: incr loops here
 	print "		fsmloop(head, headdiam, p, q, lab, loops);"
 	print "	else:"
 	print "		path b; b = tail .. q .. p .. head;"
-	# TODO: explain this. we permit a 2% lengthening threshold relative to graphviz's b-spline
-	# this affects NFA especially
-	# XXX: or (arclength b > 6in), but wigglyness would be a better metric
+# TODO: explain this. we permit a 2% lengthening threshold relative to graphviz's b-spline
+# this affects NFA especially
+# XXX: or (arclength b > 6in), but wigglyness would be a better metric
 	print "		r := arclength b / arclength e;";
 	print "		if (r > 1.02) or (r < 0.93):";
 	print "			b := e;"
 	print "		fi;"
-	print "		fsmedge(tail, head, b cutbefore q cutafter p, lab);"
+	print "		b := b cutbefore q cutafter p;"
+	print "		t0 := -1;"
+	print "		if lab <> \"\":"
+# TODO: explain we find what time (lx,ly) is along graphviz's edge, e
+# then pass the time and use that for placing our label on our edge
+# use intersectiontimes to find the time of (lx,ly) along e
+# or find by e cutbefore (lx,ly) and use arctime to find the time wrt e
+# XXX: but lx,ly isn't even on the line. could mirror it about the line head--tail
+# TODO: instead of extending like this, i'd rather use the line's direction,
+# and find a lxy--whatever point on e
+# u3 = u1 projectedalong u2;
+# XXX: but i can't do that here, because e might be switched to a different curve
+# .: pass in pp, not lqq
+print "path qq;"
+print "n := length pp;"
+print "qq := (0, 0)--((arclength pp) * unitvector(direction n of pp));"
+print "path lqq; lqq := pp & (qq shifted point n of pp);"
+#print "draw lqq withpen pencircle scaled 0.25bp withcolor red;"
+
+#print "numeric lll;";
+#print "lll := 1in;"
+#print "path luu; luu := (0, 0) -- lll * unitvector(direction 0 of pp);"
+#print "point whatever of luu = point whatever of b;"
+#print "drawarrow luu shifted point 0 of pp;"
+
+	print "			pair tx; tx = lqq intersectiontimes b;"
+	print "			t0 := ypart tx;" # XXX: cheesy
+	print "		fi;"
+	print "		fsmedge(tail, head, b, t0, lab);"
 	print "	fi;"

 	print "enddef;";
@@ -257,12 +291,20 @@
 		label = "";
 	}

-	# TODO: find what time (lx,ly) is along graphviz's edge, e
-	# then pass the time and use that for placing our label on our edge
-	# use intersectiontimes to find the time of (lx,ly) along e
-	# or find by e cutbefore (lx,ly) and use arctime to find the time wrt e
-
-	printf "fsmgvedge(%s, %s.diam, %s, %s.diam, e, \"%s\", %s.loops);", tail, tail, head, head, label, head;
+print "path pp;"
+
+	if (head != tail && label != "") {
+		printf "draw (%fin, %fin) withpen pencircle scaled 3bp withcolor red;", lx, ly
+#		printf "draw (%fin, %fin) reflectedabout(%s, %s) withpen pencircle scaled 1bp withcolor green;", lx, ly, tail, head
+
+		printf "pair lxy; lxy := (%fin, %fin);\n", lx, ly
+		printf "pair llxy; llxy := lxy reflectedabout(%s, %s);\n", tail, head
+
+		print "pp := llxy -- lxy;"
+#		printf "draw pp withpen pencircle scaled 1bp withcolor green;\n"
+	}
+
+	printf "fsmgvedge(%s, %s.diam, %s, %s.diam, e, pp, \"%s\", %s.loops);", tail, tail, head, head, label, head;

 	if (head == tail) {
 		print "	%s.loops := %s.loops + 1;", head, head


Handle string numSeasons

Handle string numSeasons

--- getAcornFrom-seriesPages.awk
+++ getAcornFrom-seriesPages.awk
@@ -101,7 +101,7 @@
 /itemprop="numberOfSeasons"/ {
     split ($0,fld,"\"")
     numSeasons = fld[4]
-    if (numSeasons == 0)
+    if ((numSeasons + 0) == 0)
         printf ("==> No seasons: %d\t%s\n", SERIES_NUMBER, seriesTitle) >> ERROR_FILE
     print numSeasons >> NUM_SEASONS_FILE
     next


RJH: test of RCS keyword munging

RJH: test of RCS keyword munging


Working prototype

Working prototype

--- rewrite-cmor-table-to-bash-case.awk
+++ rewrite-cmor-table-to-bash-case.awk
@@ -13,3 +13,68 @@
 # Contact persons:  martin.evaldsson@smhi.se
 #
 ########################
+function ceil(x){return x%1 ? int(x)+1 : x}
+function floor(x){return x%1 ? int(x) : x}
+
+function repeat( str, n,    rep, i )
+{
+    for( ; i<n; i++ )
+        rep = rep str
+    return rep
+}
+
+function pre_ws( str, maxws )
+{
+    prews=floor(maxws/2)
+    str_ws = repeat(" ", prews, i, ii)
+    return str_ws
+}
+
+function post_ws( str, maxws )
+{
+    postws=no_ws - length(str)-3
+    str_ws = repeat(" ", postws, i, ii)
+    return str_ws
+}
+
+BEGIN {
+  newvar="none"
+  no_ws=20
+  ws=repeat(" ", no_ws, rep, i)
+  print "case"
+}
+
+{
+    #print newvar"  "$1",  --   "$0
+    if ($1 == "variable_entry:")
+    {
+        if (newvar == "true")
+            printf "%s", ";;\n\n"
+        prews=pre_ws($2, length(ws))
+        postws=post_ws($2, length(ws))
+        printf "%s", "  "$2")"postws
+        newvar="true"
+    }
+    if ($1 == "standard_name:" && newvar=="true")
+    {
+        printf "%s", "standard_name='"$2"'"
+    }
+
+    attrs[0] = "long_name:"
+    attrs[1] = "units:"
+    attrs[2] = "cell_methods:"
+
+    for (attr in attrs)
+    {
+        if ($1 == attrs[attr] && newvar=="true")
+        {
+            output=substr($0,index($2,$9))
+            sub(":[[:space:]]*", "='", output)
+            printf "%s", "\n"ws""output"'"
+        }
+    }
+}
+
+END {
+  print "\nesac"
+}


Support indent 2 in checkFile.

Support indent 2 in checkFile.

--- bin/checkFile.awk
+++ bin/checkFile.awk
@@ -14,6 +14,7 @@
        || fname ~ "/extensions/" \
        || fname ~ "/com/sqlstream/" \
        || fname ~ "/linq4j/" \
+       || fname ~ "/lambda/" \
        || fname ~ "/optiq/" \
        || strict > 0;
 }
@@ -80,6 +81,10 @@
     return i;
 }

+function checkIndent(str) {
+    return str % indent == 0;
+}
+
 function startsWith(s, p) {
     return length(s) > length(p) \
         && substr(s, 1, length(p)) == p;
@@ -104,6 +109,8 @@
     mondrian = _isMondrian(fname);
     prevImport = "";
     prevImportGroup = "";
+    indent = (fname ~ /lambda/ || fname ~ /linq4j/) ? 2 : 4;
+    cindent = 4;

     delete headers;
     headerCount = 0;
@@ -178,19 +185,19 @@
         gsub(/:}/, "}", s);
         gsub(/:/, " : ", s);
     }
-    if (inComment && $0 ~ /\*\//) {
+    if (inComment && s ~ /\*\//) {
         # end of multiline comment "*/"
         inComment = 0;
         gsub(/^.*\*\//, "/* comment */", s);
     } else if (inComment) {
         s = "/* comment */";
-    } else if ($0 ~ /\/\*/ && $0 !~ /\/\*.*\*\//) {
+    } else if (s ~ /\/\*/ && s !~ /\/\*.*\*\//) {
         # beginning of multiline comment "/*"
         inComment = 1;
+        if (strict > 1 && FNR > 1 && s !~ /\/\*\*/ && s !~ /^\/\*/) {
+            error(fname, FNR, "Multi-line c-style comment not allowed" s);
+        }
         gsub(/\/\*.*$/, "/* comment */", s);
-        if (strict > 1 && FNR > 1 && $0 !~ /\/\*\*/ && $0 !~ /^\/\*/) {
-            error(fname, FNR, "Multi-line c-style comment not allowed");
-        }
     } else {
         # mask out /* */ comments
         gsub(/\/\*.*\*\//, "/* comment */", s);
@@ -223,8 +230,8 @@

     # Is the line indented as expected?
     if (nextIndent > 0) {
-        indent = countLeadingSpaces(s);
-        if (indent != nextIndent) {
+        x = countLeadingSpaces(s);
+        if (x != nextIndent) {
             error(fname, FNR, "Incorrect indent for first line of arg list");
         }
     }
@@ -373,7 +380,7 @@
         error(fname, FNR, "if must be followed by space");
     } else if (s ~ / else if /) {
     } else if (s ~ /^#if /) {
-    } else if (s !~ /^(    )*(if)/) {
+    } else if (!checkIndent(s)) {
         error(fname, FNR, "if must be correctly indented");
     }
 }
@@ -382,13 +389,13 @@
     } else if (s !~ /\<(while) /) {
         error(fname, FNR, "while must be followed by space");
     } else if (s ~ /} while /) {
-    } else if (s !~ /^(    )+(while)/) {
+    } else if (!checkIndent(s)) {
         error(fname, FNR, "while must be correctly indented");
     }
 }
 s ~ /\<(for|switch|synchronized|} catch) *\(/ {
     if (!matchFile) {}
-    else if (s !~ /^(    )*(for|switch|synchronized|} catch)/) {
+    else if (!checkIndent(s)) {
         error(fname, FNR, "for/switch/synchronized/catch must be correctly indented");
     } else if (s !~ /\<(for|switch|synchronized|} catch) /) {
         error(fname, FNR, "for/switch/synchronized/catch must be followed by space");
@@ -447,7 +454,7 @@
                     # Ignore case like 'for (Map.Entry<Foo,{nl} Bar> entry : ...'
                 } else if (s ~ / for /) {
                     # Ignore case like 'for (int i = 1,{nl} j = 2; i < j; ...'
-                } else {
+                } else if (indent == cindent) {
                     error(                                              \
                         fname, FNR,                                     \
                         "multi-line parameter list should start with newline");
@@ -458,7 +465,7 @@
                 # for macros), we're fine.
             } else if (s ~ /@.*\({/) {
                 # Ignore Java annotations.
-            } else {
+            } else if (indent == cindent) {
                 error(                                                  \
                     fname, FNR,                                         \
                     "Open parenthesis should be at end of line (function call spans several lines)");
@@ -494,7 +501,7 @@
 s ~ /\<assert\>/ {
     if (!matchFile) {}
     else if (isCpp) {} # rule only applies to java
-    else if (s !~ /^(    )+(assert)/) {
+    else if (!checkIndent(s)) {
         error(fname, FNR, "assert must be correctly indented");
     } else if (s !~ /\<assert /) {
         error(fname, FNR, "assert must be followed by space");
@@ -504,7 +511,7 @@
     if (!matchFile) {}
     else if (isCpp && s ~ /^#/) {
         # ignore macros
-    } else if (s !~ /^(    )+(return)/) {
+    } else if (!checkIndent(s)) {
         error(fname, FNR, "return must be correctly indented");
     } else if (s !~ /\<return[ ;]/ && s !~ /\<return$/) {
         error(fname, FNR, "return must be followed by space or ;");
@@ -514,7 +521,7 @@
     if (!matchFile) {}
     else if (isCpp) {
         # cannot yet handle C++ cases like 'void foo() throw(int)'
-    } else if (s !~ /^(    )+(throw)/) {
+    } else if (!checkIndent(s)) {
         error(fname, FNR, "throw must be correctly indented");
     } else if (s !~ /\<throw / && s !~ /\<throw$/) {
         error(fname, FNR, "throw must be followed by space");
@@ -523,38 +530,48 @@
 s ~ /\<else\>/ {
     if (!matchFile) {}
     else if (isCpp && s ~ /^# *else$/) {} # ignore "#else"
-    else if (s !~ /^(    )+} else (if |{$|{ *\/\/|{ *\/\*)/) {
-        error(fname, FNR, "else must be preceded by } and followed by { or if and correctly indented");
+    else if (!checkIndent(s)) {
+        error(fname, FNR, "else must be correctly indented");
+    } else if (s !~ /^ +} else (if |{$|{ *\/\/|{ *\/\*)/) {
+        error(fname, FNR, "else must be preceded by } and followed by { or if");
     }
 }
 s ~ /\<do\>/ {
     if (!matchFile) {}
-    else if (s !~ /^(    )*do {/) {
-        error(fname, FNR, "do must be followed by space {, and correctly indented");
+    else if (!checkIndent(s)) {
+        error(fname, FNR, "do must be correctly indented");
+    } else if (s !~ /^ *do {/) {
+        error(fname, FNR, "do must be followed by space {");
     }
 }
 s ~ /\<try\>/ {
     if (!matchFile) {}
-    else if (s !~ /^(    )+try {/) {
-        error(fname, FNR, "try must be followed by space {, and correctly indented");
+    else if (!checkIndent(s)) {
+        error(fname, FNR, "try must be correctly indented");
+    } else if (s !~ /^ +try {/) {
+        error(fname, FNR, "try must be followed by space {");
     }
 }
 s ~ /\<catch\>/ {
     if (!matchFile) {}
-    else if (s !~ /^(    )+} catch /) {
-        error(fname, FNR, "catch must be preceded by }, followed by space, and correctly indented");
+    else if (!checkIndent(s)) {
+        error(fname, FNR, "catch must be correctly indented");
+    } else if (s !~ /^ +} catch /) {
+        error(fname, FNR, "catch must be preceded by } and followed by space");
     }
 }
 s ~ /\<finally\>/ {
     if (!matchFile) {}
-    else if (s !~ /^(    )+} finally {/) {
-        error(fname, FNR, "finally must be preceded by }, followed by space {, and correctly indented");
+    else if (!checkIndent(s)) {
+        error(fname, FNR, "finally must be correctly indented");
+    } else if (s !~ /^ +} finally {/) {
+        error(fname, FNR, "finally must be preceded by } and followed by space {");
     }
 }
 s ~ /\($/ {
-    nextIndent = countLeadingSpaces(s) + 4;
-    if (s ~ / (if|while) .*\(.*\(/) {
-        nextIndent += 4;
+    nextIndent = countLeadingSpaces(s) + cindent;
+    if (s ~ / (if|while) .*\(.*\(/ && indent == cindent) {
+        nextIndent += indent;
     }
 }
 match(s, /([]A-Za-z0-9()])(+|-|\*|\^|\/|%|=|==|+=|-=|\*=|\/=|>=|<=|!=|&|&&|\||\|\||^|\?|:) *[A-Za-z0-9(]/, a) {
@@ -676,8 +693,10 @@
     if (!matchFile) {}
     else if (s !~ /}( |;|,|$|\)|\.)/) {
         error(fname, FNR, "} must be followed by space");
-    } else if (s !~ /(    )*}/) {
-        error(fname, FNR, "} must be at start of line and correctly indented");
+    } else if (s !~ /^ *}/) {
+        # not at start of line - ignore
+    } else if (!checkIndent(s)) {
+        error(fname, FNR, "} must be correctly indented");
     }
 }
 $0 ~ /\* @param [A-Za-z0-9_]+$/ && strict > 1 {
@@ -711,7 +730,7 @@
         closes = s;
         gsub(/[^)]/, "", closes);
         if (0 && strict < 2 && fname ~ /aspen/) {} # not enabled
-        else if (length(closes) > length(opens)) {
+        else if (length(closes) > length(opens) && indent == cindent) {
             error(fname, FNR, "Open brace should be on new line (function call/decl spans several lines)");
         }
     }
@@ -754,7 +773,7 @@
 && $0 !~ /http:/                                \
 && $0 !~ /https:/                               \
 && $0 !~ /\/\/ Expect "/                        \
-&& s !~ /^ *(\+ |<< |: |\?)?string\)?[;,]?$/ {
+&& s !~ /^ *(\+ |<< |: |\?)?string\)*[;,]?$/ {
     error( \
         fname, \
         FNR, \
@@ -770,7 +789,8 @@
     # Ignore open brace if it is part of class or interface declaration.
     if (classDeclStartLine) {
         if (classDeclStartLine < FNR \
-            && $0 !~ /^ *{$/)
+            && $0 !~ /^ *{$/ \
+            && indent == cindent)
         {
             error(fname, FNR, "Open brace should be on new line (class decl spans several lines)");
         }
@@ -783,6 +803,7 @@
             && $0 !~ /^ *{$/)
         {
             if (strict < 2 && fname ~ /aspen/) {} # not enabled
+            else if (cindent != indent) {}
             else error(fname, FNR, "Open brace should be on new line (function decl spans several lines)");
         }
         funDeclStartLine = 0;


testsuite: better error message

testsuite: better error message

git-svn-id: e7e61699ce1738538ffebb75374fbea0924bc775@13631 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02

--- testsuite/makefiles/summarize.awk
+++ testsuite/makefiles/summarize.awk
@@ -90,6 +90,9 @@
             for (i=0; i < unexped; i++) printf("    %s\n", unexp[i]);
         }
         printf("\n");
-        exit (failed || unexped ? 4 : 0);
+        if (failed || unexped){
+            printf("#### Some tests failed. Exiting with error status.\n\n");
+            exit 4;
+        }
     }
 }


Utils: pass --output and --user-agent to curl

--- include/Utils.awk
+++ include/Utils.awk
@@ -140,20 +140,28 @@
 }

 # Fetch the content of a URL. Return a null string if failed.
-function curl(url,    command, content, line) {
+function curl(url, output,    command, content, line) {
     initCurl()

     if (!Curl) {
         l(">> not found: curl")
         w("[WARNING] curl is not found.")
         return NULLSTR
-    } else {
-        command = Curl " --location --silent " parameterize(url)
-        content = NULLSTR
-        while ((command |& getline line) > 0)
-            content = (content ? content "\n" : NULLSTR) line
-        return content
     }
+
+    command = Curl " --location --silent"
+    if (Option["user-agent"])
+        command = command " --user-agent " parameterize(Option["user-agent"])
+    command = command " " parameterize(url)
+    if (output) {
+        command = command " --output " parameterize(output)
+        system(command)
+        return NULLSTR
+    }
+    content = NULLSTR
+    while ((command |& getline line) > 0)
+        content = (content ? content "\n" : NULLSTR) line
+    return content
 }

 # Dump a Unicode string into a byte array. Return the length of the array.


Fix extra comma in json file

Fix extra comma in json file

--- buildBBoxScrapersFrom-webscraper.awk
+++ buildBBoxScrapersFrom-webscraper.awk
@@ -5,16 +5,20 @@
 /\/us\/movie\// {
     numMovies += 1
     shortURL = $6
-    printf ("%s    \"https://www.britbox.com%s\"", trailingComma, shortURL) >> EPISODES_JSON_FILE
-    trailingComma = ",\n"
+    printf ("%s    \"https://www.britbox.com%s\"", trailingEpisodesComma, shortURL) \
+        >> EPISODES_JSON_FILE
+    trailingEpisodesComma = ",\n"
 }

 /\/us\/show\// {
     numShows += 1
     shortURL = $6
-    printf ("%s    \"https://www.britbox.com%s\"", trailingComma, shortURL) >> EPISODES_JSON_FILE
-    printf ("%s    \"https://www.britbox.com%s\"", trailingComma, shortURL) >> SEASONS_JSON_FILE
-    trailingComma = ",\n"
+    printf ("%s    \"https://www.britbox.com%s\"", trailingEpisodesComma, shortURL) \
+        >> EPISODES_JSON_FILE
+    trailingEpisodesComma = ",\n"
+    printf ("%s    \"https://www.britbox.com%s\"", trailingSeasonsComma, shortURL) \
+        >> SEASONS_JSON_FILE
+    trailingSeasonsComma = ",\n"
 }

 END {


Languages: allow names and endonyms as aliases

--- include/Languages.awk
+++ include/Languages.awk
@@ -1699,6 +1699,10 @@

         # ISO 639-3 codes as aliases
         LocaleAlias[Locale[i]["iso"]] = i
+
+        # Names and endonyms as aliases
+        LocaleAlias[tolower(Locale[i]["name"])] = i
+        LocaleAlias[tolower(Locale[i]["endonym"])] = i
     }

     # Other aliases
@@ -1713,6 +1717,7 @@
     LocaleAlias["sh"] = "sr" # Serbo-Croatian: default to Serbian
     LocaleAlias["zh"] = "zh-CN" # Chinese: default to Chinese Simplified
     LocaleAlias["zho"] = "zh-CN"
+    LocaleAlias["chinese"] = "zh-CN"
     # TODO: more aliases
 }

@@ -1722,6 +1727,8 @@
         return code
     else if (code in LocaleAlias)
         return LocaleAlias[code]
+    else if (tolower(code) in LocaleAlias)
+        return LocaleAlias[tolower(code)]
     else
         return # return nothing if not found
 }


change to {{cite web}}

change to {{cite web}}

--- replacebandwref.awk
+++ replacebandwref.awk
@@ -39,7 +39,8 @@
    c = patsplit(Article, b, "{[ ]{0,2}[Cc]ite[^}]+}")
    while (i++ < c) {
      if(b[i] ~ "kirjasto[.]sci[.]fi") {
-       replace(b[i], sprintf("{Books and Writers |id=%s |name=%s |cite=yes}", bandwid(b[i]), name) )
+       id = bandwid(b[i])
+       replace(tl, sprintf("{{cite web |url=http://www.kirjasto.sci.fi/%s.htm |title=%s |website=Books and Writers ''(kirjasto.sci.fi)'' |first=Petri |last=Liukkonen |publisher=[[Kuusankoski]] Public Library |location=Finland |archiveurl=https://web.archive.org/web/20150210175324/http://www.kirjasto.sci.fi/%s.htm |archivedate=10 February 2015 |dead-url=yes}}",id,name,id) )
      }
    }

@@ -50,7 +51,8 @@
    while(i++ < c) {
      k = substr(b[i], 1, match(b[i], "</ref>") - 1)
      if(k ~ "kirjasto[.]sci[.]fi") {
-       replace(k, sprintf("{{Books and Writers |id=%s |name=%s |cite=yes}}", bandwid(k), name) )
+       id = bandwid(k)
+       replace(tl, sprintf("{{cite web |url=http://www.kirjasto.sci.fi/%s.htm |title=%s |website=Books and Writers ''(kirjasto.sci.fi)'' |first=Petri |last=Liukkonen |publisher=[[Kuusankoski]] Public Library |location=Finland |archiveurl=https://web.archive.org/web/20150210175324/http://www.kirjasto.sci.fi/%s.htm |archivedate=10 February 2015 |dead-url=yes}}",id,name,id) )
      }
    }


Update code style

Update code style

--- tools/awk/mean.awk
+++ tools/awk/mean.awk
@@ -16,12 +16,12 @@
 # [1]: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Online_algorithm

 BEGIN {
+	delta = 0
+	mean = 0
 	N = 0
-	mean = 0
-	delta = 0
 }
 {
-	N++
+	N += 1
 	delta = $1 - mean
 	mean += delta / N
 }


Languages: fix initUserLang() (close #61)

--- include/Languages.awk
+++ include/Languages.awk
@@ -1945,11 +1945,24 @@
 }

 # Initialize `UserLang`.
-function initUserLang() {
-    UserLocale = ENVIRON["LANGUAGE"] ? ENVIRON["LANGUAGE"] :
-        (ENVIRON["LC_ALL"] ? ENVIRON["LC_ALL"] :
-         (ENVIRON["LANG"] ? ENVIRON["LANG"] : "en_US.UTF-8"))
-    if (tolower(UserLocale) !~ /utf-?8$/)
+function initUserLang(    lang, utf) {
+    if (lang = ENVIRON["LANGUAGE"]) {
+        if (!UserLocale) UserLocale = lang
+        utf = utf || tolower(lang) ~ /utf-?8$/
+    }
+    if (lang = ENVIRON["LC_ALL"]) {
+        if (!UserLocale) UserLocale = lang
+        utf = utf || tolower(lang) ~ /utf-?8$/
+    }
+    if (lang = ENVIRON["LANG"]) {
+        if (!UserLocale) UserLocale = lang
+        utf = utf || tolower(lang) ~ /utf-?8$/
+    }
+    if (!UserLocale) {
+        UserLocale = "en_US.UTF-8"
+        utf = 1
+    }
+    if (!utf)
         w("[WARNING] Your locale codeset (" UserLocale ") is not UTF-8.")

     UserLang = parseLang(UserLocale)


build.awk: do not export COLUMNS

build.awk: do not export COLUMNS

--- build.awk
+++ build.awk
@@ -168,8 +168,6 @@
                 print "export TRANS_BUILD=git:" temp > Trans
         }

-        print "export COLUMNS=$(tput cols)" > Trans
-
         print "gawk -f <(echo -E \"$TRANS_PROGRAM\") - \"$@\"" > Trans

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


Update filter_en_uk.awk

Update filter_en_uk.awk

Moved the keys so they appear from the top left one to the right bottom one. Added |

--- filter_en_uk.awk
+++ filter_en_uk.awk
@@ -17,50 +17,6 @@
             }
             if ($x == "`") {
                 macroLine = macroLine "+grave,-grave";
-                break;
-            }
-            if ($x == "-") {
-                macroLine = macroLine "+minus,-minus";
-                break;
-            }
-            if ($x == "[") {
-                macroLine = macroLine "+lbrace,-lbrace";
-                break;
-            }
-            if ($x == "]") {
-                macroLine = macroLine "+rbrace,-rbrace";
-                break;
-            }
-            if ($x == ";") {
-                macroLine = macroLine "+colon,-colon";
-                break;
-            }
-            if ($x == "'") {
-                macroLine = macroLine "+quote,-quote";
-                break;
-            }
-            if ($x == "\\") {
-                macroLine = macroLine "+bslash_iso,-bslash_iso";
-                break;
-            }
-            if ($x == ",") {
-                macroLine = macroLine "+comma,-comma";
-                break;
-            }
-            if ($x == ".") {
-                macroLine = macroLine "+dot,-dot";
-                break;
-            }
-            if ($x == "#") {
-                macroLine = macroLine "+hash,-hash";
-                break;
-            }
-            if ($x == "=") {
-                macroLine = macroLine "+equal,-equal";
-                break;
-            }
-            if ($x == "/") {
-                macroLine = macroLine "+slash,-slash";
                 break;
             }
             if ($x == "¬") {
@@ -107,40 +63,88 @@
                 macroLine = macroLine "+lshift,+0,-0,-lshift";
                 break;
             }
+            if ($x == "-") {
+                macroLine = macroLine "+minus,-minus";
+                break;
+            }
             if ($x == "_") {
                 macroLine = macroLine "+lshift,+minus,-minus,-lshift";
+                break;
+            }
+            if ($x == "=") {
+                macroLine = macroLine "+equal,-equal";
+                break;
+            }
+            if ($x == "[") {
+                macroLine = macroLine "+lbrace,-lbrace";
+                break;
+            }
+            if ($x == "{") {
+                macroLine = macroLine "+lshift,+lbrace,-lbrace,-lshift";
+                break;
+            }
+            if ($x == "]") {
+                macroLine = macroLine "+rbrace,-rbrace";
+                break;
+            }
+            if ($x == "}") {
+                macroLine = macroLine "+lshift,+rbrace,-rbrace,-lshift";
+                break;
+            }
+            if ($x == "#") {
+                macroLine = macroLine "+hash,-hash";
+                break;
+            }
+            if ($x == "~") {
+                macroLine = macroLine "+lshift,+hash,-hash,-lshift";
+                break;
+            }
+            if ($x == ";") {
+                macroLine = macroLine "+colon,-colon";
+                break;
+            }
+            if ($x == ":") {
+                macroLine = macroLine "+lshift,+colon,-colon,-lshift";
+                break;
+            }
+            if ($x == "'") {
+                macroLine = macroLine "+quote,-quote";
+                break;
+            }
+            if ($x == "@") {
+                macroLine = macroLine "+lshift,+quote,-quote,-lshift";
+                break;
+            }
+            if ($x == ",") {
+                macroLine = macroLine "+comma,-comma";
+                break;
+            }
+            if ($x == "\\") {
+                macroLine = macroLine "+bslash_iso,-bslash_iso";
+                break;
+            }
+            if ($x == "|") {
+                macroLine = macroLine "+lshift,+bslash_iso,-bslash_iso,-lshift";
                 break;
             }
             if ($x == "<") {
                 macroLine = macroLine "+lshift,+comma,-comma,-lshift";
                 break;
             }
+            if ($x == ".") {
+                macroLine = macroLine "+dot,-dot";
+                break;
+            }
             if ($x == ">") {
                 macroLine = macroLine "+lshift,+dot,-dot,-lshift";
                 break;
             }
+            if ($x == "/") {
+                macroLine = macroLine "+slash,-slash";
+                break;
+            }
             if ($x == "?") {
                 macroLine = macroLine "+lshift,+slash,-slash,-lshift";
-                break;
-            }
-            if ($x == ":") {
-                macroLine = macroLine "+lshift,+colon,-colon,-lshift";
-                break;
-            }
-            if ($x == "@") {
-                macroLine = macroLine "+lshift,+quote,-quote,-lshift";
-                break;
-            }
-            if ($x == "~") {
-                macroLine = macroLine "+lshift,+hash,-hash,-lshift";
-                break;
-            }
-            if ($x == "{") {
-                macroLine = macroLine "+lshift,+lbrace,-lbrace,-lshift";
-                break;
-            }
-            if ($x == "}") {
-                macroLine = macroLine "+lshift,+rbrace,-rbrace,-lshift";
                 break;
             }


Fix ' in Person names

Fix ' in Person names


REPL: support 4-letter script code

REPL: support 4-letter script code


Fixed problem with top-of-stack mechanism on globally optimized code

--- util/opt/pop_push.awk
+++ util/opt/pop_push.awk
@@ -9,6 +9,7 @@
 }
 /aar/	{ switch = NR }
 	{ if (switch) {
+	      if ($1 == "cal" || $1 == "cai") $3 = "?"
 	      printf("/* %s */ \"%s\",\n",$1,$3)
 	      col_2[NR-switch] = $2
 	      comment[NR-switch] = $1


LanguageData: update section L

LanguageData: update section L

--- include/LanguageData.awk
+++ include/LanguageData.awk
@@ -1368,9 +1368,7 @@
     Locale["ky"]["spoken-in"]          = "Kyrgyzstan; China; Tajikistan; Afghanistan; Pakistan"
     Locale["ky"]["supported-by"]       = "google; bing; yandex"

-
-
-    #53 Lao
+    # Lao
     Locale["lo"]["name"]               = "Lao"
     Locale["lo"]["endonym"]            = "ລາວ"
     Locale["lo"]["translations-of"]    = "ຄຳແປສຳລັບ %s"
@@ -1378,12 +1376,15 @@
     Locale["lo"]["synonyms"]           = "ຄຳທີ່ຄ້າຍກັນ %s"
     Locale["lo"]["examples"]           = "ຕົວຢ່າງ"
     Locale["lo"]["see-also"]           = "ເບິ່ງເພີ່ມເຕີມ"
-    Locale["lo"]["family"]             = "Tai-Kadai"
+    Locale["lo"]["family"]             = "Kra-Dai"
+    Locale["lo"]["branch"]             = "Tai"
     Locale["lo"]["iso"]                = "lao"
     Locale["lo"]["glotto"]             = "laoo1244"
     Locale["lo"]["script"]             = "Laoo"
-
-    #54 Latin
+    Locale["lo"]["spoken-in"]          = "Laos; Thailand; Cambodia"
+    Locale["lo"]["supported-by"]       = "google; bing; yandex"
+
+    # Latin
     Locale["la"]["name"]               = "Latin"
     Locale["la"]["endonym"]            = "Latina"
     Locale["la"]["translations-of"]    = "Versio de %s"
@@ -1392,11 +1393,14 @@
     #Locale["la"]["examples"]
     #Locale["la"]["see-also"]
     Locale["la"]["family"]             = "Indo-European"
+    Locale["la"]["branch"]             = "Latino-Faliscan"
     Locale["la"]["iso"]                = "lat"
     Locale["la"]["glotto"]             = "lati1261"
     Locale["la"]["script"]             = "Latn"
-
-    #55 Latvian
+    Locale["la"]["spoken-in"]          = "ancient Rome"
+    Locale["la"]["supported-by"]       = "google; yandex"
+
+    # Latvian
     Locale["lv"]["name"]               = "Latvian"
     Locale["lv"]["endonym"]            = "Latviešu"
     Locale["lv"]["translations-of"]    = "%s tulkojumi"
@@ -1405,9 +1409,12 @@
     Locale["lv"]["examples"]           = "Piemēri"
     Locale["lv"]["see-also"]           = "Skatiet arī"
     Locale["lv"]["family"]             = "Indo-European"
+    Locale["lv"]["branch"]             = "Eastern Baltic"
     Locale["lv"]["iso"]                = "lav"
     Locale["lv"]["glotto"]             = "latv1249"
     Locale["lv"]["script"]             = "Latn"
+    Locale["lv"]["spoken-in"]          = "Latvia"
+    Locale["lv"]["supported-by"]       = "google; bing; yandex"

     # Lingala
     Locale["ln"]["name"]               = "Lingala"
@@ -1418,11 +1425,14 @@
     #Locale["ln"]["examples"]
     #Locale["ln"]["see-also"]
     Locale["ln"]["family"]             = "Atlantic-Congo"
+    Locale["ln"]["branch"]             = "Bantu"
     Locale["ln"]["iso"]                = "lin"
     Locale["ln"]["glotto"]             = "ling1269"
     Locale["ln"]["script"]             = "Latn"
-
-    #56 Lithuanian
+    Locale["ln"]["spoken-in"]          = "DR Congo; Republic of the Congo; Angola; Central African Republic; southern South Sudan"
+    Locale["ln"]["supported-by"]       = "google"
+
+    # Lithuanian
     Locale["lt"]["name"]               = "Lithuanian"
     Locale["lt"]["endonym"]            = "Lietuvių"
     Locale["lt"]["translations-of"]    = "„%s“ vertimai"
@@ -1431,9 +1441,12 @@
     Locale["lt"]["examples"]           = "Pavyzdžiai"
     Locale["lt"]["see-also"]           = "Taip pat žiūrėkite"
     Locale["lt"]["family"]             = "Indo-European"
+    Locale["lt"]["branch"]             = "Eastern Baltic"
     Locale["lt"]["iso"]                = "lit"
     Locale["lt"]["glotto"]             = "lith1251"
     Locale["lt"]["script"]             = "Latn"
+    Locale["lt"]["spoken-in"]          = "Lithuania"
+    Locale["lt"]["supported-by"]       = "google; bing; yandex"

     # Luganda
     Locale["lg"]["name"]               = "Luganda"
@@ -1445,11 +1458,14 @@
     #Locale["lg"]["examples"]
     #Locale["lg"]["see-also"]
     Locale["lg"]["family"]             = "Atlantic-Congo"
+    Locale["lg"]["branch"]             = "Bantu"
     Locale["lg"]["iso"]                = "lug"
     Locale["lg"]["glotto"]             = "gand1255"
     Locale["lg"]["script"]             = "Latn"
-
-    #57 Luxembourgish
+    Locale["lg"]["spoken-in"]          = "Uganda; Rwanda"
+    Locale["lg"]["supported-by"]       = "google"
+
+    # Luxembourgish
     Locale["lb"]["name"]               = "Luxembourgish"
     Locale["lb"]["endonym"]            = "Lëtzebuergesch"
     #Locale["lb"]["translations-of"]
@@ -1458,9 +1474,14 @@
     #Locale["lb"]["examples"]
     #Locale["lb"]["see-also"]
     Locale["lb"]["family"]             = "Indo-European"
+    Locale["lb"]["branch"]             = "West Germanic"
     Locale["lb"]["iso"]                = "ltz"
     Locale["lb"]["glotto"]             = "luxe1241"
     Locale["lb"]["script"]             = "Latn"
+    Locale["lb"]["spoken-in"]          = "Luxembourg"
+    Locale["lb"]["supported-by"]       = "google; yandex"
+
+

     #58 Macedonian
     Locale["mk"]["name"]               = "Macedonian"
@@ -2076,7 +2097,7 @@
     Locale["th"]["synonyms"]           = "คำพ้องความหมาย"
     Locale["th"]["examples"]           = "ตัวอย่าง"
     Locale["th"]["see-also"]           = "ดูเพิ่มเติม"
-    Locale["th"]["family"]             = "Tai-Kadai"
+    Locale["th"]["family"]             = "Kra-Dai"
     Locale["th"]["iso"]                = "tha"
     Locale["th"]["glotto"]             = "thai1261"
     Locale["th"]["script"]             = "Thai"


Translators/GoogleTranslate: add "Did you mean" hint

--- include/Translators/GoogleTranslate.awk
+++ include/Translators/GoogleTranslate.awk
@@ -150,8 +150,13 @@
             altTranslations[group[1]][group[2]] = postprocess(literal(ast[i]))

         # 7 - autocorrection
-        if (i ~ "^0" SUBSEP "7" SUBSEP "5$")
-            w("Showing translation for:  (use -no-auto to disable autocorrect)")
+        if (i ~ "^0" SUBSEP "7" SUBSEP "5$") {
+            if (ast[i] == "true")
+                w("Showing translation for:  (use -no-auto to disable autocorrect)")
+            else
+                w("Did you mean: "                                      \
+                  ansi("bold", unparameterize(ast["0" SUBSEP "7" SUBSEP "1"])))
+        }

         # 8 - identified source languages
         if (i ~ "^0" SUBSEP "8" SUBSEP "0" SUBSEP "[[:digit:]]+$" ||


correct color asignment

correct color asignment

--- scripts/deltadot.awk
+++ scripts/deltadot.awk
@@ -72,8 +72,8 @@
             else {
                 diff = edge2[e] - edge1[e];
                 if(diff < 0)
-                    # diff = "" diff "" #  breaks svg
-                    edges[e "(" diff ")>, color=\"" DROP "\"];"]
+                    # diff = "" diff "" #  breaks svg
+                    edges[e "(" diff ")>, color=\"" LESS "\"];"]
                 else
                     edges[e "(" diff ")>, color=\"" DFLT "\"];"]
             }


More cleansing

More cleansing


Reassign publishers.

Reassign publishers.

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


accomadate some exceptions, shorten predicate when an anchor is used

--- scripts/ntriple2dot.awk
+++ scripts/ntriple2dot.awk
@@ -14,43 +14,79 @@
 		return substr(uri,1,RLENGTH -1)
 }

+# keep underscore, letters & numbers
+# change the rest to (a single) underscore sans leading & trailing
+function simplify(str){
+	gsub(/[^[:alpha:][:digit:]_]+/,"_",str)
+	gsub(/^_+|_+$/, "",str)
+	gsub(/__*/,"_",str)
+	return str
+}
+
 function contract(uri){
 	if(uri in prefix)
 		return prefix[uri]
-	else {
-		gsub(/[:./-]+/,"_",uri)
-		return uri
-	}
+	else
+		for(ex in exception){
+			start = match(uri, ex)
+			if(0 < start)
+				return exception[substr(uri, start, RLENGTH)]
+		}
+	# else
+		return simplify(uri)
 }

+# get the final (identifier) portion of a slashed path
+function final(uri){
+	split(trim(uri),b,"/")
+	p = b[length(b)]
+	anchor = match(p, "#")
+	if(anchor > 0)
+		p = substr(p, anchor+1)
+	return
+}
+
+BEGIN{
+	# Monarchinitiave's dipper ingest files have cases
+	# which escape the general rules
+	# in everything
+	exception["http://www.w3.org/2002/07"]="OWL_"
+	# in go,mgi,wormbase
+	exception["http://dx.doi.org"]="DOI"
+	# in mgi
+	exception["https://www.mousephenotype.org"]="IMPC_"
+	# in panther
+	exception["http://identifiers.org/wormbase"]="WormBase"
+	# just until skolemized bnodes get in the curie map?
+	exception["https://monarchinitiave.org/.well-known/genid"]="BNODE"
+}
+
+# main loop
 # parse and stash the curie file (first file)
 (FNR == NR) && /^'[^']*' *: 'http[^']*'.*/ {
 	split($0,a,"'")
 	prefix[stripid(a[4])]=a[2]
 }
-
 # process the ntriple file(s)  which are not the first file
-### all are uri
+### case when subject predicate and object are all uri
 (FNR != NR) && /^<[^>]*> <[^>]*> <[^>]*> \.$/ {
 	### Subject (uri)
 	s = contract(stripid(trim($1)))
 	### Predicate (uri)
-	split(trim($2),b,"/")
-	p = b[length(b)]
+	p = final($2)
 	### Object (like subject)
 	o = contract(stripid(trim($3)))
-	edgelist[s " -> " o " [label=\"" p "\"];"]++
+	edgelist[s " -> " o " [label=\"" p ]++
 }
-### object is a literal
+### case when the object is a literal
 (FNR != NR) && /^<[^>]*> <[^>]*> "[^"]*" \.$/ {
 	### Subject (uri)
 	s = contract(stripid(trim($1)))
 	### Predicate (uri)
-	split(trim($2),b,"/")
-	p = b[length(b)]
+	p = final($2)
 	### not a uri
 	o = "LITERAL"
-	edgelist[s " -> " o " [label=\"" p "\"];"]++
+	edgelist[s " -> " o " [label=\"" p ]++
 	nodelist[o " [shape=record];"]++
 }

@@ -59,7 +95,7 @@
 	print "rankdir=LR;"
 	print "charset=\"utf-8\";"
 	for(edge in edgelist){
-		print edge
+		print edge " (" edgelist[edge] ")\"];"
 	}
 	for(node in nodelist){
 		print node


Bugfix change manual->dhcp

Bugfix change manual->dhcp

--- changeInterface.awk
+++ changeInterface.awk
@@ -88,7 +88,7 @@

 {
     # maybe remove auto if manual is selected??
-    if ($1 == "auto" && remove ) {
+    if (($1 == "auto" && remove) || ($1 == "auto" && manual) ) {
         if($2 != device)
             print;
         next;
@@ -120,6 +120,13 @@
                     print "iface", device, "inet static";
                     next;
                 }
+        # change to manual if defined
+                if (manual) {
+                    sub(/ dhcp/, " manual");
+                    print $0;
+                    print "\n"
+                    next;
+                }
             }

             else if (match ($0, / manual/)) {
@@ -134,6 +141,7 @@
                 if (dhcp) {
                     sub(/ manual/, " dhcp");
                     print $0;
+                    print "\n"
                     next;
                 }
             }


Fix invisible comments - CTR

Fix invisible comments - CTR

--- docs/postprocessor/processor.awk
+++ docs/postprocessor/processor.awk
@@ -28,7 +28,7 @@

 /<\/style>/ {
   if (!styled) {
-    print ".invisible {position: absolute; left: 9999px}"
+    print ".invisible {color: rgba(0,0,0,0); font-size: 0;}"
     styled=1
   }
 }


Fix for line breaks in argument lists.

Fix for line breaks in argument lists.


Help: add getHelp()

Help: add getHelp()

--- include/Help.awk
+++ include/Help.awk
@@ -102,3 +102,13 @@
             "│ " Locale["he"]["display"] "        - " AnsiCode["bold"] "he" AnsiCode["no bold"] "  │ " Locale["ne"]["display"] "            - " AnsiCode["bold"] "ne" AnsiCode["no bold"] "  │ " Locale["zu"]["display"] "     - " AnsiCode["bold"] "zu" AnsiCode["no bold"] "    │\n" \
             "└────────────────────┴────────────────────────┴─────────────────────┘"
 }
+
+# Return help as a string.
+# Parameters:
+#     displayName = "endonym" or "name"
+function getHelp(displayName) {
+    return "Usage: translate {[source]=[target]} text ...\n" \
+        "       translate {[source]=[target1]+[target2]+...} text ...\n" \
+        "       translate text ...\n\n" \
+        "Language codes for [source] and [target]:\n" getCodeReferenceTable(displayName)
+}


Initial work on handling broken episodes

--- getBBoxEpisodesFrom-webscraper.awk
+++ getBBoxEpisodesFrom-webscraper.awk
@@ -36,11 +36,27 @@
     # Extract sortkey from URL
     nflds = split (URL,fld,"_")
     if (URL ~ /_S[[:digit:]]*_E[[:digit:]]*_[[:digit:]]*$/) {
+        # /us/episode/35_Days_S3_E8_23851
+        # Season 3, Episode 8
         seasonNumber = substr(fld[nflds-2], 2)
         episodeNumber = substr(fld[nflds-1], 2)
         sortkey = sprintf ("%s%02dE%03d", showtype, seasonNumber, episodeNumber)
+    } else if (URL ~ /_E[[:digit:]]*_[[:digit:]]*$/) {
+        # /us/episode/35_Hours_E1_26129
+        # 35 Hours, Episode 1
+        seasonNumber = "99"
+        episodeNumber = substr(fld[nflds-1], 2)
+        sortkey = sprintf ("%s%02dE%03d", showtype, seasonNumber, episodeNumber)
+    } else if (URL ~ /Episode_[[:digit:]]*_[[:digit:]]*$/) {
+        # /us/episode/Episode_5_26089
+        # Season 4, Episode 5
+        seasonNumber = "98"
+        episodeNumber = substr(fld[nflds-1], 1)
+        sortkey = sprintf ("%s%02dE%03d", showtype, seasonNumber, episodeNumber)
     } else {
         URL ~ /^\/us\/movie\// ? showtype = "M" : showtype = "E"
+        # /us/episode/Orkneys_Stone_Age_Temple_7144
+        # A History of Ancient Britain Special, Orkney's Stone Age Temple
         sortkey = sprintf ("%s%05d", showtype, fld[nflds])
     }


makeDistortosConfiguration.awk: fix shebang

Use proper location of AWK in the shebang.

--- scripts/makeDistortosConfiguration.awk
+++ scripts/makeDistortosConfiguration.awk
@@ -1,4 +1,4 @@
-#!/bin/awk -f
+#!/usr/bin/awk -f

 #
 # file: makeDistortosConfiguration.awk
@@ -8,7 +8,7 @@
 # This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
 # distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
-# date: 2015-10-02
+# date: 2015-10-11
 #

 BEGIN {


Changing display of parsed config

Changing display of parsed config

--- src/util.template.awk
+++ src/util.template.awk
@@ -30,8 +30,7 @@
 }

 function printConfig(config) {
-	print ".- Config -------------------------------------------------" \
-		"--------------------."
+	print "┏━ Config ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"

 	maxEntry = 0

@@ -39,16 +38,15 @@
 		maxEntry = max(maxEntry, length(entry))
 	}

-	remaining = 73 - maxEntry
+	remaining = 72 - maxEntry

-	format = "| %-" maxEntry "s = %-" remaining "s |\n"
+	format = "┃ %-" maxEntry "s = %-" remaining "s ┃\n"

 	for (entry in config) {
 		printf(format, entry, config[entry])
 	}

-	print "'---------------------------------------------------------" \
-		"---------------------'"
+	print "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
 }

 function trim(s) {


Indent the solve code produced by fzn2py so that it does not get run when the module is imported.

--- fzn/fzn2py.awk
+++ fzn/fzn2py.awk
@@ -260,46 +260,47 @@
 	print "    return model, output_vars";

 	print "";
-	print "model, output_vars = get_model()";
-	if(output_vars) print output_vars " = output_vars";
-	print "solvers = ['Mistral', 'SCIP', 'MiniSat', 'Toulbar2', 'Gurobi']";
-	print "default = dict([('solver', 'Mistral'), ('verbose', 0), ('tcutoff', 900), ('var', 'DomainOverWDegree'), ('val', 'Lex'), ('rand', 2), ('threads', 1), ('restart', GEOMETRIC), ('base', 256), ('factor', 1.3)])";
-	print "param = input(default)";
-	print "solver = model.load(param['solver'])";
-	print "solver.setVerbosity(param['verbose'])";
-	print "solver.setTimeLimit(param['tcutoff'] - int(time.clock()+0.5))";
-	print "solver.setHeuristic(param['var'], param['val'], param['rand'])";
-	print "if param['solver'] == 'Gurobi':";
-	print "    solver.setThreadCount(param['threads'])";
-	print "if param['solver'] == 'Mistral':";
-	print "    # LUBY, GEOMETRIC = 0, 1"
-	print "    solver.solveAndRestart(param['restart'], param['base'], param['factor'])";
-	print "else:";
-	print "    solver.solve()";
-	print "if solver.is_sat():"
+	print "if __name__ == '__main__':";
+	print "    model, output_vars = get_model()";
+	if(output_vars) print "    " output_vars " = output_vars";
+	print "    solvers = ['Mistral', 'SCIP', 'MiniSat', 'Toulbar2', 'Gurobi']";
+	print "    default = dict([('solver', 'Mistral'), ('verbose', 0), ('tcutoff', 900), ('var', 'DomainOverWDegree'), ('val', 'Lex'), ('rand', 2), ('threads', 1), ('restart', GEOMETRIC), ('base', 256), ('factor', 1.3)])";
+	print "    param = input(default)";
+	print "    solver = model.load(param['solver'])";
+	print "    solver.setVerbosity(param['verbose'])";
+	print "    solver.setTimeLimit(param['tcutoff'] - int(time.clock()+0.5))";
+	print "    solver.setHeuristic(param['var'], param['val'], param['rand'])";
+	print "    if param['solver'] == 'Gurobi':";
+	print "        solver.setThreadCount(param['threads'])";
+	print "    if param['solver'] == 'Mistral':";
+	print "        # LUBY, GEOMETRIC = 0, 1"
+	print "        solver.solveAndRestart(param['restart'], param['base'], param['factor'])";
+	print "    else:";
+	print "        solver.solve()";
+	print "    if solver.is_sat():"
 	for (i=1; i<=n; i++) {
 		e = varnames[i];
 		if (output[e]==1) {
-			if (e != objective && e != "objective" && e != "obj") print "    print '" e " = '," e ".get_value(),';'";
-			else print "    print '" e " = ', (solver.getOptimum() if param['solver'] == 'Toulbar2' else " e ".get_value()),';'";
+			if (e != objective && e != "objective" && e != "obj") print "        print '" e " = '," e ".get_value(),';'";
+			else print "        print '" e " = ', (solver.getOptimum() if param['solver'] == 'Toulbar2' else " e ".get_value()),';'";
 		} else {
-			print "    print '" e " = " outputstring[e] ",',str(" e "),');'";
-		}
-	}
-	print "    print '----------'";
+			print "        print '" e " = " outputstring[e] ",',str(" e "),');'";
+		}
+	}
+	print "        print '----------'";
 	if (objective){
-		print "    if solver.is_opt():"
+		print "        if solver.is_opt():"
+		print "            print '=========='"
+	} else {
 		print "        print '=========='"
-	} else {
-		print "    print '=========='"
-	}
-	print "elif solver.is_unsat():"
-	print "    print '=====UNSATISFIABLE====='"
-    print "else:"
-	print "    print '=====UNKNOWN====='"
-	print "print '% SolveTime', solver.getTime()";
-	print "print '% Nodes', solver.getNodes()";
-	print "print '% Failures', solver.getFailures()";
-	if (objective) print "if solver.is_sat(): print '% Objective', (solver.getOptimum() if param['solver'] == 'Toulbar2' else " objective ".get_value())";
-	}
-}
+	}
+	print "    elif solver.is_unsat():"
+	print "        print '=====UNSATISFIABLE====='"
+    print "    else:"
+	print "        print '=====UNKNOWN====='"
+	print "    print '% SolveTime', solver.getTime()";
+	print "    print '% Nodes', solver.getNodes()";
+	print "    print '% Failures', solver.getFailures()";
+	if (objective) print "    if solver.is_sat(): print '% Objective', (solver.getOptimum() if param['solver'] == 'Toulbar2' else " objective ".get_value())";
+	}
+}


added dct:isReferencedBy to owl:sameAs data subset

--- bin/util/sameasInNT.awk
+++ bin/util/sameasInNT.awk
@@ -4,3 +4,6 @@
 $2 == "<http://www.w3.org/2002/07/owl#sameAs>" {
    print
 }
+$2 == "<http://purl.org/dc/terms/isReferencedBy>" {
+   print
+}


Languages: 正體中文 -> 繁體中文 (close #438)

Languages: 正體中文 -> 繁體中文 (close #438)

--- include/Languages.awk
+++ include/Languages.awk
@@ -266,7 +266,7 @@

     #15b Chinese (Mandarin), Traditional
     Locale["zh-TW"]["name"]            = "Chinese Traditional"
-    Locale["zh-TW"]["endonym"]         = "正體中文"
+    Locale["zh-TW"]["endonym"]         = "繁體中文"
     Locale["zh-TW"]["translations-of"] = "「%s」的翻譯"
     Locale["zh-TW"]["definitions-of"]  = "「%s」的定義"
     Locale["zh-TW"]["synonyms"]        = "同義詞"


fix a regression bug (related to #24)

fix a regression bug (related to #24)

--- include/Translate.awk
+++ include/Translate.awk
@@ -136,14 +136,15 @@
             altTranslations[group[1]][group[2]] = postprocess(literal(ast[i]))

         # Identified source languages
-        if (i ~ "^0" SUBSEP "8" SUBSEP "0" SUBSEP "[[:digit:]]+$")
+        if (i ~ "^0" SUBSEP "8" SUBSEP "0" SUBSEP "[[:digit:]]+$" ||
+            i ~ "^0" SUBSEP "2$")
             append(ils, literal(ast[i]))
     }
     PROCINFO["sorted_in"] = saveSortedIn

     translation = join(translations)

-    il = belongsTo(sl, ils) ? sl : ils[0]
+    il = !anything(ils) || belongsTo(sl, ils) ? sl : ils[0]

     # Generate output
     if (!isVerbose) {


iostat: fixing timestamps

iostat: fixing timestamps

--- client/plugins/iostat/iostat.awk
+++ client/plugins/iostat/iostat.awk
@@ -4,7 +4,7 @@
 }
 (NF==6 && !/Device/ && !/d/) {
     current_time=""
-    "date +'%Y-%m-%d'" |& getline current_time".123";
+    "date +'%Y-%m-%dT%T.%3N'" |& getline current_time;
     close("date +'%Y-%m-%d'")

     epoch_time=""
@@ -29,7 +29,7 @@
 }
 (NF==6 && !/Device/ && /d/) {
     current_time=""
-    "date +'%Y-%m-%d'" |& getline current_time".123";
+    "date +'%Y-%m-%dT%T.%3N'" |& getline current_time;
     close("date +'%Y-%m-%d'")

     epoch_time=""


- modpost improvement

- modpost improvement

--- scripts/modpost.awk
+++ scripts/modpost.awk
@@ -2015,6 +2015,9 @@
 	    command = cat_command("/boot/System.map-" kversion ".bz2")
 	    if (command) { read_systemmap(command, "vmlinux", "kernel", "systemmap") }
 	    else {
+	    command = cat_command("/lib/modules/" kversion "/build/System.map")
+	    if (command) { read_systemmap(command, "vmlinux", "kernel", "systemmap") }
+	    else {
 	    print_error("r: systemmap, file not found") } } }
 	}
 	if (("infile" in values) && values["infile"]) {


convert edge lables from quoted strings to 'html-like' to highlight losses

--- scripts/label_dot_edge.awk
+++ scripts/label_dot_edge.awk
@@ -8,35 +8,29 @@
 #
 # Arguments: two files
 # Loads the first file as a map from  to curie to label :
- # (expects: "label": "curie",)
+ # (expects: "label": "curie:term",)
 # Reads the second Graphviz digraph dot format file:
 # looks for <term> as edge-text
-# and appends "! <label> (Iff <term> is found in map)
+# and appends "! <label> (Iff curie:term is found in the translation table)
 # note: This "<term> ! <label>" structure is a convention used by Ontologists.

 BEGIN{FS="\""; OFS="\t"}
-# load labels
+# load label->curie:term  as curie:term -> label
 FNR == NR && /^"/{label[$4]=$2}

-# output lines that do not get labels
-FNR != NR && !/.* -> .*label=.*/ {print}
+# output graphviz lines that do not get labels
+FNR != NR && ! /.* -> .* [label=<.*>];/ {print}

 # output lines w/labels if they are available
-
-FNR != NR && /.* -> .*label=.*/ {
+FNR != NR && /.* -> .* [label=<.*>];/ {
 	line="";
 	split($0, row, / /)
-
-	split(row[4], term, /"/)
+	split(row[4], term, /<>/)
 	split(term[2], lclid, ":")

-	if (term[2] in label && lclid[2] != label[term[2]]){
-		term[2] = term[2] " ! " label[term[2]];
-		row[4] = term[1];
-		for(i=2;i<=length(term);i++)
-			row[4] = row[4] "\"" term[i]
-	}
+	if (term[2] in label && lclid[2] != label[term[2]])
+		row[4] = term[1] "<" term[2] " ! " label[term[2]] ">" term[3]
 	line = row[1]
 	for(i=2;i<=length(row);i++)
 		line = line " " row[i]


Add support for dollar single quotes

Add support for dollar single quotes

This unbreaks tests/bsda_obj.sh, which silently was not performed
correctly.


Theme: update default theme

Theme: update default theme

--- include/Theme.awk
+++ include/Theme.awk
@@ -28,16 +28,20 @@
         loadOptions(script)
     } else {
         # Default theme
-        Option["sgr-original"][1] = "bold"
-        Option["sgr-original"][2] = "negative"
         Option["sgr-translation"] = "bold"
+        Option["sgr-translation-phonetics"] = "bold"
         Option["sgr-prompt-message-original"] = "underline"
+        Option["sgr-languages-sl"] = "underline"
+        Option["sgr-languages-tl"] = "bold"
+        Option["fmt-languages"] = "[ %s -> %t ]"
         Option["sgr-original-dictionary-detailed-explanation"] = "bold"
+        Option["sgr-original-dictionary-detailed-synonyms-item"] = "bold"
+        Option["sgr-original-dictionary-synonyms-synonyms-item"] = "bold"
         Option["sgr-original-dictionary-examples-original"][1] = "bold"
-        Option["sgr-original-dictionary-examples-original"][2] = "negative"
-        Option["sgr-original-dictionary-see-also-item"] = "underline"
+        Option["sgr-original-dictionary-examples-original"][2] = "underline"
+        Option["sgr-original-dictionary-see-also-phrases-item"] = "bold"
         Option["sgr-dictionary-word"] = "bold"
         Option["sgr-alternatives-original"] = "underline"
-        Option["sgr-alternatives-translation"] = "bold"
+        Option["sgr-alternatives-translations-item"] = "bold"
     }
 }


Provide the same unmarked symbold on the fr.apple layout as found on the adb map; provides all the missing symbold (such as ~ | and \) one can not really use unix without. With (again) some help from Jean-Marc Harang.

--- dev/usb/makemap.awk
+++ dev/usb/makemap.awk
@@ -1,5 +1,5 @@
 #! /usr/bin/awk -f
-#	$OpenBSD: makemap.awk,v 1.4 2005/05/19 10:40:48 miod Exp $
+#	$OpenBSD: makemap.awk,v 1.5 2005/05/19 17:49:54 miod Exp $
 #
 # Copyright (c) 2005, Miodrag Vallat
 #
@@ -31,7 +31,7 @@
 #

 BEGIN {
-	rcsid = "$OpenBSD: makemap.awk,v 1.4 2005/05/19 10:40:48 miod Exp $"
+	rcsid = "$OpenBSD: makemap.awk,v 1.5 2005/05/19 17:49:54 miod Exp $"
 	ifdepth = 0
 	ignore = 0
 	declk = 0
@@ -319,14 +319,44 @@
 		if (mapname == "ukbd_keydesc_fr[]") {
 			print $0
 			print "\nstatic const keysym_t ukbd_keydesc_fr_apple[] = {"
+			print "    KC(5),\tKS_b,\t\tKS_B,\t\tKS_ssharp,"
+			print "    KC(8),\tKS_e,\t\tKS_E,\t\tKS_ecircumflex,\tKS_Ecircumflex,"
+			print "    KC(11),\tKS_h,\t\tKS_H,\t\tKS_Igrave,\tKS_Icircumflex,"
+			print "    KC(12),\tKS_i,\t\tKS_I,\t\tKS_icircumflex,\tKS_idiaeresis,"
+			print "    KC(13),\tKS_j,\t\tKS_J,\t\tKS_Idiaeresis,\tKS_Iacute,"
+			print "    KC(14),\tKS_k,\t\tKS_K,\t\tKS_Egrave,\tKS_Ediaeresis,"
+			print "    KC(15),\tKS_l,\t\tKS_L,\t\tKS_voidSymbol,\tKS_bar,"
+			print "    KC(16),\tKS_comma,\tKS_question,\tKS_voidSymbol,\tKS_questiondown,"
+			print "    KC(17),\tKS_n,\t\tKS_N,\t\tKS_asciitilde,"
+			print "    KC(20),\tKS_a,\t\tKS_A,\t\tKS_ae,\t\tKS_AE,"
+			print "    KC(21),\tKS_r,\t\tKS_R,\t\tKS_registered,\tKS_comma,"
+			print "    KC(22),\tKS_s,\t\tKS_S,\t\tKS_Ograve,"
+			print "    KC(26),\tKS_z,\t\tKS_Z,\t\tKS_Acircumflex,\tKS_Aring,"
+			print "    KC(28),\tKS_y,\t\tKS_Y,\t\tKS_Uacute,"
+			print "    KC(31),\tKS_eacute,\tKS_2,\t\tKS_ediaeresis,"
+			print "    KC(32),\tKS_quotedbl,\tKS_3,"
+			print "    KC(33),\tKS_apostrophe,\tKS_4,"
+			print "    KC(34),\tKS_parenleft,\tKS_5,\t\tKS_braceleft,\tKS_bracketleft,"
 			print "    KC(35),\tKS_section,\tKS_6,"
+			print "    KC(36),\tKS_egrave,\tKS_7,\t\tKS_guillemotleft,"
+			print "\t\t\t\t\t\tKS_guillemotright,"
 			print "    KC(37),\tKS_exclam,\tKS_8,"
+			print "    KC(38),\tKS_ccedilla,\tKS_9,\t\tKS_Ccedilla,\tKS_Aacute,"
+			print "    KC(37),\tKS_exclam,\tKS_8,\t\tKS_exclamdown,\tKS_Ucircumflex,"
+			print "    KC(39),\tKS_agrave,\tKS_0,\t\tKS_oslash,\tKS_Ooblique,"
+			print "    KC(45),\tKS_parenright,\tKS_degree,\tKS_braceright,\tKS_bracketright,"
 			print "    KC(46),\tKS_minus,\tKS_underscore,"
-			print "    KC(48),\tKS_dollar,\tKS_asterisk,"
-			print "    KC(50),\tKS_backslash,\tKS_sterling,"
-			print "    KC(53),\tKS_at,\tKS_numbersign,"
+			print "    KC(47),\tKS_dead_circumflex, KS_dead_diaeresis,"
+			print "\t\t\t\t\t\tKS_ocircumflex,\tKS_Ocircumflex,"
+			print "    KC(48),\tKS_dollar,\tKS_asterisk,\tKS_cent,\tKS_yen,"
+			print "    KC(50),\tKS_grave,\tKS_sterling,\tKS_at,\t\tKS_numbersign,"
+			print "    KC(51),\tKS_m,\t\tKS_M,\t\tKS_mu,\t\tKS_Oacute,"
+			print "    KC(52),\tKS_ugrave,\tKS_percent,\tKS_Ugrave,"
+			print "    KC(53),\tKS_at,\t\tKS_numbersign,"
+			print "    KC(55),\tKS_colon,\tKS_slash,\tKS_voidSymbol,\tKS_backslash,"
 			print "    KC(56),\tKS_equal,\tKS_plus,"
 			print "    KC(103),\tKS_KP_Equal,"
+			print "    KC(231),\tKS_Mode_switch,\tKS_Multi_key,"
 		} else
 		if (mapname == "ukbd_keydesc_pt[]") {
 			print $0


Add AWK script to compute a range

Add AWK script to compute a range


Test 2015.

Test 2015.

--- scripts/tdb/statuses_ibict.awk
+++ scripts/tdb/statuses_ibict.awk
@@ -8,7 +8,7 @@

 {
   # add a loop to add line only if either [status is _not_ manifest] OR [journal year (or journal end year) is lt or eq to the current year we are testing]
-  current_year = 2014
+  current_year = 2015
   end_year = 0
   incontract = 0
   #test_year = ""


Ignore AUs with year lt contract date

Ignore AUs with year lt contract date

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

--- scripts/tdb/statuses_clockss.awk
+++ scripts/tdb/statuses_clockss.awk
@@ -1,5 +1,6 @@
 #!/usr/bin/awk -f
 # input: publisher\tcontract_year\tyear\tstatus
+# add a loop to add line only if first 4 char or last 4 char of year are gt or eq to contract

 BEGIN {
   FS="\t"
@@ -7,6 +8,7 @@
 }

 {
+  if (substr($3,0,4) >= $2) {
   if (!(($1,$2,$3) in b)) {
     p[pn] = $1
     t[pn] = $2
@@ -17,6 +19,7 @@
   c[$1,$2,$3,$4]++
   x[$4]++
   tt++
+}
 }

 END {
@@ -51,3 +54,4 @@
     }

 }
+


Special Montalbano page 2 processing

Special Montalbano page 2 processing

--- getMHzFrom-episodePages.awk
+++ getMHzFrom-episodePages.awk
@@ -93,7 +93,7 @@
     if (episodeURL ~ /-trailer-|-finale-/)
         episodeType = "T"
     # If episode is a BONUS:, set episodeType to "X"
-    if (episodeURL ~ /-c-x[[:digit:]]{3,4}$/)
+    if (episodeURL ~ /-c-x[[:digit:]]{3,4}$|montme-c-01001/)
         episodeType = "X"
     episodeTitle = fld[4]
     gsub (/"/,"\"\"",episodeTitle)
@@ -105,14 +105,16 @@
 }

 # Extract the episode number, and correct if necessary
+# Detective Montalbano requires special processing for page 2 episodeNumber
 /<h4 class="/ {
     sub (/.*Episode /,"")
     sub (/<\/span>.*/,"")
     episodeNumber = $0 + 0
-    if ((episodeURL ~ /-c-.[[:digit:]]{3,4}$/) && episodeNumber != episodeNumberFromURL) {
-        printf ("==> Corrected %s%02d to %s%02d: %s\n", episodeType, episodeNumber, episodeType, \
-                episodeNumberFromURL, shortURL) >> ERROR_FILE
-        episodeNumber = episodeNumberFromURL
+    if (seriesTitle == "Detective Montalbano" && page2 == "yes") {
+        oldEpisodeNumber = episodeNumber
+        episodeNumber += 24
+        printf ("==> Corrected E%02d to %s%02d: %s\n", oldEpisodeNumber, episodeType, \
+                episodeNumber, shortURL) >> ERROR_FILE
     }
     next
 }


color_funcs.awk	-- aded rgb2hsv and hsv2rgb converters

--- lib/color_funcs.awk
+++ lib/color_funcs.awk
@@ -1,4 +1,4 @@
-function init_crange(crange, colorInfo,   nf, ary, nf2, ary2, R, G, B) {
+function init_crange(crange, colorInfo,   nf, ary, nf2, ary2, R, G, B, rgb, hsv) {
 	nf = split(crange, ary, ":")
 	if(nf != 2){
 		printf("ERROR: bad color range: %s, must be r,g,b:r,g,b r,g,b in [0,1]\n", crange) > "/dev/stderr"
@@ -26,9 +26,18 @@
 		printf("ERROR: bad start B value: %s, must be r,g,b r,g,b in [0,1]\n", ary2[3]) > "/dev/stderr"
 		return 1
 	}
-	colorInfo["R_start"] = R
-	colorInfo["G_start"] = G
-	colorInfo["B_start"] = B
+	rgb["R"] = R
+	rgb["G"] = G
+	rgb["B"] = B
+	rgb2hsv(rgb, hsv)
+
+#	colorInfo["R_start"] = R
+#	colorInfo["G_start"] = G
+#	colorInfo["B_start"] = B
+
+	colorInfo["H_start"] = hsv["H"]
+	colorInfo["S_start"] = hsv["S"]
+	colorInfo["V_start"] = hsv["V"]

 	# get end color
 	nf2 = split(ary[2], ary2, ",")
@@ -51,18 +60,118 @@
 		printf("ERROR: bad end B value: %s, must be r,g,b r,g,b in [0,1]\n", ary2[3]) > "/dev/stderr"
 		return 1
 	}
-	colorInfo["R_end"] = R
-	colorInfo["G_end"] = G
-	colorInfo["B_end"] = B
+	rgb["R"] = R
+	rgb["G"] = G
+	rgb["B"] = B
+	rgb2hsv(rgb, hsv)
+
+#	colorInfo["R_end"] = R
+#	colorInfo["G_end"] = G
+#	colorInfo["B_end"] = B
+
+	colorInfo["H_end"] = hsv["H"]
+	colorInfo["S_end"] = hsv["S"]
+	colorInfo["V_end"] = hsv["V"]

 	return 0
 }
-function set_4bit_color(frac, colorInfo,    r_max_cval, R, G, B) {
+function set_4bit_color(frac, colorInfo,    r_max_cval, hsv, rgb, R, G, B) {
+
+	# RGB gradient is really not all that nice, hsv is better
+#	r_max_cval = 1.0/15
+#	R = int((frac * colorInfo["R_end"] + (1.0 - frac) * colorInfo["R_start"]) / r_max_cval)
+#	G = int((frac * colorInfo["G_end"] + (1.0 - frac) * colorInfo["G_start"]) / r_max_cval)
+#	B = int((frac * colorInfo["B_end"] + (1.0 - frac) * colorInfo["B_start"]) / r_max_cval)
+
+	hsv["H"] = frac * colorInfo["H_end"] + (1.0 - frac) * colorInfo["H_start"]
+	hsv["S"] = frac * colorInfo["S_end"] + (1.0 - frac) * colorInfo["S_start"]
+	hsv["V"] = frac * colorInfo["V_end"] + (1.0 - frac) * colorInfo["V_start"]
+	hsv2rgb(hsv, rgb)

 	r_max_cval = 1.0/15
-	R = int((frac * colorInfo["R_end"] + (1.0 - frac) * colorInfo["R_start"]) / r_max_cval)
-	G = int((frac * colorInfo["G_end"] + (1.0 - frac) * colorInfo["G_start"]) / r_max_cval)
-	B = int((frac * colorInfo["B_end"] + (1.0 - frac) * colorInfo["B_start"]) / r_max_cval)
+	R = rgb["R"] / r_max_cval
+	G = rgb["G"] / r_max_cval
+	B = rgb["B"] / r_max_cval

 	return sprintf("%x%x%x", R, G, B)
 }
+function rgb2hsv(rgb, hsv,   min, max, delta) {
+
+	min = rgb["R"] < rgb["G"] ? rgb["R"] : rgb["G"]
+	min = min      < rgb["B"] ? min      : rgb["B"]
+
+	max = rgb["R"] > rgb["G"] ? rgb["R"] : rgb["G"]
+	max = max      > rgb["B"] ? max      : rgb["B"]
+
+	hsv["V"] = max
+
+	delta = max - min
+	if(delta < 0.00001){
+		hsv["S"] = 0
+		hsv["H"] = 0
+		return
+	}
+
+	if(max > 0)
+		hsv["S"] = (delta/max)
+	else{
+		hsv["S"] = 0
+		hsv["H"] = 0	# V is 0, s H doesn't matter, so use 0
+		return
+	}
+	if(rgb["R"] >= max)
+		hsv["H"] = (rgb["G"] - rgb["B"])/delta		# between magenta & yellow
+	else if(rgb["G"] >= max)
+		hsv["H"] = 2.0 + (rgb["B"] - rgb["R"])/delta	# between yellow & cyan
+	else
+		hsv["H"] = 4.0 + (rgb["R"] - rgb["G"])/delta	# between cyan & magenta
+	hsv["H"] *= 60
+	if(hsv["H"] < 0)
+		hsv["H"] += 360
+	return
+}
+function hsv2rgb(hsv, rgb,    hh, p, q, t, ff, i) {
+
+	if(hsv["S"] <= 0){
+		rgb["R"] = hsv["V"]
+		rgb["G"] = hsv["V"]
+		rgb["B"] = hsv["V"]
+		return
+	}
+	hh = hsv["H"]
+	if(hh >= 360)
+		hh = 0
+	hh /= 60
+	i = int(hh)
+	ff = hh - i
+	p = hsv["V"] * (1.0 - hsv["S"])
+	q = hsv["V"] * (1.0 - (hsv["S"] * ff))
+	t = hsv["V"] * (1.0 - (hsv["S"] * (1 - ff)))
+
+	if(i == 0){
+		rgb["R"] = hsv["V"]
+		rgb["G"] = t
+		rgb["B"] = p
+	}else if(i == 1){
+		rgb["R"] = q
+		rgb["G"] = hsv["V"]
+		rgb["B"] = p
+	}else if(i == 2){
+		rgb["R"] = p
+		rgb["G"] = hsv["V"]
+		rgb["B"] = t
+	}else if(i == 3){
+		rgb["R"] = p
+		rgb["G"] = q
+		rgb["B"] = hsv["V"]
+	}else if(i == 4){
+		rgb["R"] = t
+		rgb["G"] = p
+		rgb["B"] = hsv["V"]
+	}else{	# must be 5
+		rgb["R"] = hsv["V"]
+		rgb["G"] = p
+		rgb["B"] = q
+	}
+	return
+}


Edit awk directory

Edit awk directory

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

 BEGIN {
   # It is not possible to define output file names here because


Update example

Update example

--- tools/awk/sample.awk
+++ tools/awk/sample.awk
@@ -15,7 +15,7 @@
 #   - sample values
 #
 # Example:
-#   $ sample 0.1 $RANDOM
+#   $ seq 1 100 | sample 0.1 $RANDOM

 BEGIN {
 	if (ARGC == 1) {


Accept 4.6.x-google

Accept 4.6.x-google

Change-Id: I4eadea9498dcb5f55bd5cc025d2866b39b486cc3

--- solenv/bin/getcompver.awk
+++ solenv/bin/getcompver.awk
@@ -68,6 +68,15 @@
         CCversion = substr($0, 0, index($0, "-") - 1)
     }
 }
+# NDK r8b has "4.6.x-google"
+/^[0-9]*[.][0-9]*[.][a-z]*-[0-9a-z]*$/ {
+    if ( compiler_matched == 0 ) {
+	# Include the second period in the match so that
+	# we will get a micro version of zero
+	x = match(  $0, /^[0-9]*[.][0-9]*[.]/ )
+        CCversion = substr($0, RSTART, RLENGTH)
+    }
+}
 END {
     if ( num == "true" ) {
         tokencount = split (CCversion,vertoken,".")


In c1, use season number in episodeTitle

--- getBBoxEpisodesFrom-webscraper.awk
+++ getBBoxEpisodesFrom-webscraper.awk
@@ -41,6 +41,11 @@
     Description = $10
     showtype = "S"

+    if (match (episodeTitle, /^Season [[:digit:]]+|^Series [[:digit:]]+/))
+        episodeSeason = substr(episodeTitle,8,RLENGTH-7)
+    else
+        episodeSeason = ""
+
     # Extract sortkey from URL
     nflds = split (URL,fld,"_")
     if (URL ~ /_S[[:digit:]]*_E[[:digit:]]*_[[:digit:]]*$/) {
@@ -48,6 +53,15 @@
         # Season 3, Episode 8
         seasonNumber = substr(fld[nflds-2], 2)
         episodeNumber = substr(fld[nflds-1], 2)
+        # Give precedence to season number in episodeTitle over season number in URL
+        if (episodeSeason != "" && seasonNumber+0 != episodeSeason+0) {
+            revisedSeasons1 += 1
+            shortURL = URL
+            sub (/^\/us\/episode\//,"",shortURL)
+            printf ("==> Fixed c1 season: %02d-%02d\t%s\t%s\n", \
+                    seasonNumber, episodeSeason, shortURL, episodeTitle) >> ERROR_FILE
+            seasonNumber = episodeSeason
+        }
         sortkey = sprintf ("%s%02dE%03d", showtype, seasonNumber, episodeNumber)
         c1Num += 1
         outfile = "BBox-scrapes/c1-" longdate ".csv"
@@ -55,27 +69,30 @@
     } else if (URL ~ /_E[[:digit:]]*_[[:digit:]]*$/) {
         # /us/episode/35_Hours_E1_26129
         # 35 Hours, Episode 1
+        revisedSeasons2 += 1
         seasonNumber = "99"
         episodeNumber = substr(fld[nflds-1], 2)
         sortkey = sprintf ("%s%02dE%03d", showtype, seasonNumber, episodeNumber)
-        c2Num += 2
+        c2Num += 1
         outfile = "BBox-scrapes/c2-" longdate ".csv"
         printf ("c2\t%d\t%s\t%s\t%s\t%s\t%s\n",c2Num,sortkey,URL,showTitle,episodeTitle,Years) >> outfile
     } else if (URL ~ /Episode_[[:digit:]]*_[[:digit:]]*$/) {
         # /us/episode/Episode_5_26089
         # Season 4, Episode 5
+        revisedSeasons3 += 1
         seasonNumber = "98"
         episodeNumber = substr(fld[nflds-1], 1)
         sortkey = sprintf ("%s%02dE%03d", showtype, seasonNumber, episodeNumber)
-        c3Num += 3
+        c3Num += 1
         outfile = "BBox-scrapes/c3-" longdate ".csv"
         printf ("c3\t%d\t%s\t%s\t%s\t%s\t%s\n",c3Num,sortkey,URL,showTitle,episodeTitle,Years) >> outfile
     } else {
+        revisedSeasons4 += 1
         URL ~ /^\/us\/movie\// ? showtype = "M" : showtype = "E"
         # /us/episode/Orkneys_Stone_Age_Temple_7144
         # A History of Ancient Britain Special, Orkney's Stone Age Temple
         sortkey = sprintf ("%s%05d", showtype, fld[nflds])
-        c4Num += 4
+        c4Num += 1
         outfile = "BBox-scrapes/c4-" longdate ".csv"
         printf ("c4\t%d\t%s\t%s\t%s\t%s\t%s\n",c4Num,sortkey,URL,showTitle,episodeTitle,Years) >> outfile
     }
@@ -168,6 +185,22 @@
         revisedTitles == 1 ? field = "title" : field = "titles"
         printf ("    %2d %s revised in %s\n", revisedTitles, field, FILENAME) > "/dev/stderr"
     }
+    if (revisedSeasons1 > 0 ) {
+        revisedSeasons1 == 1 ? field = "season" : field = "seasons"
+        printf ("    %3d c1 %s revised in %s\n", revisedSeasons1, field, FILENAME) > "/dev/stderr"
+    }
+    if (revisedSeasons2 > 0 ) {
+        revisedSeasons2 == 1 ? field = "season" : field = "seasons"
+        printf ("    %3d c2 %s revised in %s\n", revisedSeasons2, field, FILENAME) > "/dev/stderr"
+    }
+    if (revisedSeasons3 > 0 ) {
+        revisedSeasons3 == 1 ? field = "season" : field = "seasons"
+        printf ("    %3d c3 %s revised in %s\n", revisedSeasons3, field, FILENAME) > "/dev/stderr"
+    }
+    if (revisedSeasons4 > 0 ) {
+        revisedSeasons4 == 1 ? field = "season" : field = "seasons"
+        printf ("    %3d c4 %s revised in %s\n", revisedSeasons4, field, FILENAME) > "/dev/stderr"
+    }
     if (badEpisodes > 0 ) {
         badEpisodes == 1 ? field = "URL" : field = "URLs"
         printf ("    %2d extra /show/ %s in %s\n", badEpisodes, field, FILENAME) > "/dev/stderr"


Switch minutes to HMS

Switch minutes to HMS

--- getBritBoxFrom-scrapy_xml.awk
+++ getBritBoxFrom-scrapy_xml.awk
@@ -29,11 +29,16 @@
     episodeRating = $23
     episodeDescription = $27

-    nfields = split (URL,fld,"_")
-    seasonNumber = fld[nfields - 2]
+    nflds = split (URL,fld,"_")
+    seasonNumber = fld[nflds - 2]
     sub (/S/,"",seasonNumber)
-    episodeNumber = fld[nfields - 1]
+    episodeNumber = fld[nflds - 1]
     sub (/E/,"",episodeNumber)
+
+    secs = 0
+    mins = episodeDuration % 60
+    hrs = int(episodeDuration / 60)
+    episode_HMS = sprintf ("%02d:%02d:%02d", hrs, mins, secs)

     # Get rid of perfunctory "Season <n>, " from episode title
     episodePrefix = "Season " seasonNumber ", "
@@ -43,7 +48,7 @@
         printf \
             ("%s S%02dE%02d\t=HYPERLINK(\"https://www.britbox.com%s\";\"%s, S%02dE%02d, %s\"\)\t\t%s\t%s\t%s\t%s\n", \
              showTitle, seasonNumber, episodeNumber, URL, showTitle, seasonNumber, episodeNumber, \
-             episodeTitle, episodeDuration, episodeYear, episodeRating, episodeDescription)
+             episodeTitle, episode_HMS, episodeYear, episodeRating, episodeDescription)
     }
 }


Languages: add Luganda

Languages: add Luganda

--- include/Languages.awk
+++ include/Languages.awk
@@ -943,6 +943,20 @@
     Locale["lt"]["iso"]                = "lit"
     Locale["lt"]["glotto"]             = "lith1251"
     Locale["lt"]["script"]             = "Latn"
+
+    # Luganda
+    Locale["lg"]["name"]               = "Luganda"
+    Locale["lg"]["endonym"]            = "Luganda"
+    Locale["lg"]["endonym2"]           = "Oluganda"
+    #Locale["lg"]["translations-of"]
+    #Locale["lg"]["definitions-of"]
+    #Locale["lg"]["synonyms"]
+    #Locale["lg"]["examples"]
+    #Locale["lg"]["see-also"]
+    Locale["lg"]["family"]             = "Atlantic-Congo"
+    Locale["lg"]["iso"]                = "lug"
+    Locale["lg"]["glotto"]             = "gand1255"
+    Locale["lg"]["script"]             = "Latn"

     #57 Luxembourgish
     Locale["lb"]["name"]               = "Luxembourgish"


Languages: add Aymara

Languages: add Aymara

--- include/Languages.awk
+++ include/Languages.awk
@@ -92,6 +92,19 @@
     Locale["as"]["iso"]                = "asm"
     Locale["as"]["glotto"]             = "assa1263"
     Locale["as"]["script"]             = "Beng"
+
+    # Aymara
+    Locale["ay"]["name"]               = "Aymara"
+    Locale["ay"]["endonym"]            = "Aymar aru"
+    #Locale["ay"]["translations-of"]
+    #Locale["ay"]["definitions-of"]
+    #Locale["ay"]["synonyms"]
+    #Locale["ay"]["examples"]
+    #Locale["ay"]["see-also"]
+    Locale["ay"]["family"]             = "Aymaran"
+    Locale["ay"]["iso"]                = "aym"
+    Locale["ay"]["glotto"]             = "nucl1667"
+    Locale["ay"]["script"]             = "Latn"

     #6 Azerbaijani (North Azerbaijani)
     Locale["az"]["name"]               = "Azerbaijani"


- add internal support for alpha channel in HSV colors - save both rgba and hsva color values in colortbl.h  - share 'a' value - only "transparent" has an "a" value of 0  - couold be others one day - -Tps generator does binary test on "a" value of color - skip rendering if "transparent"

--- awk/brewer.awk
+++ awk/brewer.awk
@@ -12,9 +12,10 @@
 # *              AT&T Research, Florham Park NJ             *
 # **********************************************************/
 #
-# Convert Brewer data to same RGB format used in color_names.
+# Convert Brewer data to same RGBA format used in color_names.
 # See brewer_colors for input format.
 #
+# All colors assumed opaque, so A = 255 in all colors
 BEGIN {
   FS = ","
 }
@@ -23,5 +24,5 @@
     name = $1 $2;
     gsub ("\"","",name);
   }
-  printf ("/%s/%s %s %s %s\n", name, $5, $7, $8, $9);
+  printf ("/%s/%s %s %s %s 255\n", name, $5, $7, $8, $9);
 }


handle cpu m

handle cpu m

--- k8s/ihatekubeformating-simpler.awk
+++ k8s/ihatekubeformating-simpler.awk
@@ -58,6 +58,8 @@
   } else if (b_unit == "k") {
     if (a_unit == "")
       return a / 1000
+    if (a_unit == "m")
+      return a / 1000 / 1000
     print "unknown a unit: " a  a_unit " for b " b b_unit
     exit 1
   }


Change default dichotomic time limit from 3s to 5s.

--- fzn/fzn2py.awk
+++ fzn/fzn2py.awk
@@ -338,7 +338,7 @@
 	print "start_time = datetime.datetime.now()\n\n";
 	print "if __name__ == '__main__':";
 	print "    solvers = ['Mistral', 'SCIP', 'MiniSat', 'Toulbar2', 'Gurobi']";
-	print "    default = dict([('solver', 'Mistral'), ('verbose', 0), ('tcutoff', 900), ('var', 'DomainOverWDegree'), ('val', 'Lex'), ('rand', 2), ('threads', 1), ('restart', GEOMETRIC), ('base', 256), ('factor', 1.3), ('lcLevel', 4), ('lds', 0), ('dee',0), ('btd',0), ('rds',0), ('dichotomic', 0), ('dichtcutoff', 3)])";
+	print "    default = dict([('solver', 'Mistral'), ('verbose', 0), ('tcutoff', 900), ('var', 'DomainOverWDegree'), ('val', 'Lex'), ('rand', 2), ('threads', 1), ('restart', GEOMETRIC), ('base', 256), ('factor', 1.3), ('lcLevel', 4), ('lds', 0), ('dee',0), ('btd',0), ('rds',0), ('dichotomic', 0), ('dichtcutoff', 5)])";
 	print "    param = input(default)";
 	if(objective){
 		print "    if param['dichotomic'] == 1:";


Deal with prequels (Doc Martin)

Deal with prequels (Doc Martin)

--- getAcornFrom-seriesPages.awk
+++ getAcornFrom-seriesPages.awk
@@ -68,11 +68,6 @@
 #  OUTPUT:
 #       $EPISODE_INFO_FILE
 #
-
-# Extract and save whether this is a miniseries
-/
Miniseries:/ || /
Mini Series:/ {
-    showType = "M"
-}

 # Extract the series title
 /<title>/ {
@@ -220,9 +215,18 @@

 # Extract episode number
 /
.*span itemprop="episodeNumber">/ {
+    # If show is a Prequel, use "P"
+    if (episodeURL ~ /\/prequel/)
+        showType = "P"
+    # If show is a Miniseries, use "M"
+    if (episodeURL ~ /\/miniseries/)
+        showType = "M"
     # If we don't know what kind of show it is, use "S"
     if (showType == "")
         showType = "S"
+    # Default episodeType to "E"
+    episodeType = "E"
+    #
     split ($0,fld,"[<>]")
     episodeNumber = fld[5]
     # Feature films don't have episodes
@@ -244,9 +248,10 @@
             seasonNumber = URLseasonNumber
         }
     }
-    printf ("%d\t=HYPERLINK(\"%s\";\"%s, %s%02dE%02d, %s\"\)\t\t\t%s\n", \
-        SERIES_NUMBER, episodeURL, seriesTitle, showType, seasonNumber, episodeNumber, \
+    printf ("%d\t=HYPERLINK(\"%s\";\"%s, %s%02d%s%02d, %s\"\)\t\t\t%s\n", \
+        SERIES_NUMBER, episodeURL, seriesTitle, showType, seasonNumber, episodeType, episodeNumber, \
         episodeTitle, episodeDuration) >> EPISODE_INFO_FILE
+    showType = ""
     next
 }

@@ -265,7 +270,6 @@
     seriesHrs = 0
     seriesDuration = ""
     #
-    showType = ""
     SERIES_NUMBER += 1
 }


Languages: add Scottish Gaelic language

Languages: add Scottish Gaelic language

--- include/Languages.awk
+++ include/Languages.awk
@@ -288,6 +288,19 @@
     Locale["sm"]["iso"]                = "smo"
     Locale["sm"]["glotto"]             = "samo1305"
     Locale["sm"]["script"]             = "Latn"
+
+    #? Scottish Gaelic
+    Locale["gd"]["name"]               = "Scottish Gaelic"
+    Locale["gd"]["endonym"]            = "Gàidhlig"
+    #Locale["gd"]["translations-of"]
+    #Locale["gd"]["definitions-of"]
+    #Locale["gd"]["synonyms"]
+    #Locale["gd"]["examples"]
+    #Locale["gd"]["see-also"]
+    Locale["gd"]["family"]             = "Indo-European"
+    Locale["gd"]["iso"]                = "gla"
+    Locale["gd"]["glotto"]             = "scot1245"
+    Locale["gd"]["script"]             = "Latn"

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


Languages: mark as stable: Sindhi

Languages: mark as stable: Sindhi

--- include/Languages.awk
+++ include/Languages.awk
@@ -276,15 +276,14 @@
     Locale["rm"]["glotto"]             = "roma1326"
     Locale["rm"]["script"]             = "Latn"

-    #? Sindhi
-    Locale["sd"]["support"]            = "unstable"
+    # Sindhi
     Locale["sd"]["name"]               = "Sindhi"
     Locale["sd"]["endonym"]            = "سنڌي"
-    #Locale["sd"]["translations-of"]
-    #Locale["sd"]["definitions-of"]
-    #Locale["sd"]["synonyms"]
-    #Locale["sd"]["examples"]
-    #Locale["sd"]["see-also"]
+    Locale["sd"]["translations-of"]    = "%s جو ترجمو"
+    Locale["sd"]["definitions-of"]     = "%s جون وصفون"
+    Locale["sd"]["synonyms"]           = "هم معني"
+    Locale["sd"]["examples"]           = "مثالون"
+    Locale["sd"]["see-also"]           = "به ڏسو"
     Locale["sd"]["family"]             = "Indo-European"
     Locale["sd"]["iso"]                = "snd"
     Locale["sd"]["glotto"]             = "sind1272"


Languages: mark as stable: Amharic

Languages: mark as stable: Amharic

--- include/Languages.awk
+++ include/Languages.awk
@@ -14,15 +14,14 @@
 #      <http://glottolog.org/>
 function initLocale(    i) {

-    #? Amharic
-    Locale["am"]["support"]            = "unstable"
+    # Amharic
     Locale["am"]["name"]               = "Amharic"
     Locale["am"]["endonym"]            = "አማርኛ"
-    #Locale["am"]["translations-of"]
-    #Locale["am"]["definitions-of"]
-    #Locale["am"]["synonyms"]
-    #Locale["am"]["examples"]
-    #Locale["am"]["see-also"]
+    Locale["am"]["translations-of"]    = "የ %s ትርጉሞች"
+    Locale["am"]["definitions-of"]     = "የ %s ቃላት ፍችዎች"
+    Locale["am"]["synonyms"]           = "ተመሳሳይ ቃላት"
+    Locale["am"]["examples"]           = "ምሳሌዎች"
+    Locale["am"]["see-also"]           = "የሚከተለውንም ይመልከቱ"
     Locale["am"]["family"]             = "Afro-Asiatic"
     Locale["am"]["iso"]                = "amh"
     Locale["am"]["glotto"]             = "amha1245"


Close pipeline.

Close pipeline.


Ignore ceph packages in patching

Ignore ceph packages in patching

Blacklist for ceph packages should be considered as a workaround.
We should create a solution for pre-moderated whitelist of approved
packages for patching.

Change-Id: I05ff7eb67efc9e6bbf3813c4ef8ce0774d766112
Closes-Bug: #1363983

--- iso/pkg-versions.awk
+++ iso/pkg-versions.awk
@@ -4,8 +4,66 @@
 # Usage:
 #   rpm -qi -p /path/to/repo/Packages/*.rpm | versions.awk > centos-versions.yaml
 #   cat /path/to/repo/dists/precise/main/binary-amd64/Packages | versions.awk > ubuntu-version.yaml
+BEGIN{
+  rpm_blacklist["ceph"] = 1
+  rpm_blacklist["ceph-debuginfo"] = 1
+  rpm_blacklist["ceph-deploy"] = 1
+  rpm_blacklist["ceph-devel"] = 1
+  rpm_blacklist["ceph-fuse"] = 1
+  rpm_blacklist["ceph-radosgw"] = 1
+  rpm_blacklist["ceph-test"] = 1
+  rpm_blacklist["cephfs-java"] = 1
+  rpm_blacklist["libcephfs1"] = 1
+  rpm_blacklist["libcephfs_jni1"] = 1
+  rpm_blacklist["librados2"] = 1
+  rpm_blacklist["librbd1"] = 1
+  rpm_blacklist["python-ceph"] = 1
+  rpm_blacklist["rbd-fuse"] = 1
+  rpm_blacklist["rest-bench"] = 1
+
+  deb_blacklist["ceph"] = 1
+  deb_blacklist["ceph-common"] = 1
+  deb_blacklist["ceph-common-dbg"] = 1
+  deb_blacklist["ceph-dbg"] = 1
+  deb_blacklist["ceph-deploy"] = 1
+  deb_blacklist["ceph-fs-common"] = 1
+  deb_blacklist["ceph-fs-common-dbg"] = 1
+  deb_blacklist["ceph-fuse"] = 1
+  deb_blacklist["ceph-fuse-dbg"] = 1
+  deb_blacklist["ceph-mds"] = 1
+  deb_blacklist["ceph-mds-dbg"] = 1
+  deb_blacklist["ceph-resource-agents"] = 1
+  deb_blacklist["ceph-test"] = 1
+  deb_blacklist["ceph-test-dbg"] = 1
+  deb_blacklist["libcephfs-dev"] = 1
+  deb_blacklist["libcephfs-java"] = 1
+  deb_blacklist["libcephfs-jni"] = 1
+  deb_blacklist["libcephfs1"] = 1
+  deb_blacklist["libcephfs1-dbg"] = 1
+  deb_blacklist["librados-dev"] = 1
+  deb_blacklist["librados2"] = 1
+  deb_blacklist["librados2-dbg"] = 1
+  deb_blacklist["librbd-dev"] = 1
+  deb_blacklist["librbd1"] = 1
+  deb_blacklist["librbd1-dbg"] = 1
+  deb_blacklist["python-ceph"] = 1
+  deb_blacklist["radosgw"] = 1
+  deb_blacklist["radosgw-dbg"] = 1
+  deb_blacklist["rbd-fuse"] = 1
+  deb_blacklist["rbd-fuse-dbg"] = 1
+  deb_blacklist["rest-bench"] = 1
+  deb_blacklist["rest-bench-dbg"] = 1
+}
 /^Name /{ name=$3}
 /^Version /{ version=$3}
-/^Release /{ print name ": \"" version "-" $3 "\""}
+/^Release /{
+  if (name in rpm_blacklist == 0) {
+    print name ": \"" version "-" $3 "\""
+  }
+}
 /^Package:/{ name=$2 }
-/^Version:/{ print name ": \"" $2 "\""}
+/^Version:/{
+  if (name in deb_blacklist == 0) {
+    print name ": \"" $2 "\""
+  }
+}


Languages: minor fix

Languages: minor fix

--- include/Languages.awk
+++ include/Languages.awk
@@ -1569,7 +1569,7 @@
     Locale["th"]["synonyms"]           = "คำพ้องความหมาย"
     Locale["th"]["examples"]           = "ตัวอย่าง"
     Locale["th"]["see-also"]           = "ดูเพิ่มเติม"
-    Locale["th"]["family"]             = "Tai–Kadai"
+    Locale["th"]["family"]             = "Tai-Kadai"
     Locale["th"]["iso"]                = "tha"
     Locale["th"]["glotto"]             = "thai1261"
     Locale["th"]["script"]             = "Thai"


Translate: do not trust redirecting location from an HTTP response

--- include/Translate.awk
+++ include/Translate.awk
@@ -175,8 +175,10 @@
         e("[ERROR] 404 Not Found")
         exit 1
     }
-    if ((status == "301" || status == "302") && location)
-        content = curlPost(location, reqBody)
+    if ((status == "301" || status == "302") && location) {
+        url = "https" substr(url, 5) # switch to HTTPS; don't use location!
+        content = curlPost(url, reqBody)
+    }

     return content
 }


Rmove unused make-rules.awk.

Rmove unused make-rules.awk.

--- make-rules.awk
+++ make-rules.awk
@@ -1,9 +0,0 @@
-#!/usr/bin/awk -f
-
-# ST_OBJS-$(CONFIG_ST_AMD64_PMC) += st_amd64_pmc.o
-# ST_FLAGS-$(CONFIG_ST_AMD64_PMC) += -DCONFIG_ST_AMD64_PMC=1
-
-{
-  printf "ST_OBJS_$(CONFIG_ST_%s) += st_%s.o\n", $1, tolower($1);
-  printf "ST_FLAGS_$(CONFIG_ST_%s) += -DCONFIG_ST_%s=1\n", $1, $1;
-}


Add support for TypeScript files

Add support for TypeScript files

--- tools/git/scripts/annotate_file_type.awk
+++ tools/git/scripts/annotate_file_type.awk
@@ -152,6 +152,10 @@
 	print "SVG" OFS $1 OFS $2
 	next
 }
+/\.ts$/ {
+	print "TypeScript" OFS $1 OFS $2
+	next
+}
 /\.txt$/ {
 	print "plaintext" OFS $1 OFS $2
 	next


Suppress trailing comma.

Suppress trailing comma.

--- genconfigdefs.awk
+++ genconfigdefs.awk
@@ -1,12 +1,16 @@
 BEGIN	{
 	print "/* file generated from $(srcdir)/config.table, do not edit! */\n";
-	print "enum {"
+	print "enum {";
 	}

 	{
-	print $2 ",";
+	    if (p) {
+		print p ",";
+		p="";
+	    }
+	    p = $2
 	}

 END	{
-	print "};"
+	print p "};"
 	}


Translators/DeepLTranslator: update API server hostname, fix #237

--- include/Translators/DeepLTranslator.awk
+++ include/Translators/DeepLTranslator.awk
@@ -7,7 +7,7 @@

 function deeplInit() {
     HttpProtocol = "http://"
-    HttpHost = "www.deepl.com"
+    HttpHost = "www2.deepl.com"
     HttpPort = 80
 }

@@ -35,7 +35,7 @@
     data = data "\"target_lang\":\"" tl "\"},"
     data = data "\"priority\":1},\"id\":1}"
     l(data)
-    url = "https://www.deepl.com/jsonrpc"
+    url = "https://www2.deepl.com/jsonrpc"
     content = curlPost(url, data)
     return assert(content, "[ERROR] Null response.")
 }


Proper table name extraction

Proper table name extraction

--- sql/where_clause.awk
+++ sql/where_clause.awk
@@ -12,14 +12,14 @@
 }
 !comment && tolower(table) == tolower(desired) {
 	if (!sql) {
-		split($0, parts, /A2_/);
-		sql = substr(parts[2], length(table) + 1);
+		sql = substr($0, index($0, "A2_" table) + length("A2_" table) + 1);
 	} else {
 		sql = sql $0;
 	}
 }
 /\;$/ && sql {
 	table = "";
+	gsub(/[[:space:]\r\n;]+/, " ", sql);
 	print sql;
 	sql = 0;
 }


added frbr to default template generation.

--- bin/util/header2params2.awk
+++ bin/util/header2params2.awk
@@ -59,6 +59,7 @@
       print "@prefix con:           <http://www.w3.org/2000/10/swap/pim/contact#> ."
       print "@prefix muo:           <http://purl.oclc.org/NET/muo/muo#> ."
       print "@prefix vs:            <http://www.w3.org/2003/06/sw-vocab-status/ns#> ."
+      print "@prefix frbr:          <http://purl.org/vocab/frbr/core#> ."
       print "@prefix dgtwc:         <http://data-gov.tw.rpi.edu/2009/data-gov-twc.rdf#> ."
    }
    print "@prefix dcterms:       <http://purl.org/dc/terms/> ."


spelling

spelling

--- dev/usb/devlist2h.awk
+++ dev/usb/devlist2h.awk
@@ -1,6 +1,5 @@
 #! /usr/bin/awk -f
-#	$OpenBSD: devlist2h.awk,v 1.2 1999/08/29 10:35:35 fgsch Exp $
-#	$NetBSD: devlist2h.awk,v 1.7 1999/08/28 10:01:42 augustss Exp $
+#	$NetBSD: devlist2h.awk,v 1.8 1999/11/18 23:32:25 augustss Exp $
 #
 # Copyright (c) 1995, 1996 Christopher G. Demetriou
 # All rights reserved.
@@ -64,7 +63,7 @@
 	else
 		printf("/* ??? */\n\n") > hfile
 	printf("/*\n") > hfile
-	printf(" * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.\n") \
+	printf(" * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.\n") \
 	    > hfile
 	printf(" *\n") > hfile
 	printf(" * generated from:\n") > hfile


Add genre, rating, description

Add genre, rating, description

--- getBBoxCatalogFrom-sitemap.awk
+++ getBBoxCatalogFrom-sitemap.awk
@@ -2,7 +2,8 @@

 BEGIN {
     # Print header
-    printf ("contentType\tcontentId\tpubDate\ttitle\tEntityId\n")
+    printf ("contentType\tcontentId\tpubDate\ttitle\tEntityId\t")
+    printf ("genre\trating\tdescription\n")
 }

 # Don't process credits
@@ -33,6 +34,9 @@
     pubDate = ""
     title = ""
     EntityId = ""
+    genre = ""
+    rating = ""
+    description = ""
 }

 # Grab pubDate
@@ -44,12 +48,37 @@
     sub (/Z/,"",pubDate)
     # print "pubDate = " pubDate
 }
+
 # Grab title
 # <title locale="en-US">Frequent Flyers</title>
 /<title locale="en-US">/ {
     split ($0,fld,"[<>]")
     title = fld[3]
     # print "title = " title
+}
+
+# Grab genre
+# <genre>drama</genre>
+/<genre>/ {
+    split ($0,fld,"[<>]")
+    genre = fld[3]
+    # print "genre = " genre
+}
+
+# Grab description
+# <description>Set in the beautiful Yorkshire Dales, ...word.</description>
+/<description>/ {
+    split ($0,fld,"[<>]")
+    description = fld[3]
+    # print "description = " description
+}
+
+# Grab rating
+# <rating systemCode="us-tv">TV-PG</rating>
+/<rating systemCode=/ {
+    split ($0,fld,"[<>]")
+    rating = fld[3]
+    # print "rating = " rating
 }

 # Grab EntityId from artwork
@@ -72,7 +101,8 @@
         EntityId = "_23842"
         # print "EntityId = " EntityId
     }
-    printf ("%s\t%s\t%s\t%s\t%s\n", contentType, contentId, pubDate, title, EntityId)
+    printf ("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", contentType, contentId, pubDate, title, EntityId, \
+            genre, rating, description)
 }

 # <artwork url="https://us.britbox.com/isl/api/v1/dataservice/ResizeImage/$value?Format='jpg'&Quality=45&ImageId='176236'&EntityType='Item'&EntityId='16103'&Width=1920&Height=1080&ResizeAction='fit'" type="tile_artwork" />


Remove trimming of labels

Remove trimming of labels

It is probably obsolete, certainly the output is the same without it
for the existing labels.

--- doxy/githublabels.awk
+++ doxy/githublabels.awk
@@ -37,8 +37,6 @@
 	id = tolower(line)
 	gsub(/[^- \t_a-z0-9]/, "", id) # remove undesired characters
 	gsub(/[ \t]/, "-", id)         # replace white space with _
-	gsub(/^-*/, "", id)            # trim front
-	gsub(/-*$/, "", id)            # trim back
 	line = line " {#" prefix id "}"
 }


Languages: fix ins()

Languages: fix ins()

--- include/Languages.awk
+++ include/Languages.awk
@@ -1320,11 +1320,11 @@
 # Parameters:
 #     code: ignore to apply bidirectional algorithm on every string
 function show(text, code,    temp) {
-    if (!code || Locale[getCode(code)]["rtl"]) {
+    if (!code || isRTL(code)) {
         if (Cache[text][0])
             return Cache[text][0]
         else {
-            if (FriBidi || (code && Locale[getCode(code)]["rtl"]))
+            if (FriBidi || (code && isRTL(code)))
                 ("echo " parameterize(text) " | " BiDiNoPad) | getline temp
             else # non-RTL language, or FriBidi not installed
                 temp = text
@@ -1339,12 +1339,12 @@
 #     code: ignore to apply bidirectional algorithm on every string
 #     width: ignore to use default width for padding
 function s(text, code, width,    temp) {
-    if (!code || Locale[getCode(code)]["rtl"]) {
+    if (!code || isRTL(code)) {
         if (!width) width = Option["width"]
         if (Cache[text][width])
             return Cache[text][width]
         else {
-            if (FriBidi || (code && Locale[getCode(code)]["rtl"]))
+            if (FriBidi || (code && isRTL(code)))
                 ("echo " parameterize(text) " | " sprintf(BiDi, width)) | getline temp
             else # non-RTL language, or FriBidi not installed
                 temp = text
@@ -1360,9 +1360,9 @@
 #     code: ignore to apply left indentation
 #     width: ignore to use default width for padding
 function ins(level, text, code, width,    i, temp) {
-    if (code && Locale[getCode(code)]["rtl"]) {
+    if (code && isRTL(code)) {
         if (!width) width = Option["width"]
-        return s(text, code, width - level * length(I))
+        return s(text, code, width - Option["indent"] * level)
     } else
         return replicate(" ", Option["indent"] * level) text
 }


- This should not be "unsigned".

- This should not be "unsigned".

git-svn-id: 74e0a9e6c5d9c3e57f79acf98f28a92415314dbb@290 76bb4867-1e22-0410-9289-e9e6e9b3b6f2

--- filters/mk_sb_tbl.awk
+++ filters/mk_sb_tbl.awk
@@ -46,7 +46,7 @@
 		print "#ifndef " IFNDEF_NAME
 	}

-	print "static const unsigned int " TABLE_NAME "[] = {"
+	print "static const int " TABLE_NAME "[] = {"
 	i = 160;
 	for (;;) {
 		printf("\t0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x", tbl[i++], tbl[i++], tbl[i++], tbl[i++], tbl[i++], tbl[i++], tbl[i++], tbl[i++]);


Translators/BingTranslator: trivial

Translators/BingTranslator: trivial

--- include/Translators/BingTranslator.awk
+++ include/Translators/BingTranslator.awk
@@ -76,7 +76,7 @@

     # Automatic ISO country code
     if (country) tl = tl "-" country
-    else if (tl == "ar") tl = tl "-EG" # FIXME: sometimes doesn't work. Why?
+    else if (tl == "ar") tl = tl "-EG" # sometimes doesn't work. Why?
     else if (tl == "da") tl = tl "-DK"
     else if (tl == "de") tl = tl "-DE"
     else if (tl == "en") tl = tl "-US"
@@ -200,7 +200,7 @@
     # Hot-patches for Bing's own translator language codes
     # See: <https://msdn.microsoft.com/en-us/library/hh456380.aspx>
     if (_sl == "auto")  _sl = "auto-detect"
-    if (_sl == "bs")    _sl = "bs-Latn" # 'bs' is not recognized as valid code  # FIXME
+    if (_sl == "bs")    _sl = "bs-Latn" # 'bs' is not recognized as valid code
     if (_sl == "zh-CN") _sl = "zh-Hans"
     if (_sl == "zh-TW") _sl = "zh-Hant"
     if (_tl == "bs")    _tl = "bs-Latn"


the_t world_t would_t be_t a_t better_t place_t if_t some_t people_t did_t not_t feel_t the_t need_t to_t typedef_t everything_t

--- dev/usb/devlist2h.awk
+++ dev/usb/devlist2h.awk
@@ -1,5 +1,5 @@
 #! /usr/bin/awk -f
-#	$OpenBSD: devlist2h.awk,v 1.9 2007/02/28 22:30:55 deraadt Exp $
+#	$OpenBSD: devlist2h.awk,v 1.10 2007/02/28 22:51:07 deraadt Exp $
 #	$NetBSD: devlist2h.awk,v 1.9 2001/01/18 20:28:22 jdolecek Exp $
 #
 # Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -175,21 +175,18 @@

 	printf("\n") > dfile

-	printf("typedef u_int16_t usb_vendor_id_t;\n") > dfile
-	printf("typedef u_int16_t usb_product_id_t;\n\n") > dfile
-
 	printf("/*\n") > dfile
 	printf(" * Descriptions of known vendors and devices (\"products\").\n") > dfile
 	printf(" */\n") > dfile
 	printf("struct usb_known_vendor {\n") > dfile
-	printf("	usb_vendor_id_t		vendor;\n") > dfile
-	printf("	char			*vendorname;\n") > dfile
+	printf("	u_int16_t	vendor;\n") > dfile
+	printf("	char		*vendorname;\n") > dfile
 	printf("};\n\n") > dfile

 	printf("struct usb_known_product {\n") > dfile
-	printf("	usb_vendor_id_t		vendor;\n") > dfile
-	printf("	usb_product_id_t	product;\n") > dfile
-	printf("	char			*productname;\n") > dfile
+	printf("	u_int16_t	vendor;\n") > dfile
+	printf("	u_int16_t	product;\n") > dfile
+	printf("	char		*productname;\n") > dfile
 	printf("};\n\n") > dfile
 	printf("const struct usb_known_product usb_known_products[] = {\n") \
 	    > dfile


Parser script displays compiler warnings

--- scripts/parse-test.awk
+++ scripts/parse-test.awk
@@ -60,6 +60,11 @@
     GREY     = "\033[0;37m"
     WHITE    = "\033[1;37m"
     RESET    = "\033[0m"
+}
+
+# detect compiler warnings
+$0~/^WARNING:/ {
+    printf("\n%s%s\n", LRED, $0)
 }

 # detect package declarations


fix csv by stripping double-quotes from committer names

--- src/log-massage.awk
+++ src/log-massage.awk
@@ -86,7 +86,9 @@
 	ndeletions = $2
 	file = $0
 	sub(/^[0-9]+[ 	]+[0-9]+[ 	]+/, "", file)	# easier this way because the filename might contain spaces
+
 	gsub(/"/, "'", file)
+	gsub(/"/, "'", author)

 	if(ninsertions > 0 || ndeletions > 0) {
 		printf("\"%s\",%d,%d,\"%s\",\"%s\",\"%s\"\n",


Languages: add 3 more Austronesian languages (Bing only)

--- include/Languages.awk
+++ include/Languages.awk
@@ -1407,6 +1407,15 @@
     Locale["yue"]["glotto"]            = "cant1236"
     Locale["yue"]["script"]            = "Hant"

+    #* Fijian
+    Locale["fj"]["support"]           = "bing-only"
+    Locale["fj"]["name"]              = "Fijian"
+    Locale["fj"]["endonym"]           = "Vosa Vakaviti"
+    Locale["fj"]["family"]            = "Austronesian"
+    Locale["fj"]["iso"]               = "fij"
+    Locale["fj"]["glotto"]            = "fiji1243"
+    Locale["fj"]["script"]            = "Latn"
+
     #* Hmong Daw
     Locale["mww"]["support"]           = "bing-only"
     Locale["mww"]["name"]              = "Hmong Daw"
@@ -1424,6 +1433,24 @@
     Locale["otq"]["iso"]               = "otq"
     Locale["otq"]["glotto"]            = "quer1236"
     Locale["otq"]["script"]            = "Latn"
+
+    #* Tahitian
+    Locale["ty"]["support"]           = "bing-only"
+    Locale["ty"]["name"]              = "Tahitian"
+    Locale["ty"]["endonym"]           = "Reo Tahiti"
+    Locale["ty"]["family"]            = "Austronesian"
+    Locale["ty"]["iso"]               = "tah"
+    Locale["ty"]["glotto"]            = "tahi1242"
+    Locale["ty"]["script"]            = "Latn"
+
+    #* Tongan
+    Locale["to"]["support"]           = "bing-only"
+    Locale["to"]["name"]              = "Tongan"
+    Locale["to"]["endonym"]           = "Lea faka-Tonga"
+    Locale["to"]["family"]            = "Austronesian"
+    Locale["to"]["iso"]               = "ton"
+    Locale["to"]["glotto"]            = "tong1325"
+    Locale["to"]["script"]            = "Latn"

     #* Yucatec Maya
     Locale["yua"]["support"]           = "bing-only"
@@ -1521,20 +1548,6 @@
     Locale["fo"]["iso"]                = "fao"
     Locale["fo"]["glotto"]             = "faro1244"
     Locale["fo"]["script"]             = "Latn"
-
-    #? Fijian
-    Locale["fj"]["support"]            = "unstable"
-    Locale["fj"]["name"]               = "Fijian"
-    Locale["fj"]["endonym"]            = "Vosa Vakaviti"
-    #Locale["fj"]["translations-of"]
-    #Locale["fj"]["definitions-of"]
-    #Locale["fj"]["synonyms"]
-    #Locale["fj"]["examples"]
-    #Locale["fj"]["see-also"]
-    Locale["fj"]["family"]             = "Austronesian"
-    Locale["fj"]["iso"]                = "fij"
-    Locale["fj"]["glotto"]             = "fiji1243"
-    Locale["fj"]["script"]             = "Latn"

     #? Guarani
     Locale["gn"]["support"]            = "unstable"


Translate: check for existence of ast properly

--- include/Translate.awk
+++ include/Translate.awk
@@ -141,7 +141,7 @@
     l(content, "content", 1, 1)
     l(tokens, "tokens", 1, 0, 1)
     l(ast, "ast")
-    if (!anything(ast)) {
+    if (!isarray(ast) || !anything(ast)) {
         e("[ERROR] Oops! Something went wrong and I can't translate it for you :(")
         ExitCode = 1
         return


msg_parser.awk: removed gawkism from header name hash calculation

darcs-hash:20070307103222-88462-8760a9aa67804a7a35667b694641bb47e857199d.gz

--- libsofia-sip-ua/msg/msg_parser.awk
+++ libsofia-sip-ua/msg/msg_parser.awk
@@ -80,11 +80,16 @@
 {
   hash = 0;

-  len = split(name, chars, "");
+  len = length(name);

   for (i = 1; i <= len; i++) {
-    c = tolower(chars[i]);
+    c = tolower(substr(name, i, 1));
     hash = (38501 * (hash + index(ascii, c))) % 65536;
+  }
+
+  if (hash == 0) {
+    print "*** msg_parser.awk: calculating hash failed\n";
+    exit(5);
   }

   if (0) {


Make the delabeling sorting faster

Make the delabeling sorting faster

--- impl/delabel.awk
+++ impl/delabel.awk
@@ -10,6 +10,6 @@
         sep = ", ";
         len++;
     }
-    print $1, len, synset | "sort --parallel=$(nproc) -k2nr -k1n -s";
+    print $1, len, synset | "sort --parallel=$(nproc) -t \"\t\" -S1G -k2nr -k1n -s";
     synset = sep = len = ""; delete uniq;
 }