Pulled all the recent changes to `d.awk` into `hashd.awk`

--- hashd.awk
+++ hashd.awk
@@ -18,13 +18,17 @@
 BEGIN {

     # Configuration options
-    if(Title=="") Title = "Documentation";
-    if(Theme=="") Theme = 1;
-    if(Pretty=="") Pretty = 0;
-    if(HideToCLevel=="") HideToCLevel = 3;
+    if(Title== "") Title = "Documentation";
+    if(Theme== "") Theme = 1;
+    if(Pretty== "") Pretty = 1;
+    if(Mermaid== "") Mermaid = 1;
+    if(HideToCLevel== "") HideToCLevel = 3;
+    if(Lang == "") Lang = "en";
     #TopLinks = 1;
     #classic_underscore = 1;
     if(MaxWidth=="") MaxWidth="1080px";
+    if(NumberHeadings=="") NumberHeadings = 1;
+    if(NumberH1s=="") NumberH1s = 0;

     Mode = (Clean)?"p":"none";
     ToC = ""; ToCLevel = 1;
@@ -76,32 +80,30 @@
             Out = Out tag(Mode, Buf);
     }

-    print "<!DOCTYPE html>\n"
+    print "<!DOCTYPE html>\n"
+    print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
     print "<title>" Title "</title>";
     if(StyleSheet)
         print "<link rel=\"stylesheet\" href=\"" StyleSheet "\">";
     else
         print "";
-    print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
     if(ToC && match(Out, /!\[toc[-+]?\]/))
-        print "";
-    if(Pretty && HasCode)
-        print "";
     print "";
     if(Out) {
         Out = fix_footnotes(Out);
@@ -115,6 +117,14 @@
             print "

\n" footnotes "
";
         }
     }
+
+    if(Pretty && HasPretty) {
+        print "";
+    }
+    if(Mermaid && HasMermaid) {
+        print "";
+        print "";
+    }
     print ""
 }

@@ -133,7 +143,7 @@
     sub(/[[:space:]]+$/, "", st);
     return st;
 }
-function filter(st,       res,tmp, linkdesc, url, delim, edelim, name, def) {
+function filter(st,       res,tmp, linkdesc, url, delim, edelim, name, def, plang, mmaid) {
     if(Mode == "p") {
         if(match(st, /^[[:space:]]*\[[-._[:alnum:][:space:]]+\]:/)) {
             linkdesc = ""; LastLink = 0;
@@ -242,15 +252,26 @@
         else {
             gsub(/\t/,"    ",Buf);
             if(length(trim(Buf)) > 0) {
-                Lang = "";
+                plang = ""; mmaid=0;
                 if(match(Preterm, /^[[:space:]]*```+/)) {
-                    Lang = trim(substr(Preterm, RSTART+RLENGTH));
-                    if(Lang) {
-                        Lang = "class=\"prettyprint lang-" Lang "\"";
-                        HasCode=1;
+                    plang = trim(substr(Preterm, RSTART+RLENGTH));
+                    if(plang) {
+                        if(plang == "mermaid") {
+                            mmaid = 1;
+                            HasMermaid = 1;
+                        } else {
+                            HasPretty = 1;
+                            if(plang == "auto")
+                                plang = "class=\"prettyprint\"";
+                            else
+                                plang = "class=\"prettyprint lang-" plang "\"";
+                        }
                     }
                 }
-                res = tag("pre", tag("code", escape(Buf), Lang));
+                if(mmaid && Mermaid)
+                    res = tag("div", Buf, "class=\"mermaid\"");
+                else
+                    res = tag("pre", tag("code", escape(Buf), plang));
             }
             pop();
             if(Preterm) sub(/^[[:space:]]*```+[[:alnum:]]*/,"",st);
@@ -397,19 +418,30 @@
             }
             tg = substr(st, 1, p - 1);
             if(match(tg,/^[[:alpha:]]+[[:space:]]/)) {
-                a = substr(tg,RSTART+RLENGTH-1);
+                a = trim(substr(tg,RSTART+RLENGTH-1));
                 tg = substr(tg,1,RLENGTH-1);
             } else
                 a = "";

             if(match(tolower(tg), "^/?(a|abbr|div|span|blockquote|pre|img|code|p|em|strong|sup|sub|del|ins|s|u|b|i|br|hr|ul|ol|li|table|thead|tfoot|tbody|tr|th|td|caption|column|col|colgroup|figure|figcaption|dl|dd|dt|mark|cite|q|var|samp|small|details|summary)$")) {
-                r = r "<" tg a ">";
+                if(!match(tg, /\//)) {
+                    if(match(a, /class="/)) {
+                        sub(/class="/, "class=\"dawk-ex ", a);
+                    } else {
+                        if(a)
+                            a = a " class=\"dawk-ex\""
+                        else
+                            a = "class=\"dawk-ex\""
+                    }
+                    r = r "<" tg " " a ">";
+                } else
+                    r = r "<" tg ">";
             } else if(match(tg, "^[[:alpha:]]+://[[:graph:]]+$")) {
                 if(!a) a = tg;
-                r = r "" a "";
+                r = r "" a "";
             } else if(match(tg, "^[[:graph:]]+@[[:graph:]]+$")) {
                 if(!a) a = tg;
-                r = r "" obfuscate(a) "";
+                r = r "" obfuscate(a) "";
             } else {
                 r = r "<";
                 continue;
@@ -430,29 +462,36 @@

 function push(newmode) {Stack[StackTop++] = Mode; Mode = newmode;}
 function pop() {Mode = Stack[--StackTop];Buf = ""; return Mode;}
-function heading(level, st,       res, href) {
+function heading(level, st,       res, href, u, text,svg) {
+    if(level > 6) level = 6;
     st = trim(st);
-    if(level > 6) level = 6;
     href = tolower(st);
     href = strip_tags(href);
-    gsub(/[^ [:alnum:]]+/, "", href);
-    gsub(/ +/, "-", href);
-    if(!LinkUrls[href]) LinkUrls[href] = "#" href;
-    if(!LinkUrls[tolower(st)]) LinkUrls[tolower(st)] = "#" href;
-    res = tag("h" level, st (TopLinks?"  ↑ Top":""), "id=\"" href "\"");
+    gsub(/[^-_ [:alnum:]]+/, "", href);
+    gsub(/[[:space:]]/, "-", href);
+    if(TitleUrls[href]) {
+        for(u = 1; TitleUrls[href "-" u]; u++);
+        href = href "-" u;
+    }
+    TitleUrls[href] = "#" href;
+
+    svg = "<svg width=\"16\" height=\"16\" xmlns=\"http://www.w3.org/2000/svg\"><g transform=\"rotate(-30, 8, 8)\" stroke=\"#000000\" opacity=\"0.25\"><rect fill=\"none\" height=\"6\" width=\"8\" x=\"2\" y=\"6\" rx=\"1.5\"/><rect fill=\"none\" height=\"6\" width=\"8\" x=\"6\" y=\"4\" rx=\"1.5\"/></g></svg>";
+    text = "" st " " svg "" (TopLinks?"  ↑ Top":"");
+
+    res = tag("h" level, text, "id=\"" href "\"");
     for(;ToCLevel < level; ToCLevel++) {
         ToC_ID++;
         if(ToCLevel < HideToCLevel) {
-            ToC = ToC "▲";
-            ToC = ToC "
";
+            ToC = ToC "▼";
+            ToC = ToC "
";
         } else {
-            ToC = ToC "▼";
-            ToC = ToC "
";
+            ToC = ToC "►";
+            ToC = ToC "
";
         }
     }
     for(;ToCLevel > level; ToCLevel--)
         ToC = ToC "
";
-    ToC = ToC "
" st "\n";
+    ToC = ToC "
" st "\n";
     ToCLevel = level;
     return res;
 }
@@ -471,8 +510,8 @@

         ++n;
         dis = index(substr(st,RSTART,RLENGTH),"+");
-        t = "
\n" (dis?"▲":"▼") " Contents\n" \
-            "
\n
" ToC "
\n
\n
";
+        t = "
\n" (dis?"▼":"►") " Contents\n" \
+            "
\n
" ToC "
\n
\n
";
         r = r substr(st,1,RSTART-1);
         r = r t;
         st = substr(st,RSTART+RLENGTH);
@@ -482,13 +521,13 @@
 }
 function fix_links(st,          lt,ld,lr,url,img,res,rx,pos,pre) {
     do {
-        pre = match(st, /
/); # Don't substitute in
 blocks
+        pre = match(st, /<(pre|code)>/); # Don't substitute in
 or  blocks
         pos = match(st, /\[[^\]]+\]/);
         if(!pos)break;
         if(pre && pre < pos) {
-            pre = match(st, /<\/pre>/);
+            match(st, /<\/(pre|code)>/);
             res = res substr(st,1,RSTART+RLENGTH);
-            st = substr(st, RSTART+RLENGTH);
+            st = substr(st, RSTART+RLENGTH+1);
             continue;
         }
         img=substr(st,RSTART-1,1)=="!";
@@ -519,7 +558,7 @@
             if(img)
                 res = res "";
             else
-                res = res "" lt "";
+                res = res "" lt "";
         } else if(match(st, /^[[:space:]]*\[[^\]]*\]/)) {
             lt = substr(rx, 2, length(rx) - 2);
             match(st, /\[[^\]]*\]/);
@@ -533,8 +572,10 @@
             ld = LinkDescs[lr];
             if(img)
                 res = res "";
+            else if(url)
+                res = res "" lt "";
             else
-                res = res "" lt "";
+                res = res "[" lt "][" lr "]";
         } else
             res = res (img?"!":"") rx;
     } while(pos > 0);
@@ -619,34 +660,41 @@

     css["body"] = "color:%color1%;font-family:%font-family%;font-size:%font-size%;line-height:1.5em;" \
                 "padding:1em 2em;width:80%;max-width:%maxwidth%;margin:0 auto;min-height:100%;float:none;";
-    css["h1"] = "color:%color1%;border-bottom:1px solid %color1%;padding:0.3em 0.1em;";
+    css["h1"] = "border-bottom:1px solid %color1%;padding:0.3em 0.1em;";
+    css["h1 a"] = "color:%color1%;";
     css["h2"] = "color:%color2%;border-bottom:1px solid %color2%;padding:0.2em 0.1em;";
+    css["h2 a"] = "color:%color2%;";
     css["h3"] = "color:%color3%;border-bottom:1px solid %color3%;padding:0.1em 0.1em;";
-    css["h4,h5,h6"] = "color:%color4%;padding:0.1em 0.1em;";
-    css["h1,h2,h3,h4,h5,h6"] = "font-weight:normal;line-height:1.2em;";
+    css["h3 a"] = "color:%color3%;";
+    css["h4,h5,h6"] = "padding:0.1em 0.1em;";
+    css["h4 a,h5 a,h6 a"] = "color:%color4%;";
+    css["h1,h2,h3,h4,h5,h6"] = "font-weight:bolder;line-height:1.2em;";
     css["h4"] = "border-bottom:1px solid %color4%";
     css["p"] = "margin:0.5em 0.1em;"
     css["hr"] = "background:%color1%;height:1px;border:0;"
-    css["a"] = "color:%color2%;";
-    css["a:visited"] = "color:%color2%;";
-    css["a:active"] = "color:%color4%;";
-    css["a:hover"] = "color:%color4%;";
+    css["a.normal, a.toc"] = "color:%color2%;";
+    #css["a.normal:visited"] = "color:%color2%;";
+    #css["a.normal:active"] = "color:%color4%;";
+    css["a.normal:hover, a.toc:hover"] = "color:%color4%;";
     css["a.top"] = "font-size:x-small;text-decoration:initial;float:right;";
+    css["a.header svg"] = "opacity:0;";
+    css["a.header:hover svg"] = "opacity:1;";
+    css["a.header"] = "text-decoration: none;";
     css["strong,b"] = "color:%color1%";
-    css["code"] = "color:%color2%;";
+    css["code"] = "color:%color2%;font-weight:bold;";
     css["blockquote"] = "margin-left:1em;color:%color2%;border-left:0.2em solid %color3%;padding:0.25em 0.5em;overflow-x:auto;";
     css["pre"] = "color:%color2%;background:%color5%;border:1px solid;border-radius:2px;line-height:1.25em;margin:0.25em 0.5em;padding:0.75em;overflow-x:auto;";
-    css["table"] = "border-collapse:collapse;margin:0.5em;";
-    css["th,td"] = "padding:0.5em 0.75em;border:1px solid %color4%;";
-    css["th"] = "color:%color2%;border:1px solid %color3%;border-bottom:2px solid %color3%;";
-    css["tr:nth-child(odd)"] = "background-color:%color5%;";
-    css["div"] = "padding:0.5em;";
-    css["caption"] = "padding:0.5em;font-style:italic;";
-    css["dl"] = "margin:0.5em;";
-    css["dt"] = "font-weight:bold;";
-    css["dd"] = "padding:0.3em;";
-    css["mark"] = "color:%color2%;background-color:%color5%;";
-    css["del,s"] = "color:%color4%;";
+    css["table.dawk-ex"] = "border-collapse:collapse;margin:0.5em;";
+    css["th.dawk-ex,td.dawk-ex"] = "padding:0.5em 0.75em;border:1px solid %color4%;";
+    css["th.dawk-ex"] = "color:%color2%;border:1px solid %color3%;border-bottom:2px solid %color3%;";
+    css["tr.dawk-ex:nth-child(odd)"] = "background-color:%color5%;";
+    css["div.dawk-ex"] = "padding:0.5em;";
+    css["caption.dawk-ex"] = "padding:0.5em;font-style:italic;";
+    css["dl.dawk-ex"] = "margin:0.5em;";
+    css["dt.dawk-ex"] = "font-weight:bold;";
+    css["dd.dawk-ex"] = "padding:0.3em;";
+    css["mark.dawk-ex"] = "color:%color5%;background-color:%color4%;";
+    css["del.dawk-ex,s.dawk-ex"] = "color:%color4%;";
     css["a.toc-button"] = "color:%color2%;cursor:pointer;font-size:small;padding: 0.3em 0.5em 0.5em 0.5em;font-family:monospace;border-radius:3px;";
     css["a.toc-button:hover"] = "color:%color4%;background:%color5%;";
     css["div#table-of-contents"] = "padding:0;font-size:smaller;";
@@ -656,10 +704,48 @@
     css["a.footnote-back"] = "text-decoration:initial;font-size:x-small;";
     css[".fade"] = "color:%color5%;";
     css[".highlight"] = "color:%color2%;background-color:%color5%;";
-	css["summary"] = "cursor:pointer;";
+    css["summary"] = "cursor:pointer;";
+    css["ul.toc"] = "list-style-type:none;";
+
+    if(NumberHeadings)  {
+        if(NumberH1s) {
+            css["body"] = css["body"] "counter-reset: h1 toc1;";
+            css["h1"] = css["h1"] "counter-reset: h2 h3 h4;";
+            css["h2"] = css["h2"] "counter-reset: h3 h4;";
+            css["h3"] = css["h3"] "counter-reset: h4;";
+            css["h1::before"] = "content: counter(h1) \" \"; counter-increment: h1; margin-right: 10px;";
+            css["h2::before"] = "content: counter(h1) \".\"counter(h2) \" \";counter-increment: h2; margin-right: 10px;";
+            css["h3::before"] = "content: counter(h1) \".\"counter(h2) \".\"counter(h3) \" \";counter-increment: h3; margin-right: 10px;";
+            css["h4::before"] = "content: counter(h1) \".\"counter(h2) \".\"counter(h3)\".\"counter(h4) \" \";counter-increment: h4; margin-right: 10px;";
+
+            css["li.toc-1"] = "counter-reset: toc2 toc3 toc4;";
+            css["li.toc-2"] = "counter-reset: toc3 toc4;";
+            css["li.toc-3"] = "counter-reset: toc4;";
+            css["a.toc-1::before"] = "content: counter(h1) \"  \";counter-increment: toc1;";
+            css["a.toc-2::before"] = "content: counter(h1) \".\" counter(toc2) \"  \";counter-increment: toc2;";
+            css["a.toc-3::before"] = "content: counter(h1) \".\" counter(toc2) \".\" counter(toc3) \"  \";counter-increment: toc3;";
+            css["a.toc-4::before"] = "content: counter(h1) \".\" counter(toc2) \".\" counter(toc3) \".\" counter(toc4) \"  \";counter-increment: toc4;";
+
+        } else {
+            css["h1"] = css["h1"] "counter-reset: h2 h3 h4;";
+            css["h2"] = css["h2"] "counter-reset: h3 h4;";
+            css["h3"] = css["h3"] "counter-reset: h4;";
+            css["h2::before"] = "content: counter(h2) \" \";counter-increment: h2; margin-right: 10px;";
+            css["h3::before"] = "content: counter(h2) \".\"counter(h3) \" \";counter-increment: h3; margin-right: 10px;";
+            css["h4::before"] = "content: counter(h2) \".\"counter(h3)\".\"counter(h4) \" \";counter-increment: h4; margin-right: 10px;";
+
+            css["li.toc-1"] = "counter-reset: toc2 toc3 toc4;";
+            css["li.toc-2"] = "counter-reset: toc3 toc4;";
+            css["li.toc-3"] = "counter-reset: toc4;";
+            css["a.toc-2::before"] = "content: counter(toc2) \"  \";counter-increment: toc2;";
+            css["a.toc-3::before"] = "content: counter(toc2) \".\" counter(toc3) \"  \";counter-increment: toc3;";
+            css["a.toc-4::before"] = "content: counter(toc2) \".\" counter(toc3) \".\" counter(toc4) \"  \";counter-increment: toc4;";
+        }
+    }

     # Colors:
-    c1="#314070";c2="#465DA6";c3="#6676A8";c4="#A88C3F";c5="#E8E4D9";
+    #c1="#314070";c2="#465DA6";c3="#6676A8";c4="#A88C3F";c5="#E8E4D9";
+    c1="#314070";c2="#384877";c3="#6676A8";c4="#738FD0";c5="#FBFCFF";
     # Font Family:
     ff = "sans-serif";
     fs = "11pt";


gcj's javadoc wants lowercase hexadecimal constants. (dm)

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

--- Bindings/Java/constants.awk
+++ Bindings/Java/constants.awk
@@ -32,7 +32,7 @@
   if (name == "PASSKEY") return

   if (value ~ /^0[xX][0-9a-fA-F]+00$/) {
-    writeCommandDefinition(name, toupper(value) "00", help)
+    writeCommandDefinition(name, hexadecimalValue(value) "00", help)
   }
 }

@@ -41,7 +41,7 @@

 function brlFlag(name, symbol, value, help) {
   if (value ~ /^0[xX][0-9a-fA-F]+0000$/) {
-    value = toupper(substr(value, 1, length(value)-4))
+    value = hexadecimalValue(substr(value, 1, length(value)-4))
     if (name ~ /^CHAR_/) {
       name = substr(name, 6)
     } else {
@@ -52,15 +52,15 @@
   } else {
     return
   }
-  writeJavaConstant("KEY_FLG_" name, value, help)
+  writeJavaConstant("int", "KEY_FLG_" name, value, help)
 }

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

 function apiType(name, symbol, value, help) {
-  writeJavaConstant("KEY_TYPE_" name, hexadecimalValue(value));
+  writeJavaConstant("int", "KEY_TYPE_" name, hexadecimalValue(value));
 }

 function apiKey(name, symbol, value, help) {
@@ -76,24 +76,26 @@
 }

 function writeCommandDefinition(name, value, help) {
-  writeJavaConstant("KEY_CMD_" name, "(KEY_TYPE_CMD | " value ")", help)
+  writeJavaConstant("int", "KEY_CMD_" name, "(KEY_TYPE_CMD | " value ")", help)
 }

 function writeKeyDefinition(name, value) {
-  writeJavaConstant("KEY_SYM_" name, "(KEY_TYPE_SYM | " value ")")
+  writeJavaConstant("int", "KEY_SYM_" name, "(KEY_TYPE_SYM | " value ")")
 }

-function writeJavaConstant(name, value, help) {
+function writeJavaConstant(type, name, value, help) {
   writeJavadocComment(help)
-  print "  public static final int " name " = " value ";"
+  print "  public static final " type " " name " = " value ";"
 }

 function writeJavadocComment(text) {
-  print "  /** " text " */"
+  if (length(text) > 0) print "  /** " text " */"
 }

 function hexadecimalValue(value) {
-  gsub("[uU]?[lL]*$", "", value)
+  value = tolower(value)
+  gsub("u?l*$", "", value)
+  gsub("x0+", "x0", value)
   return value
 }


Const has static linkage

Const has static linkage

bin/obj/Linux.x64.Debug/src/dlls/mscorrc/full/mscorrc_debug.cpp:1002:110: error: ‘visibility’ attribute ignored [-Werror=attributes]
 const NativeStringResourceTable nativeStringResourceTable_mscorrc_debug __attribute__((visibility("default"))) = {

--- src/nativeresources/rctocpp.awk
+++ src/nativeresources/rctocpp.awk
@@ -62,7 +62,7 @@
     print "// This code was generated by rctocpp.awk and is not meant to be modified manually."
     print "#include <resourcestring.h>";
     print "";
-    print "extern const NativeStringResourceTable " tableName ";";
+    print "extern NativeStringResourceTable " tableName ";";
     print "const NativeStringResource " arrayName "[] = {";
 }

@@ -78,7 +78,7 @@
     print "};";
     print "";

-    print "const NativeStringResourceTable " tableName " __attribute__((visibility(\"default\"))) = {";
+    print "NativeStringResourceTable " tableName " __attribute__((visibility(\"default\"))) = {";
     print numEntries ",";
     print arrayName "};";
 }


Fix unterminated source lines

Fix unterminated source lines

--- fixExtraLinesFrom-webscraper.awk
+++ fixExtraLinesFrom-webscraper.awk
@@ -1,16 +1,22 @@
 # Print lines from a WebScraper csv file after joining extra newlines
+# Make sure lines have a terminating double quote (except header line)

 # INVOCATION:
 #   awk -f fixExtraLinesFrom-webscraper.awk BritBoxPrograms.csv

 {
-    if (/^"/)
-        printf ("\n" $0)
-    else
-        printf
+    if (/^"/) {
+        if (line !~ "\"$" && NR != 2)
+            line = line "\""
+        print line
+        line = $0
+    } else {
+        line = line $0
+    }
 }

 END {
-    printf ("\n")
+    if (line !~ "\"$")
+        line = line "\""
+    print line
 }
-


2.13.awk

--- chapter2/2.13.awk
+++ chapter2/2.13.awk
@@ -15,7 +15,7 @@
 	FS="\t+"
 	while (getline <"sysconf.sym" > 0) {
 		printf("#ifdef %s\n", $1)
-		printf("\tprintf(\"%s defined to be %%ld\\n", (long)%s+0);\n", $1, $1)
+		printf("\tprintf(\"%s defined to be %%ld\\n\", (long)%s+0);\n", $1, $1)
 		printf("#else\n")
 		printf("\tprintf(\"no symbol for %s\\n");\n", $1)
 		printf("#endif\n")


[as] Print proper error messages in gen.awk

--- as/target/gen.awk
+++ as/target/gen.awk
@@ -151,7 +151,7 @@
 		} else if (a ~ /^\?$/) {
 			return out "|AOPT"
 		} else if (a != "") {
-			print "wrong arg", a > "/dev/stderr"
+			print FILENAME ":" NR ":" $0 ":wrong arg", a > "/dev/stderr"
 			exit 1
 		}
 		out = out ","


SHADOW_LIST was getting converted to SHADOWLIST by the awk script that converts configs to win32.

--- src/condor_examples/convert_config_to_win32.awk
+++ src/condor_examples/convert_config_to_win32.awk
@@ -77,7 +77,7 @@
 	next
 }
 /^SHADOW_LIST/ {
-    printf "SHADOWLIST = SHADOW\n"
+    printf "SHADOW_LIST = SHADOW\n"
     next
 }


MTEXT entities added

MTEXT entities added

--- english/gawk/code/dxf_txt2csv.awk
+++ english/gawk/code/dxf_txt2csv.awk
@@ -1,18 +1,25 @@
 BEGIN {
 	print "EAST;NORTH;LAYER;DIRECTION;SIZE;TEXT";	# print header
+	rad2deg = 180.0 / atan2(1.0, 1.0) / 4;
 }
 /^ENTITIES/,/^EOF/ {
 	if ($0 == "  0") {					# next entity reached
-		if (entity == "TEXT") {			# output text data
+		if (entity == "MTEXT") {		# calculate angle from dx, dy
+			angle = atan2(dy, dx) * rad2deg;	# angle in deg
+		}
+		if (entity == "TEXT" || entity == "MTEXT") {	# output text data
 			printf("%.2f;%.2f;%s;%.5f;%.2f;%s\n", x, y, layer, angle, size, txt);
 		}
 		entity = ""; txt = ""; angle = 0; size = 1; layer = "";
+		dx = dy = 0.0;
 		last = "";						# initialize variables
 	}
 	if (last == "  0") { entity = $0; }	# actual entity type
 	if (last == "  8") { layer = $0; }	# layer
 	if (last == " 10") { x = $0; }		# east
 	if (last == " 20") { y = $0; }		# north
+	if (last == " 11") { dx = $0; }		# direction for MTEXT
+	if (last == " 21") { dy = $0; }		# direction for MTEXT
 	if (last == " 40") { size = $0; }	# text size
 	if (last == " 50") { angle = $0; }	# text direction
 	if (last == "  1") { txt = $0; }	# text


handle null explanation in dictionary entries (fix #33)

--- include/Commons.awk
+++ include/Commons.awk
@@ -200,11 +200,14 @@
     temp = ""
     j = 0
     saveSortedIn = PROCINFO["sorted_in"]
-    PROCINFO["sorted_in"] = sortedIn
-    for (i in array)
-        if (preserveNull || array[i] != "")
-            temp = j++ ? temp separator array[i] : array[i]
-    PROCINFO["sorted_in"] = saveSortedIn
+    if (length(array)) {
+        PROCINFO["sorted_in"] = sortedIn
+        for (i in array)
+            if (preserveNull || array[i] != "")
+                temp = j++ ? temp separator array[i] : array[i]
+        PROCINFO["sorted_in"] = saveSortedIn
+    } else
+        temp = array # array == ""

     return temp
 }


Escape '(' and ')' in regexp.  Don't delete "languages" from "Multiple languages".

--- LANGNAME.awk
+++ LANGNAME.awk
@@ -87,6 +87,8 @@
 	    name = array[idx]
 	    if (name == "Greek, Modern (1453-)")
 		name = "Greek";
+	    else if (name == "Multiple languages")
+		;
 	    else {
 		gsub(" \\(Other\\)$", "", name);
 		gsub(" languages$", "", name);


- handle fedora no modversions

- handle fedora no modversions

--- scripts/modpost.awk
+++ scripts/modpost.awk
@@ -1459,6 +1459,8 @@
     }
     if (count_syms)
 	close(file)
+    else
+	system_command("touch " file)
     print_vinfo(1,"w: syssymver, syms " count_syms)
 }
 function write_modsymver(file,    sym,line,count_syms,mod)
@@ -1485,6 +1487,8 @@
     }
     if (count_syms)
 	close(file)
+    else
+	system_command("touch " file)
     print_vinfo(1,"w: modsymver, syms " count_syms)
 }
 function create_missing_symsets(	progress,count,count_syms,count_sets,sym,set,setmiss,n,symbols,hash,symfile,pos)


Languages: show "Language not found" error in getDetails()

--- include/Languages.awk
+++ include/Languages.awk
@@ -1925,8 +1925,11 @@

 # Return detailed information of a language as a string.
 function getDetails(code,    group, iso, language, script) {
-    if (code == "auto" || !getCode(code))
-        return prettify("languages", sprintf("%-22s%s\n", "Unknown code", ansi("bold", code)))
+    if (code == "auto" || !getCode(code)) {
+        e("[ERROR] Language not found: " code "\n"                      \
+          "        Run '-reference / -R' to see a list of available languages.")
+        exit 1
+    }

     script = scriptName(getScript(code))
     if (isRTL(code)) script = script " (R-to-L)"


Translate: for web translation, print translated URLs as reference (#295)

--- include/Translate.awk
+++ include/Translate.awk
@@ -273,8 +273,10 @@
 # Start a browser session and translate a web page.
 function webTranslation(uri, sl, tl, hl,    temp) {
     temp = _WebTranslateUrl(uri, sl, tl, hl)
-    if (temp)
+    if (temp) {
+        p(temp)
         system(Option["browser"] " " parameterize(temp) SUPOUT SUPERR)
+    }
 }

 # Translate the source text (into all target languages).


Update current year.

Update current year.

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

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

 {
   # add a loop to add line only if ending year is gt or eq to contract year
-  current_year = 2014
+  current_year = 2015
   end_year = 0
   incontract = 0
   test_year = ""


Revert "Properly indent awk script"

Revert "Properly indent awk script"

This reverts commit 060404588512e888d940693e132772e04596ac5f.

--- getMHzFrom-episodePages.awk
+++ getMHzFrom-episodePages.awk
@@ -140,37 +140,37 @@
                         episodeNumberFromURL, shortURL) >> ERROR_FILE
                 episodeNumber = episodeNumberFromURL
             } else {
-            printf ("==> Episode number is 00: %s\n", shortURL) >> ERROR_FILE
+                printf ("==> Episode number is 00: %s\n", shortURL) >> ERROR_FILE
+            }
         }
+        printf ("%d\t=HYPERLINK(\"%s\";\"%s, S%02d%s%02d, %s\"\)\t\t\t%s\t\t\t\t\t", \
+                SERIES_NUMBER, episodeURL, seriesTitle, seasonNumber, episodeType, episodeNumber, \
+                episodeTitle, episodeDuration) >> EPISODE_INFO_FILE
+        # Need to account for multiple lines of description
+        descriptionLinesFound = 0
+        episodeDescription = ""
+        # make sure there is no carryforward
+        episodeNumber = ""
+        episodeNumberFromURL = ""
     }
-    printf ("%d\t=HYPERLINK(\"%s\";\"%s, S%02d%s%02d, %s\"\)\t\t\t%s\t\t\t\t\t", \
-               SERIES_NUMBER, episodeURL, seriesTitle, seasonNumber, episodeType, episodeNumber, \
-               episodeTitle, episodeDuration) >> EPISODE_INFO_FILE
-    # Need to account for multiple lines of description
-    descriptionLinesFound = 0
-    episodeDescription = ""
-    # make sure there is no carryforward
-    episodeNumber = ""
-    episodeNumberFromURL = ""
-}
-if ($0 ~ /<p>/) {
-    split ($0,fld,"[<>]")
-    paragraph = fld[3]
-    gsub (/"/,"\"",paragraph)
-    gsub (/&/,"\\&",paragraph)
-    # Could be in multiple paragraphs
-    descriptionLinesFound += 1
-    episodeDescription = episodeDescription (descriptionLinesFound == 1 ? "" : " ") paragraph
-}
-if ($0 ~ /<\/div>/) {
-    if (episodeDescription == "") {
-        if (episodeType == "T") {
-            episodeDescription = episodeTitle
-        } else {
-        print "==> No description: " shortURL >> ERROR_FILE
+    if ($0 ~ /<p>/) {
+        split ($0,fld,"[<>]")
+        paragraph = fld[3]
+        gsub (/"/,"\"",paragraph)
+        gsub (/&/,"\\&",paragraph)
+        # Could be in multiple paragraphs
+        descriptionLinesFound += 1
+        episodeDescription = episodeDescription (descriptionLinesFound == 1 ? "" : " ") paragraph
+    }
+    if ($0 ~ /<\/div>/) {
+        if (episodeDescription == "") {
+            if (episodeType == "T") {
+                episodeDescription = episodeTitle
+            } else {
+            print "==> No description: " shortURL >> ERROR_FILE
+            }
+        }
+        sub (/^PR \| /,"",episodeDescription)
+        print episodeDescription >> EPISODE_INFO_FILE
     }
 }
-sub (/^PR \| /,"",episodeDescription)
-print episodeDescription >> EPISODE_INFO_FILE
-    }
-}


make-barcodes.awk: Greatly simplify ordering of tags (simple string compare).

--- make-barcodes.awk
+++ make-barcodes.awk
@@ -5,47 +5,35 @@
 #   1: the barcode, put into a canonical form
 #   2: the order of the barcode halves ("ab" or "ba")
 #   3: read1 name
-#   4: sequence of read 1, minus the 12bp barcode and 5bp constant sequence
+#   4: sequence of read 1, minus the 12bp barcode and 5bp invariant sequence
 #   5: read1 quality scores, minus the same first 17bp
 #   6: read2 name
 #   7: sequence of read 2, minus the first 17bp
 #   8: read2 quality scores, minus the first 17bp
-# The canonical form of the barcode is composed of the first 12bp of each read. The 12bp from the
-# first read is the "alpha" and the one from the second is the "beta". The barcode is formed by
-# concatenating them in an order determined by summing the ASCII values of each 12bp sequence, then
-# putting the one with a lower sum first. If the alpha is first, the value of the second column (the
-# order) is "ab", and "ba" if the beta is first.
+# The canonical form of the barcode is composed of two concatenated tags, one from each read.
+# By default, each tag is the first 12bp of the read. The tag from the first read is the "alpha" and
+# the tag from the second is the "beta". The barcode is formed by concatenating them in an order
+# determined by a string comparison of the two. The greater tag is first (if they are equal, the
+# beta is first, but then you have bigger problems).

 BEGIN {
   FS = "\t"; OFS = "\t";
-  if (! BAR_LEN) {
-    BAR_LEN = 24;
+  # The number of bases from the start of each read that form the two halves of the barcode.
+  # (this should be half the size of the full, canonical barcode).
+  if (! TAG_LEN) {
+    TAG_LEN = 12;
   }
+  # The number of bases in the read that are between the barcode and the start of the actual sample
+  # sequence (the restriction site in the Loeb 2014 protocol).
   if (! INVARIANT) {
     INVARIANT = 5;
   }
-  HALF = int(BAR_LEN/2);
-  # Fill an array mapping each character to its ASCII value.
-  for (i = 0; i < 128; i++) {
-    char = sprintf("%c", i);
-    ORD[char] = i;
-  }
-}
-
-function get_sum(seq) {
-  sum = 0;
-  for (i = 1; i <= length(seq); i++) {
-    sum += ORD[substr(seq, i, 1)];
-  }
-  return sum;
 }

 {
-  alpha = substr($2, 1, HALF);
-  beta = substr($6, 1, HALF);
-  alpha_sum = get_sum(alpha);
-  beta_sum = get_sum(beta);
-  if (alpha_sum < beta_sum) {
+  alpha = substr($2, 1, TAG_LEN);
+  beta = substr($6, 1, TAG_LEN);
+  if (alpha > beta) {
     barcode = alpha beta;
     order = "ab";
   } else {
@@ -54,9 +42,9 @@
   }
   name1 = $1;
   name2 = $5;
-  seq1 = substr($2, HALF + INVARIANT + 1);
-  seq2 = substr($6, HALF + INVARIANT + 1);
-  qual1 = substr($4, HALF + INVARIANT + 1);
-  qual2 = substr($8, HALF + INVARIANT + 1);
+  seq1 = substr($2, TAG_LEN + INVARIANT + 1);
+  seq2 = substr($6, TAG_LEN + INVARIANT + 1);
+  qual1 = substr($4, TAG_LEN + INVARIANT + 1);
+  qual2 = substr($8, TAG_LEN + INVARIANT + 1);
   print barcode, order, name1, seq1, qual1, name2, seq2, qual2;
 }


code optimization

code optimization

--- english/data_processing/code/numephem.awk
+++ english/data_processing/code/numephem.awk
@@ -1,15 +1,11 @@
-/^G[0-9][0-9]/ {
-	numGPS++;
+/^[GREC][0-9][0-9]/ {
+	# increment satelite specific array elements
+	# G - GPS, R - Glonass, E - Galielo, C - Beidou
+	numsat[substr($0, 1, 1)]++;
 }
-/^R[0-9][0-9]/ {
-	numGLO++;
+END { printf "%s: ", FILENAME;
+	name["G"] = "GPS"; name["R"] = "Glonass"; name["E"] = "Galileo";
+	name["C"] = "Beidou";
+	for (i in numsat) { printf "%s %d ", name[i], numsat[i]};
+	printf "\n";
 }
-/^E[0-9][0-9]/ {
-	numGAL++;
-}
-/^C[0-9][0-9]/ {
-	numBDS++;
-}
-END {
-	print FILENAME, numGPS, numGLO, numGAL, numBDS;
-}


Translators/BingTranslator: bs-Latn -> bs

--- include/Translators/BingTranslator.awk
+++ include/Translators/BingTranslator.awk
@@ -149,11 +149,9 @@
 function bingWebTranslateUrl(uri, sl, tl, hl,    _sl, _tl) {
     # Hot-patches for language codes
     _sl = sl; _tl = tl
-    if (_sl == "bs")    _sl = "bs-Latn" # 'bs' is not recognized as valid code
     if (_sl == "zh")    _sl = "zh-CHS" # still old format
     if (_sl == "zh-CN") _sl = "zh-CHS"
     if (_sl == "zh-TW") _sl = "zh-CHT"
-    if (_tl == "bs")    _tl = "bs-Latn"
     if (_tl == "zh")    _tl = "zh-CHS"
     if (_tl == "zh-CN") _tl = "zh-CHS"
     if (_tl == "zh-TW") _tl = "zh-CHT"
@@ -225,16 +223,14 @@
     bingSetup()

     # Hot-patches for Bing's own translator language codes
-    # See: <https://msdn.microsoft.com/en-us/library/hh456380.aspx>
+    # See: <https://docs.microsoft.com/en-us/azure/cognitive-services/Translator/language-support>
     if (_sl == "auto")  _sl = "auto-detect"
-    if (_sl == "bs")    _sl = "bs-Latn"  # 'bs' is not recognized as valid code
     if (_sl == "no")    _sl = "nb"  # Bing uses Norwegian Bokmål
     # Bing uses 'pt' or 'pt-br' for Brazilian Portuguese, 'pt-pt' for European Portuguese
     if (_sl == "pt-BR") _sl = "pt" # just pt-br
     else if (_sl == "pt-PT") _sl = "pt" # FIXME: support pt-pt
     if (_sl == "zh-CN") _sl = "zh-Hans"
     if (_sl == "zh-TW") _sl = "zh-Hant"
-    if (_tl == "bs")    _tl = "bs-Latn"
     if (_tl == "no")    _tl = "nb"
     if (_tl == "pt-BR") _tl = "pt"
     else if (_tl == "pt-PT") _tl = "pt-pt"


Commons: add fileExists()

Commons: add fileExists()

--- include/Commons.awk
+++ include/Commons.awk
@@ -290,6 +290,11 @@
         e(message)
 }

+# Return non-zero if file exists, otherwise return 0.
+function fileExists(file) {
+    return !system("test -f " file)
+}
+
 BEGIN {
     initUrlEncoding()
     initAnsiCode()


Remove useless awk script.

Remove useless awk script.


Add automated date.

Add automated date.

--- scripts/tdb/statuses_clockss.awk
+++ scripts/tdb/statuses_clockss.awk
@@ -2,24 +2,33 @@
 # tdbout -t publisher,plugin,publisher:info[contract],year,publisher:info[tester],status,publisher:info[back],publisher:info[poller] *.tdb

 BEGIN {
+  #After July 1 of this year, start reporting on this year. Before that, ignore this year.
+  str = "date +%Y";
+  str | getline current_year;
+  #close str;
+  str = "date +%W";
+  str | getline week;
+  #close str;
+  if (week<26) {
+  	current_year=current_year-1
+  }
+  #printf "%s %s", current_year, week;
   FS="\t"
   pn = 0
-    #str = "date +%m-%d-%Y";
-    #str | getline date;
-    #close str;
 }
-#$3>date
+
 {
   # add a loop to add line only if either status is (wanted or testing) or ending year is gt or eq to contract year

-  #After July 1 of this year, start reporting on this year. Before that, ignore this year.
-  current_year=`date +%Y`
-  week=`date +%W`
-  if [ $week -lt 26 ]
-    then
-    ((current_year--))
+  #current_year=2018
+
+  #current_year=`date +%Y`
+  #week=`date +%W`
+  #if [ $week -lt 26 ]
+  #  then
+  #  ((current_year--))
     #echo current_year $current_year
-  fi
+  #fi
   #echo current_year $current_year

   # end_year is the AU year, or the second half of a range, ie 2014 in 2013-2014


Record AUs that have a year range ending in the contract year

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


Fix typo

Fix typo

--- getMHzFromSitemap.awk
+++ getMHzFromSitemap.awk
@@ -290,7 +290,7 @@
         #
         # Make sure episodeDuration is valid
         if (split (episodeDuration, tm, ":") == 3) {
-            # Cannnocalize episodeDuration to 3 parts like other services
+            # Canonicalize episodeDuration to 3 parts like other services
             episodeDuration = sprintf ("%02d:%02d:%02d",tm[1],tm[2],tm[3])
         } else {
             printf ("==> Bad episodeDuration %s in \"%s: %s\"\n", episodeDuration, showTitle,


gbuild: remove processdelivered.mk

gbuild: remove processdelivered.mk

obsolete since 6280f921050e6e879ca752abf4e8fb7553aba6f5.

Change-Id: Idab0c904f05da66956ecbd8a01f3e9d2e2d7c605

--- solenv/gbuild/processdelivered.awk
+++ solenv/gbuild/processdelivered.awk
@@ -1,27 +0,0 @@
-#
-# This file is part of the LibreOffice project.
-#
-# 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/.
-#
-# This file incorporates work covered by the following license notice:
-#
-#   Licensed to the Apache Software Foundation (ASF) under one or more
-#   contributor license agreements. See the NOTICE file distributed
-#   with this work for additional information regarding copyright
-#   ownership. The ASF licenses this file to you under the Apache
-#   License, Version 2.0 (the "License"); you may not use this file
-#   except in compliance with the License. You may obtain a copy of
-#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-BEGIN {
-    RS=" "
-    FS=":"
-}
-
-{
-    if( NF == 2 )
-        print "COPY " $1 " " $2;
-}


Clarified wrong number of episodes message

--- verifyBBoxInfoFrom-webscraper.awk
+++ verifyBBoxInfoFrom-webscraper.awk
@@ -44,8 +44,9 @@

     showTitle[numShows] = title
     seas[numShows] = numSeasons
-    doesHave[numShows] = numEpisodes
-    shouldHave[numShows] = 0
+    episodesInShow[numShows] = numEpisodes
+    episodesInSeasons[numShows] = 0
+    seasonsFound[numShows] = 0
 }

 /^         / {
@@ -53,7 +54,8 @@
     if ($epis !~ /^[[:digit:]]*$/)
         print "    Bad input line " NR ":\n" $0
     else
-        shouldHave[numShows] += $epis
+        seasonsFound[numShows] += 1
+    episodesInSeasons[numShows] += $epis
 }

 END {
@@ -62,16 +64,17 @@
         print ""
     }
     for ( i = 1; i <= numShows; i++ ) {
-        if (seas[i] != 1 && doesHave[i] != shouldHave[i]) {
+        if (seas[i] != 1 && episodesInShow[i] != episodesInSeasons[i]) {
             badEpisodes += 1
-            print "    "showTitle[i] " should have " shouldHave[i] " instead of " \
-                doesHave[i] " episodes."
+            print "    "showTitle[i] "'s " seasonsFound[i] " seasons claim "\
+                  episodesInSeasons[i] " episodes, found "\
+                  episodesInShow[i] " in " seas[i] " seasons."
             print showTitle[i] >> REPAIR_SHOWS
         }
     }
     if (badEpisodes > 0 ) {
         badEpisodes == 1 ? field = "URL" : field = "URLs"
         printf ("==> %2d shows with wrong number of episodes in %s\n", badEpisodes, FILENAME) \
-            > "/dev/stderr"
+                > "/dev/stderr"
     }
 }


mawk doesn't recognize 0X constants within expressions. (dm)

--- Programs/brlapi_constants.awk
+++ Programs/brlapi_constants.awk
@@ -89,5 +89,5 @@
   print "#define BRLAPI_DOTS(" arguments ") (\\\n" expression " \\\n)"

   print ""
-  writeMacroDefinition("BRLAPI_DOT_CHORD", 0X100, "space key")
+  writeMacroDefinition("BRLAPI_DOT_CHORD", 256, "space key")
 }


Added link to homepage in reference pages.

--- utils/pydoc2html.awk
+++ utils/pydoc2html.awk
@@ -22,7 +22,7 @@
           print "<title>PyInventor</title>";
           print "
";
           print "View on GitHub";
-          print "
PyInventor

3D Graphics in Python with Open Inventor
";
+          print "
PyInventor

3D Graphics in Python with Open Inventor
";
           print "
";

           print "

";


Add WASM

Add WASM

--- tools/git/scripts/annotate_file_type.awk
+++ tools/git/scripts/annotate_file_type.awk
@@ -140,6 +140,10 @@
 	print "plaintext" OFS $1 OFS $2
 	next
 }
+/\.wasm$/ {
+	print "WASM" OFS $1 OFS $2
+	next
+}
 /\.woff$/ {
 	print "fonts" OFS $1 OFS $2
 	next


Fix extra quotes in BBox showTitle

Fix extra quotes in BBox showTitle

--- getBBoxEpisodesFrom-webscraper.awk
+++ getBBoxEpisodesFrom-webscraper.awk
@@ -74,6 +74,14 @@
     if (match (episodeTitle, /^Season [[:digit:]]*, |^Series [[:digit:]]*, /))
         episodeTitle = substr(episodeTitle,RLENGTH+1)

+    # Get rid of initial/trailing quotes in showTitle
+    # "BBC Three's ""Murdered By..."" Collection Trailer"
+    if (showTitle ~ /^".*"$/) {
+        print "    Correcting extra quotes in:\n        " showTitle >> ERROR_FILE
+        sub (/^"/,"",showTitle)
+        sub (/"$/,"",showTitle)
+    }
+
     # Non-existent fields in movies or episodes
     if (URL ~ /^\/us\/movie\//) {
         depth = "1"
@@ -86,6 +94,9 @@
         numEpisodes = ""
         fullTitle = showTitle ", " sortkey ", " episodeTitle
     }
+
+    # Fix two consecutive double quotes in showTitle, but leave in fullTitle
+    gsub ("\"\"","\"",showTitle)

     # Create spreadsheet row in common format
     savedLine = sprintf \


Fix vim typo

Fix vim typo

--- getBritBoxFrom-scrapy_xml.awk
+++ getBritBoxFrom-scrapy_xml.awk
@@ -12,7 +12,7 @@

 # Example input lines
 #
-# <URL>/us/movie/70_Glorious_Years_13550</URL><Title>70 Glorious Years</Title><Subtitle></Subtitle>i\
+# <URL>/us/movie/70_Glorious_Years_13550</URL><Title>70 Glorious Years</Title><Subtitle></Subtitle>\
 # <Duration>60</Duration><Year>1996</Year><Rating>TV-PG</Rating>
 #
 # <URL>/us/episode/Vera_S3_E1_13502</URL><Title>Vera</Title><Subtitle>Season 3, Castles in The Air</Subtitle>\


Take in the new data format.

Take in the new data format.

--- energy-data-processing/battery-drain-average.awk
+++ energy-data-processing/battery-drain-average.awk
@@ -3,7 +3,7 @@
 # measurement number, timestamp, milliamperes, volts

 BEGIN{
-  FS=","
+#  FS=","
   # With 5kHz, this gives 2 samples per second.
   if ( span < 1){
       span=2500
@@ -29,9 +29,9 @@

 # Data lines:
 {
-    sumA+=$3
-    sumV+=$4
-    sec+=$2
+    sumA+=$2
+#    sumV+=$4
+    sec+=$1
     count+=1
 }

@@ -62,3 +62,4 @@
     print hrs":"mins":"secs,(battery-prev-sumA/count/3600)/battery*100,sumV/count
   }
 }
+


Languages: add Shona language

Languages: add Shona language

--- include/Languages.awk
+++ include/Languages.awk
@@ -301,6 +301,19 @@
     Locale["gd"]["iso"]                = "gla"
     Locale["gd"]["glotto"]             = "scot1245"
     Locale["gd"]["script"]             = "Latn"
+
+    #? Shona
+    Locale["sn"]["name"]               = "Shona"
+    Locale["sn"]["endonym"]            = "ChiShona"
+    #Locale["sn"]["translations-of"]
+    #Locale["sn"]["definitions-of"]
+    #Locale["sn"]["synonyms"]
+    #Locale["sn"]["examples"]
+    #Locale["sn"]["see-also"]
+    Locale["sn"]["family"]             = "Atlantic-Congo"
+    Locale["sn"]["iso"]                = "sna"
+    Locale["sn"]["glotto"]             = "core1255"
+    Locale["sn"]["script"]             = "Latn"

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


Made callouts in docs prettier and copy+paste friendly.

--- docs/postprocessor/processor.awk
+++ docs/postprocessor/processor.awk
@@ -19,13 +19,33 @@

 BEGIN {
   firstMatch=1
+  styled=0
 }

 /Licensed to the Apache Software Foundation/ {
   isHeader=1
 }

-firstMatch || !isHeader
+/<\/style>/ {
+  if (!styled) {
+    print ".invisible {position: absolute; left: 9999px}"
+    styled=1
+  }
+}
+
+!// {
+  if (firstMatch || !isHeader) {
+    print gensub(/()\(([0-9]+)\)(<\/b>)/,
+                 "//\\1\\2\\3", "g")
+  }
+}
+
+// {
+  if (firstMatch || !isHeader) {
+    print gensub(/\/\/<\/span>()\(([0-9]+)\)(<\/b>)/,
+                 "//\\1\\2\\3\\\\<\/span>", "g")
+  }
+}

 /under the License\./ {
   firstMatch=0


repeated matching of backquoted stuff

repeated matching of backquoted stuff


Fix license.

Fix license.

--- contrib/gprof2dot.awk
+++ contrib/gprof2dot.awk
@@ -1,7 +1,12 @@
-# Copyright (c) AT&T Corp. 1994, 1995.
-# This code is licensed by AT&T Corp.  For the
-# terms and conditions of the license, see
-# http://www.research.att.com/orgs/ssr/book/reuse
+/*************************************************************************
+ * Copyright (c) 2011 AT&T Intellectual Property
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/

 # remove leading underscore, then translate leading dot to underscore
 function canon(s) {


updates to awk script

updates to awk script

--- FactomTests/FactoidTest/validate.awk
+++ FactomTests/FactoidTest/validate.awk
@@ -1,4 +1,4 @@
-
+#!\ /bin/gawk
 # This is to fix the fact that without modifing Factom, the Genesis block is already
 # complete before we can print.  So it already has the reward added.  But to make our
 # code work, we need to remove the reward.


Little change to process.awk

Little change to process.awk

Signed-off-by: Lu Yong <3812e7ccba28440a3ea55b89d289fd7e0e30069d@cn.ibm.com>


SCCS mkdoc.awk 10/06/22 08:50:28: Replaced script headers for Open Source release

--- run/mkdoc.awk
+++ run/mkdoc.awk
@@ -1,10 +1,12 @@
 #-------------------------------------------------------------------------------
-# Phorward SDK - mkdoc :: Documentation Generator
+# Phorward Software Development Kit
 # Copyright (C) 2009, 2010 by Phorward Software Technologies, Jan Max Meyer
-# http://www.phorward-software.com ++ mail<<AT>>phorward-software<<DOT>>com
+# http://www.phorward-software.com ++ contact<at>phorward<dash>software<dot>com
+# All rights reserved. See $PHOME/LICENSE for more information.
 #
 # Script:		mkdoc.awk
 # Author:		Jan Max Meyer
+# Usage:		Template-based documentation generator
 #-------------------------------------------------------------------------------

 BEGIN	{


addr_utils.awk		-- new func AU_match() that handles street ranges

--- lib/addr_utils.awk
+++ lib/addr_utils.awk
@@ -1,4 +1,4 @@
-function AU_parse(rply, addr, result, towns, st_types, st_quals, dirs,   nf, ary, i, f_st, nf2, ary2, i1, name, street, quals, town, k) {
+function AU_parse(rply, do_subs, addr, result, towns, st_types, st_quals, dirs,   nf, ary, i, f_st, nf2, ary2, i1, name, street, quals, town, k) {

 	result["status"] = "B"
 	result["emsg"  ] = ""
@@ -15,6 +15,7 @@
 	}

 	if(rply){
+		# TODO: generalize to all states?
 		if(ary[nf] != "United States of America"){
 			result["emsg"] = "not.usa"
 			return 1
@@ -45,7 +46,7 @@
 		result["emsg"] = "bad.town"
 		return 1
 	}
-	town = towns[ary[nf]]
+	town = do_subs ? towns[ary[nf]] : ary[nf]

 	# find the street.
 	# street is 1) 1st elt of ary[1:nf-1] that begins w/number & ends w/st_type or 2) last elt of ary[1:nf-1] that begins w/number
@@ -92,30 +93,36 @@
 	# Street Hacks: Probably should just compare ignore case but not ready for that step yet
 	# change el Camino X to El Camino X
 	# change el Monte X  to El Monte X
-	if(nf2 > 3){
-		if(ary2[nf2-2] == "el" && ary2[nf2-1] == "Camino")
-			ary2[nf2-2] = "El"
-		else if(ary2[nf2-2] == "el" && ary2[nf2-1] == "Monte")
-			ary2[nf2-2] =  "El"
+	if(do_subs){
+		if(nf2 > 3){
+			if(ary2[nf2-2] == "el" && ary2[nf2-1] == "Camino")
+				ary2[nf2-2] = "El"
+			else if(ary2[nf2-2] == "el" && ary2[nf2-1] == "Monte")
+				ary2[nf2-2] =  "El"
+		}
 	}

 	# Street should be num [ dir ] str [ st ]
 	street = ary2[1]
-
-	# This is amusing.  What is South Court? Is is S. Court or South Ct.  No idea so, leave such streets in long form
-	if(nf2 == 3 && (ary2[2] in dirs) && (ary2[3] in st_types)){
+	if(do_subs){
+		# This is amusing.  What is South Court? Is is S. Court or South Ct.  No idea so, leave such streets in long form
+		if(nf2 == 3 && (ary2[2] in dirs) && (ary2[3] in st_types)){
+			for(i = 2; i <= nf2; i++)
+				street = street " " ary2[i]
+		}else{
+			if(ary2[2] in dirs){
+				street = street " " dirs[ary2[2]]
+				i1 = 3
+			}else
+				i1 = 2
+			for(i = i1; i < nf2; i++){
+				street = street " " ary2[i]
+			}
+			street = street ((ary2[nf2] in st_types) ? (" " st_types[ary2[nf2]]) : (" " ary2[nf2]))
+		}
+	}else{
 		for(i = 2; i <= nf2; i++)
 			street = street " " ary2[i]
-	}else{
-		if(ary2[2] in dirs){
-			street = street " " dirs[ary2[2]]
-			i1 = 3
-		}else
-			i1 = 2
-		for(i = i1; i < nf2; i++){
-			street = street " " ary2[i]
-		}
-		street = street ((ary2[nf2] in st_types) ? (" " st_types[ary2[nf2]]) : (" " ary2[nf2]))
 	}

 	result["status"] = "G"
@@ -138,3 +145,54 @@
 	}
 	return n_data
 }
+function AU_match(cand, ref,   is_mat, i, n_cand_st, cand_st, cand_odd, n_ref_st, ref_st, ref_odd) {
+
+	is_mat = 0
+
+	# deal with street ranges
+	n_cand_st = split(cand["street"], cand_st, /-/)
+	n_ref_st = split(ref["street"], ref_st, /-/)
+
+	# US rule: require all numbers to be either odd or even
+	cand_odd = cand_st[1] % 2
+	for(i = 2; i <= n_cand_st; i++){
+		if(cand_st[i] % 2 != cand_odd){
+			printf("ERROR: odd/even candidate address range: %s\n", cand["street"]) > "/dev/stderr"
+			return 0
+		}
+	}
+	n_ref_st = split(ref["street"], ref_st, /-/)
+	ref_odd = ref_st[1] % 2
+	for(i = 2; i <= n_ref_st; i++){
+		if(ref_st[i] % 2 != ref_odd){
+			printf("ERROR: odd/even reference address range: %s\n", ref["street"]) > "/dev/stderr"
+			return 0
+		}
+	}
+	if(cand_odd != ref_off)
+		return 0
+
+	# odd/even good, check the actual numbers/ranges
+	if(n_cand_st == 1){
+		if(n_ref_st == 1){
+			printf("DEBUG: AU_match: case 1: c.N v r.N: %d vs %d\n", cand_st[1], ref_st[1]) > "/dev/stderr"
+			is_mat = cand_st[1] == ref_st[1]
+		}else{
+			printf("DEBUG: AU_match: case 2: c.N v r.R: %d vs %d-%d\n", cand_st[1], ref_st[1], ref_st[2]) > "/dev/stderr"
+			is_mat = cand_st[1] >= ref_st[1] && cand_st[1] <= ref_st[2];
+		}
+	}else if(n_ref_st == 1){
+		printf("DEBUG: AU_match: case 3: c.R v r.N: %d-%d vs %d\n", cand_st[1], cand_st[2], ref_st[1]) > "/dev/stderr"
+		is_mat = ref_st[1] >= cand_st[1] && ref_st[1] <= cand_st[2]
+	}else{
+		printf("DEBUG: AU_match: case 4: c.R v r.R: %d-%d vs %d-%d\n", cand_st[1], cand_st[2], ref_st[1], ref_st[2]) > "/dev/stderr"
+		is_mat = !(cand_st[2] < ref_st[1] || cand_st[1] > ref_st[2])
+	}
+
+	# streets are good, deal with towns
+	if(is_mat){
+		is_mat = cand["town"] == ref["town"]
+	}
+
+	return is_mat
+}


TestCommons: add explode()

TestCommons: add explode()

--- test/TestCommons.awk
+++ test/TestCommons.awk
@@ -72,6 +72,13 @@
         delete array; array[0] = "foo"; array[1] = "bar"
         assertEqual(join(array, " "), "foo bar")
         assertEqual(join(array, ","), "foo,bar")
+    }
+    T("explode()", 1)
+    {
+        delete array
+        delete expected; expected[1] = "f"; expected[2] = "o"; expected[3] = "o"
+        explode("foo", array)
+        assertTrue(identical(array, expected))
     }
     T("escapeChar()", 8)
     {


tag_dll.awk: tag exports work with Open C, too

darcs-hash:20070628122057-1b897-b8c8d7e541c699c1bb48f84b6e137bbae6fc7416.gz

--- libsofia-sip-ua/su/tag_dll.awk
+++ libsofia-sip-ua/su/tag_dll.awk
@@ -92,7 +92,7 @@
 	 "#include \"config.h\"\n\n"\
 	 "#include <sofia-sip/su_tag_class.h>\n"\
 	 "\n"\
-	 "#ifdef _WIN32\n"\
+	 "#if defined _WIN32 || defined HAVE_OPEN_C\n"\
 	 "#define EXPORT __declspec(dllexport)\n"\
 	 "#else\n"\
 	 "#define EXPORT\n"\


Special case.

Special case.

--- src/cloudfront.awk
+++ src/cloudfront.awk
@@ -56,15 +56,28 @@
         printf ",\n"
     }
     split($0, fieldsThisLine, " ")
+    urlIndex = 0
     if (NF == numFields) {
         print "\t{"
         for(i = 1; i < NF; i++)
         {
-            printf "\t\t\"%s\": \"%s\"", fields[i], fieldsThisLine[i]
-            if (i + 1 < NF) {
+            fieldName = fields[i]
+            if (fieldName == "cs-uri-query") {
+                urlIndex = i;
+                continue;
+            }
+            fieldValue = fieldsThisLine[i]
+            maybeDecoded = (fieldName == "cs-uri-query" ? urlDecode(fieldValue) : fieldValue)
+            printf "\t\t\"%s\": \"%s\"", fieldName, fieldValue
+            if (i + 1 < NF && urlIndex > 0) {
                 printf ","
             }
             printf "\n"
+        }
+        if (urlIndex > 0) {
+            printf "\t\t\"cs-url-query\": {\n"
+            printUrlQueryString(fieldsThisLine[urlIndex])
+            printf "}\n"
         }
         printf "\t}"
     }


Fixed a test script.

Fixed a test script.

--- osm-3s_testing/expected/set_variables.awk
+++ osm-3s_testing/expected/set_variables.awk
@@ -10,7 +10,7 @@
     else
       inner_line = 1;

-    gsub("\$\{testdir\}",testdir);
+    gsub("\\${testdir}",testdir);
     printf $0;
   }
 }


tools: update log-analyze to search for GWRequestHandler

Signed-off-by: Jan Viktorin <3eab6ac54c005c4408f608556a6663b7f2abede7@fit.vutbr.cz>

--- tools/log-analyze.awk
+++ tools/log-analyze.awk
@@ -448,7 +448,7 @@
 	restui_clients[_ip] += 1
 }

-/WebSocketRequestHandler/ && /connection from / {
+/GWRequestHandler/ && /connection from / {
 	$0 = log_trim_left($0)

 	split($3, _addr, ":")


Translate: update using exists()

Translate: update using exists()

--- include/Translate.awk
+++ include/Translate.awk
@@ -126,7 +126,7 @@
     } else if (isRTL(tl)) {
         # Check if target language is R-to-L
         if (!FriBidi)
-            w("[WARNING] " getName(tl) " is a right-to-left language, but FriBidi cannot be found.")
+            w("[WARNING] " getName(tl) " is a right-to-left language, but FriBidi is not found.")
     }

     content = getResponse(text, sl, tl, hl)
@@ -245,8 +245,8 @@
             wShowOriginalDictionary = 1
             wShowTranslation = 0
         }
-        hasWordClasses = isarray(wordClasses) && anything(wordClasses)
-        hasAltTranslations = isarray(altTranslations[0]) && anything(altTranslations[0])
+        hasWordClasses = exists(wordClasses)
+        hasAltTranslations = exists(altTranslations[0])
         if (!hasWordClasses && !hasAltTranslations)
             wShowPromptMessage = wShowLanguages = 0
         if (!hasWordClasses) wShowDictionary = 0
@@ -313,7 +313,7 @@

         if (wShowOriginalDictionary) {
             # Display: original dictionary
-            if (isarray(oWordClasses) && anything(oWordClasses)) {
+            if (exists(oWordClasses)) {
                 # Detailed explanations
                 if (r) r = r RS
                 r = r m("-- display original dictionary (detailed explanations)")
@@ -338,7 +338,7 @@
                     }
                 }
             }
-            if (isarray(oSynonymClasses) && anything(oSynonymClasses)) {
+            if (exists(oSynonymClasses)) {
                 # Synonyms
                 r = r RS RS
                 r = r m("-- display original dictionary (synonyms)")
@@ -355,7 +355,7 @@
                     }
                 }
             }
-            if (isarray(oExamples) && anything(oExamples)) {
+            if (exists(oExamples)) {
                 # Examples
                 r = r RS RS
                 r = r m("-- display original dictionary (examples)")
@@ -374,7 +374,7 @@
                     r = (i > 0 ? r RS : r) RS temp
                 }
             }
-            if (isarray(oSeeAlso) && anything(oSeeAlso)) {
+            if (exists(oSeeAlso)) {
                 # See also
                 r = r RS RS
                 r = r m("-- display original dictionary (see also)")


Languages: mark as stable: Kurdish

Languages: mark as stable: Kurdish

--- include/Languages.awk
+++ include/Languages.awk
@@ -179,8 +179,7 @@
     Locale["ky"]["glotto"]             = "kirg1245"
     Locale["ky"]["script"]             = "Cyrl"

-    #? Kurdish (Central Kurdish, Sorani), Latin alphabet
-    Locale["ku"]["support"]            = "unstable"
+    # Kurdish (Central Kurdish, Sorani), Latin alphabet
     Locale["ku"]["name"]               = "Kurdish"
     Locale["ku"]["endonym"]            = "Kurdî"
     #Locale["ku"]["translations-of"]


x86: Fix the error of using "const" in gen-insn-attr-x86.awk

The original version code causes following sparse warnings:
arch/x86/lib/inat-tables.c:1080:25: warning: duplicate const
arch/x86/lib/inat-tables.c:1095:25: warning: duplicate const
arch/x86/lib/inat-tables.c:1118:25: warning: duplicate const

for the variables inat_escape_tables, inat_group_tables, and inat_avx_tables
in the code generated by gen-insn-attr-x86.awk.

The author Masami Hiramutsu says here is to make both the value pointed by the
pointers and the pointers itself read-only, so we move the "const" to be after
the "*".

Signed-off-by: Cong Ding <8001b54ad539330acc19ca3e17ac1f04f07b36a6@gmail.com>
Link: 3ec41833c29d285066dfad622a5b82e61ee0def7@gmail.com
Acked-by: Masami Hiramatsu <60fcdccfd958d359debfe6e6e7417cd7f1aaa9e3@hitachi.com>
Signed-off-by: H. Peter Anvin <8a453bad9912ffe59bc0f0b8abe03df9be19379e@linux.intel.com>

--- arch/x86/tools/gen-insn-attr-x86.awk
+++ arch/x86/tools/gen-insn-attr-x86.awk
@@ -356,7 +356,7 @@
 		exit 1
 	# print escape opcode map's array
 	print "/* Escape opcode map array */"
-	print "const insn_attr_t const *inat_escape_tables[INAT_ESC_MAX + 1]" \
+	print "const insn_attr_t * const inat_escape_tables[INAT_ESC_MAX + 1]" \
 	      "[INAT_LSTPFX_MAX + 1] = {"
 	for (i = 0; i < geid; i++)
 		for (j = 0; j < max_lprefix; j++)
@@ -365,7 +365,7 @@
 	print "};\n"
 	# print group opcode map's array
 	print "/* Group opcode map array */"
-	print "const insn_attr_t const *inat_group_tables[INAT_GRP_MAX + 1]"\
+	print "const insn_attr_t * const inat_group_tables[INAT_GRP_MAX + 1]"\
 	      "[INAT_LSTPFX_MAX + 1] = {"
 	for (i = 0; i < ggid; i++)
 		for (j = 0; j < max_lprefix; j++)
@@ -374,7 +374,7 @@
 	print "};\n"
 	# print AVX opcode map's array
 	print "/* AVX opcode map array */"
-	print "const insn_attr_t const *inat_avx_tables[X86_VEX_M_MAX + 1]"\
+	print "const insn_attr_t * const inat_avx_tables[X86_VEX_M_MAX + 1]"\
 	      "[INAT_LSTPFX_MAX + 1] = {"
 	for (i = 0; i < gaid; i++)
 		for (j = 0; j < max_lprefix; j++)


asdas

asdas

--- awk/nb.awk
+++ awk/nb.awk
@@ -25,7 +25,7 @@
     array0(count,i)
     return i
 }
-function sym(c,x,_Sym,   new) {
+function sym1(c,x,_Sym,   new) {
     n[c]++
     counts[c][x]++
     new = counts[c][x]
@@ -33,7 +33,7 @@
         most[c] = new
         mode[c] = x }
 }
-function num(c,x,_Num,   delta) {
+function num1(c,x,_Num,   delta) {
     if (n > up[c]) up[c] = n
     if (n < lo[c]) lo[c] = n
     delta = x - mu[c]
@@ -43,38 +43,59 @@
 function sd(c,_Num) {
     return (m2[c] / (n[c] - 1))^0.5
 }
-function readcsv(com,m,_Num,_Sym,_Out,txt,    rows,i,_Num) {
+function entireLine(line,   tmp) {
+    gsub(/[ \t\r]/, "", line)
+    gsub(/##.*/   , "", line)
+    if ( line !~ /,$/ )
+        return line
+    if ((getline tmp) == 0)
+        return line
+    return line entireLine(tmp)
+}
+function using(cells0, use, cells) {
+    for(c in use)
+        cells[c] = cells0[ uses[c] ]
+}
+function usable(cells0, use,cells,  c0,c) {
+    max = length(cells0)
+    for(c0=1; c0 <= max; c0++)
+        if (cells0[c0] !~ /^X/)
+            use[++c] = c0;
+    using(cells0,use,cells)
+}
+function readcsv(com,m,_Num,_Sym,_Out,txt, \
+                 cell,srows,i,use,_Num) {
   com = com ? com : "cat -"
   while((com | getline)  > 0)  {
-    gsub(/[ \t\r]/,"")
-    gsub(/##.*/,"")
-    if ($0) {
-        for(i=1;i<=NF;i++)
-            line[i] = $i;
-        if (rows)
-            row(line,rows,m, _Num, _Sym)
-        else
-            header(line,r,m, _Num, _Sym, _Out);
-        rows++ }}
+      line = entireLine($0)
+      if (line) {
+          split(line,cells0,",")
+          rows++
+          if (rows==1) {
+              usable(cells0, use, cells)
+              head(cells,m,use, _Num, _Sym, _Out)
+          }
+          else {
+              using(cells0, use, cells)
+              row( cells,m, rows-1, _Num, _Sym) }}}
 }
-function row(line,r,m, _Num,_Sym,  c) {
-    for(c in line) {
+function row(cells,m,r, _Num,_Sym,  c) {
+    for(c in cells) {
         if (c in lo) {
-            line[c] += 0
-            num(c, line[c], _Num)
+            cells[c] += 0
+            num1(c, cells[c], _Num)
         } else
-            sym(c, line[c], _Sym)
+            sym1(c, cells[c], _Sym);
         m[r][c] = line[c]}
 }
-function header(line,txt,_Num,_Sym, _Out,   c) {
-    for(c in line)
+function head(line,m, _Num,_Sym, _Out,   c0,c) {
+    for(c in line) {
         if ( $c ~ /^</ ) less[c]
         if ( $c ~ /^>/ ) more[c]
         if ( $c ~ /^=/ ) klass[c]
-        if ( $c ~ /^X/ ) {
-            txt[c] = line[c]
-            if ( $c ~ /^_/ )
-               num0(_Num, c)
-            else
-                sym0(_Sym,c) }
+        txt[c] = line[c]
+        if ( $c ~ /^_/ )
+            num0(_Num, c)
+        else
+            sym0(_Sym,c) }
 }


Translators/BingTranslator: fix original phonetics (purge old AST)

--- include/Translators/BingTranslator.awk
+++ include/Translators/BingTranslator.awk
@@ -278,11 +278,12 @@
             split(_sl, group, "-")
             #content = postResponse(text, group[1], group[1], _hl, "transliterate")
             #oPhonetics = unparameterize(content)
+            delete ast  # purge old AST
             content = postResponse(text, il, il, _hl, "translate")
             tokenize(tokens, content)
             parseJson(ast, tokens)
-            oPhonetics = unparameterize(ast[0 SUBSEP 0 SUBSEP "translations" SUBSEP 0 SUBSEP "transliteration" \
-                                            SUBSEP "text"])
+            oPhonetics = unparameterize(ast[0 SUBSEP 0 SUBSEP "translations" SUBSEP 0 \
+                                            SUBSEP "transliteration" SUBSEP "text"])
             if (oPhonetics == text) oPhonetics = ""
         }


Commons: add "\t" to initUrlEncoding (fix #108)

--- include/Commons.awk
+++ include/Commons.awk
@@ -420,6 +420,7 @@
 # Initialize `UrlEncoding`.
 # See: <https://en.wikipedia.org/wiki/Percent-encoding>
 function initUrlEncoding() {
+    UrlEncoding["\t"] = "%09"
     UrlEncoding["\n"] = "%0A"
     UrlEncoding[" "]  = "%20"
     UrlEncoding["!"]  = "%21"


parsegaspriceshtml.awk: Updated for Marathon. Disabled broken code for UDF.

--- parsegaspriceshtml.awk
+++ parsegaspriceshtml.awk
@@ -35,12 +35,13 @@
 }

 inGasPriceRecord && expectName && / <a href="/ {
-   gsub("","Marathon")
+   gsub("","Marathon")
    gsub("","BP")
    gsub("","Thorntons")
    gsub("","Thorntons")
    gsub("","Certified")
    gsub("","Marathon")
+   # gsub("","UDF")
    expectName=False
    sub("[ ]*$","")
    sub("^.*>","")


Fix feature films, movies, and cryptoftears

--- getAcornFrom-seriesPages.awk
+++ getAcornFrom-seriesPages.awk
@@ -68,6 +68,10 @@
 #  OUTPUT:
 #       $EPISODE_INFO_FILE
 #
+
+BEGIN {
+    SINGLES_FILE = "single_episodes.txt"
+}

 # Extract the series title
 /span itemprop="name"/ {
@@ -171,12 +175,16 @@
     # Create shorter URL by removing https://
     shortURL = episodeURL
     sub (/.*acorn\.tv/,"acorn.tv",shortURL)
-    # Feature films don't have episodes
-    if (episodeURL ~ /\/featurefilm\//)
+    # Feature films and movies don't have episodes
+    if (episodeURL ~ /\/feature\// || episodeURL ~ /\/featurefilm\// || episodeURL ~ /\/movie\//) {
+        print "Feature/Movie-1: " episodeURL >> SINGLES_FILE
         next
+    }
     # neither should single episode series
-    if (totalEpisodes == 1)
+    if (totalEpisodes == 1) {
+        print "SingleEpisode-1: " episodeURL >> SINGLES_FILE
         next
+    }
     print "url = \"" episodeURL "\"" >> EPISODE_CURL_FILE
     next
 }
@@ -254,11 +262,12 @@
     if (episodeURL ~ /\/bonus|[0-9]{1,2}parttwo\/|christmas[-]?special/)
         episodeType = "X"
     # If episode is a Trailer, set episodeType to "T"
-    if (episodeURL ~ /\/trailer/)
+    if (episodeURL ~ /_cs\//)
         episodeType = "T"
-    # jamaicainn, newworlds & newtonslaw bonus or trailer seasonNumber should be 1
+    # cryptoftears, newworlds & newtonslaw bonus seasonNumber should be 1
+    # jamaicainn bonus or trailer has been removed from Acorn TV
     if (episodeURL ~ \
-        /\/jamaicainn\/bonus\/|\/jamaicainn\/trailer\/|\/newworlds\/bonus\/|\/newtonslaw\/bonus\// \
+        /\/cryptoftears\/bonus\/|\/newworlds\/bonus\/|\/newtonslaw\/bonus\// \
         && seasonNumber != 1) {
         split (episodeURL, part, "/")
         printf ("==> Changed S%02d to S01: acorn.tv/%s/%s\n", \
@@ -275,12 +284,16 @@
     #
     split ($0,fld,"[<>]")
     episodeNumber = fld[5]
-    # Feature films don't have episodes
-    if (episodeURL ~ /\/featurefilm\//)
+    # Feature films and movies don't have episodes
+    if (episodeURL ~ /\/feature\// || episodeURL ~ /\/featurefilm\// || episodeURL ~ /\/movie\//) {
+        print "Feature/Movie-2: " episodeURL >> SINGLES_FILE
         next
+    }
     # neither should single episode series
-    if (totalEpisodes == 1)
+    if (totalEpisodes == 1) {
+        print "SingleEpisode-2: " episodeURL >> SINGLES_FILE
         next
+    }
     # The season number should match that in the URL
     # Birds of a Feather, Doc Martin, Murdoch, Poirot, Rebus, Vera, and others have problems
     if (episodeURL ~ \


tests: tighten sigaction check

tests: tighten sigaction check

* tests/sigaction.awk: Check that input conatins all expected lines.

--- tests/sigaction.awk
+++ tests/sigaction.awk
@@ -24,7 +24,13 @@
 NR == 4 && /^\+\+\+ exited with 0 \+\+\+$/ {next}

 {
-  print "Line " NR " does not match:"
-  print
+  print "Line " NR " does not match: " $0
   exit 1
 }
+
+END {
+  if (NR != 4) {
+    print "Expected 4 lines, found " NR " line(s)."
+    exit 1
+  }
+}


fixing to work on ubuntu

fixing to work on ubuntu

--- lib/resplit.awk
+++ lib/resplit.awk
@@ -1,6 +1,6 @@
 #!/usr/bin/gawk -f

-@include "join"
+@include "join.awk"
 BEGIN {
   true = 1
   false = 0


Accumulate structure, print later.

Accumulate structure, print later.

--- src/cloudfront.awk
+++ src/cloudfront.awk
@@ -1,17 +1,13 @@
 function printUrlQueryString(queryString, j)
 {
     split(queryString, pairs, "&")
-    len = length(pairs)
     for (j = 1; j < len; ++j) {
         split(pairs[j], keyValue, "=")
         k = keyValue[1]
         v = keyValue[2]
-        printf "\t\t\t\t\"%s\": \"%s\"", k, urlDecode(urlDecode(v))
-        if (j + 1 < len) {
-            printf ","
-        }
-        printf "\n"
+        result[k] = v
     }
+    return result
 }

 function base64Decode(thing)
@@ -33,24 +29,81 @@
 }

 BEGIN {
-    logLineSeen = 0
-    print "{";
+
+}
+
+function enrich(property, n, j)
+{
+    if ("cs-uri-query" == property) {
+        queryString = logs[n][property]
+        delete logs[n][property]
+        parsed = urlDecode(queryString)
+        split(queryString, pairs, "&")
+        len = length(pairs)
+        for (j = 1; j < len; ++j) {
+            split(pairs[j], keyValue, "=")
+            k = keyValue[1]
+            v = keyValue[2]
+            result[k] = v
+            logs[n][property][k] = v
+        }
+    }
 }

 END {
-    printf "\n\t]\n"
+    print "{"
+    printf "\"version\": \"%s\",\n", version
+    print "\"records\": ["
+    numLogs = length(logs)
+    i = 1
+    for (lineNr in logs)
+    {
+        printf "{\n";
+        j = 1
+        for (j = 1; j < numFields; j++)
+        {
+            field = fields[j]
+            enrich(field, lineNr)
+            if(isarray(logs[lineNr][field])) {
+                printf "\"%s\": {\n", field
+                k = 1
+                numSubFields = length(logs[lineNr][field])
+                for (subField in logs[lineNr][field]) {
+                    printf "\"%s\": \"%s\"", subField, logs[lineNr][field][subField]
+                    if (k < numSubFields) {
+                        printf ","
+                    }
+                    k++
+                    printf "\n"
+                }
+                print "}"
+            } else {
+                printf "\"%s\": \"%s\"", field, logs[lineNr][field]
+            }
+            if (j + 1 < numFields) {
+                printf ","
+            }
+            printf "\n"
+        }
+        printf "}"
+        if (i < numLogs) {
+            printf ","
+        }
+        printf "\n"
+        i++
+    }
+    print "]"
     print "}"
 }

 /^#Version: / {
-    printf "\t\"version\": \"%s\",\n", substr($0, length("#Version: ") + 1)
+    version = substr($0, length("#Version: ") + 1)
 }

 /^#Fields: / {
     rest = substr($0, length("#Fields: ") + 1)
     split(rest, fields, " ")
     numFields = length(fields)
-    printf "\t\"records\": [\n"
 }

 /^#/ {
@@ -58,34 +111,10 @@
 }

 ! /^#/ {
-    if (logLineSeen == 1) {
-        printf ",\n"
+    split($0, fieldsThisLine, " ")
+    numFieldsThisLine = length(fieldsThisLine)
+    for (i = 1; i < numFieldsThisLine; i++)
+    {
+         logs[NR][fields[i]] = fieldsThisLine[i]
     }
-    split($0, fieldsThisLine, " ")
-    urlIndex = 0
-    if (NF == numFields) {
-        print "\t\t{"
-        for(i = 1; i < NF; i++)
-        {
-            fieldName = fields[i]
-            if (fieldName == "cs-uri-query") {
-                urlIndex = i;
-                continue;
-            }
-            fieldValue = fieldsThisLine[i]
-            maybeDecoded = (fieldName == "cs-uri-query" ? urlDecode(fieldValue) : fieldValue)
-            printf "\t\t\t\"%s\": \"%s\"", fieldName, fieldValue
-            if (i + 1 < NF && urlIndex > 0) {
-                printf ","
-            }
-            printf "\n"
-        }
-        if (urlIndex > 0) {
-            printf "\t\t\t\"cs-url-query\": {\n"
-            printUrlQueryString(fieldsThisLine[urlIndex])
-            printf "\t\t\t}\n"
-        }
-        printf "\t\t}"
-    }
-    logLineSeen = 1;
 }


more progress on parsing

more progress on parsing

--- getFullcastFrom-imdb.awk
+++ getFullcastFrom-imdb.awk
@@ -24,6 +24,9 @@
         type = "Actor"
         gsub (/[[:blank:]]{3,99}\(uncredited\)/," (uncredited)",Cast)
         gsub (/[[:blank:]]{3,99}\/ \.\.\./," / ...",Cast)
+        extra = sub (/\(extra\) ?/,"",Cast)
+        if (extra != 0)
+            type = type " (extra)"
         uncredited = sub (/\(uncredited\) ?/,"",Cast)
         if (uncredited != 0)
             type = type " (uncredited)"
@@ -32,11 +35,15 @@
         role = fld[3]
         sub (/\302\240/,"",role)
         episodes = fld[4]
-        nflds2 = split (episodes,fld,/,/)
-        num_episodes = fld[1]
-        sub (/ episodes?/,"",num_episodes)
-        episode_years = fld[2]
-        sub (/ /,"",episode_years)
+        if (episodes !~ /episodes?/) {
+            person = person " " episodes
+        } else {
+            nflds2 = split (episodes,fld,/,/)
+            num_episodes = fld[1]
+            sub (/ episodes?/,"",num_episodes)
+            episode_years = fld[2]
+            sub (/ /,"",episode_years)
+        }
     }

     if (Directors != "") {
@@ -61,10 +68,8 @@
         person = fld[1]
         parens = fld[3]
         nparens = split (parens,fld,/[()]/)
-        # print "==> parens = " parens > "/dev/stderr"
         for ( i = 2; i < nparens-1; i+=2 ) {
             if (fld[i] != " ") {
-                # print "==> i = " i " - |"fld[i] "|" > "/dev/stderr"
                 type = type " (" fld[i] ")"
             }
         }
@@ -80,6 +85,6 @@
         }
     }

-    printf ("%s %s | %s | %s | %s | %s | %s\n",Title,Years,person,type,role,num_episodes,episode_years)
+    printf ("%s %s\t%s\t%s\t%s\t%s\t%s\n",Title,Years,person,type,role,num_episodes,episode_years)

 }


Made the AWK program executable.

Made the AWK program executable.


Updated imports based on changes to python packaging CTR

--- docs/preprocessor/awk/init-code-blocks.awk
+++ docs/preprocessor/awk/init-code-blocks.awk
@@ -63,8 +63,8 @@
       print "jython.eval('from gremlin_python.process.traversal import *')"
       print "jython.eval('from gremlin_python.process.strategies import *')"
       print "jython.eval('from gremlin_python.structure.graph import Graph')"
-      print "jython.eval('from gremlin_python.structure.io.graphson import GraphSONWriter')"
-      print "jython.eval('from gremlin_python.structure.io.graphson import GraphSONReader')"
+      print "jython.eval('from gremlin_python.structure.io.graphsonV3d0 import GraphSONWriter')"
+      print "jython.eval('from gremlin_python.structure.io.graphsonV3d0 import GraphSONReader')"
       # print "jython.eval('from gremlin_python.structure.io.graphson import serializers')"
       # print "jython.eval('from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection')"
       print "jython.eval('statics.load_statics(globals())')"


add the ominous label

add the ominous label

--- tools/wiki2latex.awk
+++ tools/wiki2latex.awk
@@ -65,6 +65,8 @@
   sub(/=/, "\\section*{");
   sub(/=/, "}");
   print;
+  print "";
+  print "\\label{f0}";
   next;
 }


avoid gnu extension, for installing

avoid gnu extension, for installing

git-svn-id: 88e1a00e4eab3b0bb0c09889526309a3e2f5bd8a@42 c26eb9a1-5813-0410-bd6c-c2e55f420ca7

--- mkstructinfo.awk
+++ mkstructinfo.awk
@@ -13,15 +13,15 @@
 		if (instruct in typedefs) {
 			instruct = typedefs[instruct];
 		}
-		elm = "";
+		sizeinfo = "";
 		elms = "";
 		for (i = 0; i in buffer; i ++) {
-			if (i) elm = elm " + ";
-			# elm = elm "sizeof(((`" instruct "'*)NULL)->`" buffer[i] "')";
-			# elms = elms " `" buffer[i] "'";
-			elm = elm "sizeof(((" instruct "*)NULL)->" buffer[i] ")";
+			if (i) {
+				sizeinfo = sizeinfo " + ";
+			}
+			sizeinfo = sizeinfo "sizeof(((" instruct "*)NULL)->" buffer[i] ")";

-			if (elms == "") {
+			if (i == 0) {
 				elms = buffer[i];
 			}
 			else {
@@ -30,7 +30,7 @@
 		}
 		printf "define(`ELEMENTSOF_%s', `%s')\n", instruct, elms;
 		printf "define(`COUNTOF_%s', `%s')\n", instruct, i;
-		printf "define(`SIZEOF_%s', `(  %s  )')\n", instruct, elm;
+		printf "define(`SIZEOF_%s', `(  %s  )')\n", instruct, sizeinfo;
 		print "\n";
 		for (i in buffer) {
 			delete buffer[i];
@@ -51,20 +51,48 @@
 {
 	if (brace == 1 && instruct) {
 		sub(/.*[{}]/, "");
-		gsub(/\[[^\]]+\]/, "");
-		gsub(/:[0-9]+/, "");
-		str = $0;
-		if (match(str, /\([ ]*\*([^)]+)\)/, a)) {
-			buffer[buffer_len] = a[1];
+		gsub(/\[[^\]]+\]/, ""); # ignore [...]
+		gsub(/:[0-9]+/, ""); # ignore struct bit
+		if (match($0, /^[^(]*\([ ]*\*([^)]+)\)/)) {
+			sub(/ +/, "")
+			sub(/^[^(]*\(\*/, "");
+			sub(/\).*/, "");
+			# function pointer
+			buffer[buffer_len] = $0;
 			buffer_len ++;
 		}
 		else {
-			while (gsub(/(\([^)]*\))/, "", str)) {
+			# ignore any ()s
+			while (gsub(/(\([^)]*\))/, "")) {
 			}
-			while (match(str, /([^*() ]+)[ ]*[,;](.*)/, a)) {
-				buffer[buffer_len] = a[1];
+			if (match($0, /[()]/)) {
+				next;
+			}
+			gsub(/[*]/, " ");
+			gsub(/ +/, " ");
+			gsub(/ *[,;]/, ";");
+			if (!match($0, /;/)) {
+				next;
+			}
+			split($0, chunks, ";");
+			# get var of "int *var, var;" etc
+			for (i in chunks) {
+				if (chunks[i] == "") {
+					delete chunks[i];
+					continue;
+				}
+				split(chunks[i], pieces, " ");
+
+				for (j in pieces) {
+					last_piece = pieces[j];
+					delete pieces[i];
+				}
+				if (last_piece == "") {
+					print "=====" chunks[i];
+				}
+				buffer[buffer_len] = last_piece;
 				buffer_len ++;
-				str = a[2];
+				delete chunks[i];
 			}
 		}
 		next;


Add code for EBCDIC host. (Was already in charset_alias.h).

git-svn-id: 7fdf2791f4789e0f328ededa5c776280d6bf7afd@57740 13f79535-47bb-0310-9956-ffa450edef68

--- build/gen_aliases.awk
+++ build/gen_aliases.awk
@@ -63,6 +63,20 @@
     print "{";
     print "    struct charset_alias key;";
     print "    struct charset_alias *alias;";
+    print "#if 'A' == '\\xC1' /* if EBCDIC host */";
+    print "    /* The table is sorted in ASCII collation order, not in EBCDIC order.";
+    print "     * At the first access, we sort it automatically";
+    print "     * Criterion for the 1st time initialization is the fact that the";
+    print "     * 1st name in the list starts with a digit (in ASCII, numbers";
+    print "     * have a lower ordinal value than alphabetic characters; while";
+    print "     * in EBCDIC, their ordinal value is higher)";
+    print "     */";
+    print "    if (isdigit(charset_alias_list[0].name[0]))  {";
+    print "        qsort((void *)charset_alias_list, charset_alias_count,";
+    print "              sizeof(charset_alias_list[0]),";
+    print "              charset_alias_compare);";
+    print "    }";
+#endif
     print "    key.name = name;";
     print "    alias = bsearch(&key, charset_alias_list, charset_alias_count,";
     print "                    sizeof(charset_alias_list[0]),";


Ignore case

Ignore case

--- sql/where_clause.awk
+++ sql/where_clause.awk
@@ -10,7 +10,7 @@
 	sub(/A2_/, "", name);
 	table = name;
 }
-!comment && table == desired {
+!comment && lower(table) == lower(desired) {
 	if (!sql) {
 		split($0, parts, /A2_/);
 		sql = substr(parts[2], length(table) + 1);


bug fix

bug fix

--- utils/remove_license_block-helper.awk
+++ utils/remove_license_block-helper.awk
@@ -28,6 +28,8 @@
 	BLOCK[BLOCK_END++] = X "Contributor(\\(s\\)|s)?: .*";
 	BLOCK[BLOCK_END++] = X;
 	BLOCK[BLOCK_END++] = X "\\*\\*\\*\\*\\* END LICENSE BLOCK \\*\\*\\*\\*\\*" POST_BLOCK;
+
+	BLOCK_END--;
 }

 {


Translate: enlarge timeout to 2000ms

Translate: enlarge timeout to 2000ms

--- include/Translate.awk
+++ include/Translate.awk
@@ -78,7 +78,7 @@
     }

     # How long to wait in milliseconds for IPv6 before trying IPv4
-    PROCINFO[HttpService, "READ_TIMEOUT"] = 1000
+    PROCINFO[HttpService, "READ_TIMEOUT"] = 2000
 }

 # Pre-process string (URL-encode before send).


Translate: update

Translate: update

--- include/Translate.awk
+++ include/Translate.awk
@@ -302,7 +302,20 @@
             # Display: source language -> target language
             if (r) r = r RS
             r = r m("-- display source language -> target language")
-            r = r prettify("languages", s(sprintf("[ %s -> %s ]", getEndonym(il), getEndonym(tl))))
+            temp = Option["fmt-languages"]
+            if (!temp) temp = "[ %s -> %t ]"
+            split(temp, group, /(%s|%S|%t|%T)/)
+            r = r prettify("languages", group[1])
+            if (temp ~ /%s/)
+                r = r prettify("languages-sl", getDisplay(il))
+            if (temp ~ /%S/)
+                r = r prettify("languages-sl", getName(il))
+            r = r prettify("languages", group[2])
+            if (temp ~ /%t/)
+                r = r prettify("languages-tl", getDisplay(tl))
+            if (temp ~ /%T/)
+                r = r prettify("languages-tl", getName(tl))
+            r = r prettify("languages", group[3])
         }

         if (wShowOriginalDictionary) {
@@ -322,10 +335,12 @@
                         if (example)
                             r = r RS prettify("original-dictionary-detailed-example", ins(2, "- \"" example "\"", il))
                         if (ref && isarray(oRefs[ref])) {
-                            temp = showSynonyms(hl) ": " oSynonyms[oRefs[ref][1]][oRefs[ref][2]][0]
+                            temp = prettify("original-dictionary-detailed-synonyms", ins(1, show(showSynonyms(hl), hl) ": "))
+                            temp = temp prettify("original-dictionary-detailed-synonyms-item", show(oSynonyms[oRefs[ref][1]][oRefs[ref][2]][0], il))
                             for (k = 1; k < length(oSynonyms[oRefs[ref][1]][oRefs[ref][2]]); k++)
-                                temp = temp ", " oSynonyms[oRefs[ref][1]][oRefs[ref][2]][k]
-                            r = r RS prettify("original-dictionary-detailed-synonyms", ins(1, temp))
+                                temp = temp prettify("original-dictionary-detailed-synonyms", ", ") \
+                                    prettify("original-dictionary-detailed-synonyms-item", show(oSynonyms[oRefs[ref][1]][oRefs[ref][2]][k], il))
+                            r = r RS temp
                         }
                     }
                 }
@@ -338,10 +353,12 @@
                 for (i = 0; i < length(oSynonymClasses); i++) {
                     r = (i > 0 ? r RS : r) RS prettify("original-dictionary-synonyms-word-class", ins(1, oSynonymClasses[i], hl))
                     for (j = 0; j < length(oSynonyms[i]); j++) {
-                        temp = "* " oSynonyms[i][j][0]
+                        temp = prettify("original-dictionary-synonyms-synonyms", ins(2, "- "))
+                        temp = temp prettify("original-dictionary-synonyms-synonyms-item", show(oSynonyms[i][j][0], il))
                         for (k = 1; k < length(oSynonyms[i][j]); k++)
-                            temp = temp ", " oSynonyms[i][j][k]
-                        r = r RS prettify("original-dictionary-synonyms-synonyms", ins(2, temp))
+                            temp = temp prettify("original-dictionary-synonyms-synonyms", ", ") \
+                                prettify("original-dictionary-synonyms-synonyms-item", show(oSynonyms[i][j][k], il))
+                        r = r RS temp
                     }
                 }
             }
@@ -353,12 +370,15 @@
                 for (i = 0; i < length(oExamples); i++) {
                     example = oExamples[i]

+                    temp = prettify("original-dictionary-examples-example", ins(1, "- "))
                     split(example, group, /(\u003cb\u003e|\u003c\/b\u003e)/)
                     if (isRTL(il)) # target language is R-to-L
-                        example = group[1] group[2] group[3]
+                        temp = temp show(group[1] group[2] group[3], il)
                     else # target language is L-to-R
-                        example = group[1] prettify("original-dictionary-examples-original", group[2]) group[3]
-                    r = (i > 0 ? r RS : r) RS prettify("original-dictionary-examples-content", ins(1, "- " example, il))
+                        temp = temp prettify("original-dictionary-examples-example", group[1]) \
+                            prettify("original-dictionary-examples-original", group[2]) \
+                            prettify("original-dictionary-examples-example", group[3])
+                    r = (i > 0 ? r RS : r) RS temp
                 }
             }
             if (isarray(oSeeAlso) && anything(oSeeAlso)) {
@@ -366,10 +386,11 @@
                 r = r RS RS
                 r = r m("-- display original dictionary (see also)")
                 r = r prettify("original-dictionary-see-also", s(showSeeAlso(hl), hl))
-                temp = isRTL(il) ? oSeeAlso[0] : prettify("original-dictionary-see-also-item", oSeeAlso[0])
+                temp = ins(1, prettify("original-dictionary-see-also-phrases-item", show(oSeeAlso[0], il)))
                 for (k = 1; k < length(oSeeAlso); k++)
-                    temp = temp ", " (isRTL(il) ? oSeeAlso[k] : prettify("original-dictionary-see-also-item", oSeeAlso[k]))
-                r = r RS prettify("original-dictionary-see-also-content", ins(1, temp, il))
+                    temp = temp prettify("original-dictionary-see-also-phrases", ", ") \
+                        prettify("original-dictionary-see-also-phrases-item", show(oSeeAlso[k], il))
+                r = r RS temp
             }
         }

@@ -381,11 +402,21 @@
                 r = (i > 0 ? r RS : r) RS prettify("dictionary-word-class", s(wordClasses[i], hl))
                 for (j = 0; j < length(words[i]); j++) {
                     word = words[i][j][0]
-                    explanation = join(words[i][j][1], ", ")
                     article = words[i][j][4]
+                    if (isRTL(il))
+                        explanation = join(words[i][j][1], ", ")
+                    else {
+                        explanation = prettify("dictionary-explanation-item", words[i][j][1][0])
+                        for (k = 1; k < length(words[i][j][1]); k++)
+                            explanation = explanation prettify("dictionary-explanation", ", ") \
+                                prettify("dictionary-explanation-item", words[i][j][1][k])
+                    }

                     r = r RS prettify("dictionary-word", ins(1, (article ? "(" article ") " : "") word, tl))
-                    r = r RS prettify("dictionary-explanation", ins(2, explanation, il))
+                    if (isRTL(il))
+                        r = r RS prettify("dictionary-explanation-item", ins(2, explanation, il))
+                    else
+                        r = r RS ins(2, explanation)
                 }
             }
         }
@@ -395,11 +426,17 @@
             if (r) r = r RS RS
             r = r m("-- display alternative translations")
             for (i = 0; i < length(altTranslations); i++) {
-                r = (i > 0 ? r RS : r) prettify("alternatives-original", show(segments[i]))
-                temp = isRTL(tl) ? altTranslations[i][0] : prettify("alternatives-translation", altTranslations[i][0])
-                for (j = 1; j < length(altTranslations[i]); j++)
-                    temp = temp ", " (isRTL(tl) ? altTranslations[i][j] : prettify("alternatives-translation", altTranslations[i][j]))
-                r = r RS prettify("alternatives-content", ins(1, temp))
+                r = (i > 0 ? r RS : r) prettify("alternatives-original", show(segments[i], il))
+                if (isRTL(tl)) {
+                    temp = join(altTranslations[i], ", ")
+                    r = r RS prettify("alternatives-translations-item", ins(1, temp, tl))
+                } else {
+                    temp = prettify("alternatives-translations-item", altTranslations[i][0])
+                    for (j = 1; j < length(altTranslations[i]); j++)
+                        temp = temp prettify("alternatives-translations", ", ") \
+                            prettify("alternatives-translations-item", altTranslations[i][j])
+                    r = r RS ins(1, temp)
+                }
             }
         }


Languages: add Corsican language

Languages: add Corsican language

--- include/Languages.awk
+++ include/Languages.awk
@@ -65,6 +65,19 @@
     Locale["br"]["iso"]                = "bre"
     Locale["br"]["glotto"]             = "bret1244"
     Locale["br"]["script"]             = "Latn"
+
+    #? Corsican
+    Locale["co"]["name"]               = "Corsican"
+    Locale["co"]["endonym"]            = "Corsu"
+    #Locale["co"]["translations-of"]
+    #Locale["co"]["definitions-of"]
+    #Locale["co"]["synonyms"]
+    #Locale["co"]["examples"]
+    #Locale["co"]["see-also"]
+    Locale["co"]["family"]             = "Indo-European"
+    Locale["co"]["iso"]                = "cos"
+    Locale["co"]["glotto"]             = "cors1242"
+    Locale["co"]["script"]             = "Latn"

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


Languages: add Northern Kurdish (Kurmanji) language

--- include/Languages.awk
+++ include/Languages.awk
@@ -690,9 +690,11 @@
     Locale["ko"]["script"]             = "Kore"
     Locale["ko"]["dictionary"]         = "true" # has dictionary

-    #51 Kurdish (Central Kurdish, Sorani), Latin alphabet
-    Locale["ku"]["name"]               = "Kurdish"
-    Locale["ku"]["endonym"]            = "Kurdî"
+    #51 Kurdish (Central Kurdish / Sorani), Latin alphabet (Arabic alphabet for Bing)
+    Locale["ku"]["name"]               = "Kurdish (Central)"
+    Locale["ku"]["name2"]              = "Sorani"
+    Locale["ku"]["endonym"]            = "Soranî"
+    Locale["ku"]["endonym2"]           = "Kurdî"
     #Locale["ku"]["translations-of"]
     #Locale["ku"]["definitions-of"]
     #Locale["ku"]["synonyms"]
@@ -1563,6 +1565,16 @@
     #Locale["tlh-Qaak"]["glotto"]
     Locale["tlh-Qaak"]["script"]       = "Piqd"

+    #* Kurdish (Northern Kurdish / Kurmanji), Latin alphabet
+    Locale["kmr"]["support"]           = "bing-only"
+    Locale["kmr"]["name"]              = "Kurdish (Northern)"
+    Locale["kmr"]["name2"]             = "Kurmanji"
+    Locale["kmr"]["endonym"]           = "Kurmancî"
+    Locale["kmr"]["family"]            = "Indo-European"
+    Locale["kmr"]["iso"]               = "kmr"
+    Locale["kmr"]["glotto"]            = "nort2641"
+    Locale["kmr"]["script"]            = "Latn"
+
     #? Assamese
     Locale["as"]["support"]            = "unstable"
     Locale["as"]["name"]               = "Assamese"
@@ -1855,6 +1867,7 @@
     LocaleAlias["iw"] = "he" # withdrawn language code for Hebrew
     LocaleAlias["ji"] = "yi" # withdrawn language code for Yiddish
     LocaleAlias["jw"] = "jv" # withdrawn language code for Javanese
+    LocaleAlias["kurdish"] = "ku" # Kurdish: default to "ku" (N.B. Google uses this code for Kurmanji)
     LocaleAlias["mo"] = "ro" # Moldavian or Moldovan considered a variant of the Romanian language
     LocaleAlias["nb"] = "no" # Google Translate does not distinguish between Bokmål and Nynorsk (but Bing does!)
     LocaleAlias["nn"] = "no"


Languages: add Hill Mari language (yandex only)

--- include/Languages.awk
+++ include/Languages.awk
@@ -1562,6 +1562,20 @@
     Locale["gn"]["iso"]                = "grn"
     Locale["gn"]["glotto"]             = "para1311"
     Locale["gn"]["script"]             = "Latn"
+
+    #? Hill Mari
+    Locale["mrj"]["support"]           = "yandex-only"
+    Locale["mrj"]["name"]              = "Hill Mari"
+    Locale["mrj"]["endonym"]           = "Кырык мары"
+    #Locale["mrj"]["translations-of"]
+    #Locale["mrj"]["definitions-of"]
+    #Locale["mrj"]["synonyms"]
+    #Locale["mrj"]["examples"]
+    #Locale["mrj"]["see-also"]
+    Locale["mrj"]["family"]            = "Uralic"
+    Locale["mrj"]["iso"]               = "mrj"
+    Locale["mrj"]["glotto"]            = "west2392"
+    Locale["mrj"]["script"]            = "Cyrl"

     #? Interlingue
     Locale["ie"]["support"]            = "unstable"


[as] Remove empty fields of instbl.c

[as] Remove empty fields of instbl.c

These arrays were empty and was really hard to detect that they
were empty.

--- as/target/x86/gen.awk
+++ as/target/x86/gen.awk
@@ -40,24 +40,29 @@
 	print "struct op optab[] = {"
 	for (i = 0; i < nvar; i++) {
 		printf "\t{\n" \
-		       "\t\t.bytes = (char []) {%s},\n"\
 		       "\t\t.size = %d,\n"\
-		       "\t\t.format = %s,\n"\
-		       "\t\t.args = (char []) {%s}\n"\
-		       "\t},\n",
-		 opbytes[i], opsize[i], opformat[i], str2args(opargs[i])
+		       "\t\t.format = %s,\n",
+		       opsize[i], opformat[i]
+
+		if (opbytes[i] != "")
+			printf "\t\t.bytes = (char []) {%s},\n", opbytes[i]
+
+		a = str2args(opargs[i])
+		if (a != "")
+			printf "\t\t.args = (char []) {%s}\n", a
+
+		print "\t},"
 	}
 	print "};"
 }

 function str2args(s, args, i, out)
 {
-	split(s, args, /,/)
+	if (split(s, args, /,/) == 0 || args[1] == "none")
+		return ""
 	for (i in args) {
 		a = args[i]
-		if (a == "none") {
-			break
-		} else if (match(a, /^imm8/)) {
+		if (match(a, /^imm8/)) {
 			out = "AIMM8"
 		} else if (match(a, /^imm16/)) {
 			out = "AIMM16"


Translate: use genTK() to generate the actual tk, fix #94

--- include/Translate.awk
+++ include/Translate.awk
@@ -65,7 +65,8 @@
     url = HttpPathPrefix "/translate_a/single?client=t"                 \
         "&ie=UTF-8&oe=UTF-8"                                            \
         "&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=at"  \
-        "&q=" preprocess(text) "&sl=" sl "&tl=" tl "&hl=" hl "&tk"
+        "&sl=" sl "&tl=" tl "&hl=" hl                                   \
+        "&tk=" genTK(text) "&q=" preprocess(text)
     header = "GET " url " HTTP/1.1\n"           \
         "Host: " HttpHost "\n"                  \
         "Connection: close\n"
@@ -93,7 +94,7 @@
 # Play using Google Text-to-Speech engine.
 function play(text, tl,    url) {
     url = HttpProtocol HttpHost "/translate_tts?ie=UTF-8&client=t"	\
-        "&tl=" tl "&tk" "&q=" preprocess(text)
+        "&tl=" tl "&tk=" genTK(text) "&q=" preprocess(text)

     # Don't use getline from pipe here - the same pipe will be run only once for each AWK script!
     system(Option["player"] " " parameterize(url) SUPOUT SUPERR)


- Fixed typo in kern_params initialization (was kern_parms) - Fixed handing of kernel parameter entries to allow spaces - Enabled acpi - Specified bridge network interface gt #1079

--- src/condor_vm-gahp/libvirt_simple_script.awk
+++ src/condor_vm-gahp/libvirt_simple_script.awk
@@ -24,13 +24,18 @@
 # that the entire classad has been sent to us.
 {
     gsub(/\"/, "")
-    attrs[$1] = $3
+    key = $1
+    # Matching value should be $3-$NR
+    $1 = ""
+    $2 = ""
+    sub(/^  /, "")
+    attrs[key] = $0
     bootloader = ""
     root = ""
     initrd = ""
     kernel = ""
-    kern_parms = ""
-    print "Received attribute: " $1 "=" attrs[$1] >debug_file
+    kern_params = ""
+    print "Received attribute: " key "=" attrs[key] >debug_file
 }

 END {
@@ -85,6 +90,11 @@
     {
 	print "<bootloader>" bootloader "</bootloader>"
     }
+
+    # Make sure guests destroy on power off
+    print "<features><acpi/><apic/><pae/></features>" ;
+    print "<on_poweroff>destroy</on_poweroff><on_reboot>restart</on_reboot><on_crash>restart</on_crash>" ;
+
     print "<devices>" ;
     if(attrs["JobVMNetworking"] == "TRUE")
     {
@@ -94,7 +104,7 @@
 	}
 	else
 	{
-	    print "<interface type='bridge'><mac address='" attrs["JobVM_MACADDR"] "'/></interface>" ;
+	    print "<interface type='bridge'><mac address='" attrs["JobVM_MACADDR"] "'/><source bridge='br0'/></interface>" ;
 	}
     }
     print "<disk type='file'>" ;


Translators/YandexTranslate: get rid of the "Yandex.Translate API v1 is no longer active" message, fix (partly) #123

--- include/Translators/YandexTranslate.awk
+++ include/Translators/YandexTranslate.awk
@@ -2,7 +2,7 @@
 # YandexTranslate.awk                                              #
 ####################################################################
 #
-# Last Updated: 11 Mar 2016
+# Last Updated: 16 May 2016
 BEGIN { provides("yandex") }

 function genSID(    content, group, temp) {
@@ -33,7 +33,7 @@
     split(tl, group, "-"); tl = group[1]

     return HttpPathPrefix "/api/v1/tr.json/translate?"                  \
-        "id=" SID "&srv=tr-text"                                        \
+        "id=" SID "-0-0&srv=tr-text"                                    \
         "&text=" preprocess(text) "&lang=" (sl == "auto" ? tl : sl "-" tl)
 }


Translate: add preprocess() and postprocess()

--- lib/Translate.awk
+++ lib/Translate.awk
@@ -3,6 +3,18 @@
 @include "lib/Commons"
 @include "lib/PLTokenizer"
 @include "lib/PLParser"
+
+# Pre-process string (URL-encode before send).
+function preprocess(text) {
+    return quote(text)
+}
+
+# Post-process string (remove any redundant whitespace).
+function postprocess(text) {
+    text = gensub(/ ([.,;:?!"])/, "\\1", "g", text)
+    text = gensub(/(["]) /, "\\1", "g", text)
+    return text
+}

 # Send an HTTP request and get response from Google Translate.
 function getResponse(text, sl, tl, hl,    content, url) {


added commented out interpret empty as null params for easy uncommenting.

--- bin/util/header2params2.awk
+++ bin/util/header2params2.awk
@@ -141,12 +141,11 @@
                                     printf("         a conversion:DataStartRow; \n");
                                     printf("      ];                            \n");
    }
-   if(length(interpretAsNull) && length(conversionID)) {
-                                    printf("      conversion:interpret [          \n");
-                                    printf("         conversion:symbol \"%s\";\n",interpretAsNull);
-                                    printf("         conversion:intepretation conversion:null; \n");
-                                    printf("      ];                            \n");
-   }
+   comment_out = length(interpretAsNull) && length(conversionID) ? "" : "#"; # We want to put in the template so it is easy to uncomment.
+                                    printf("      %sconversion:interpret [          \n",             comment_out);
+                                    printf("      %s   conversion:symbol \"%s\";\n",                 comment_out,interpretAsNull);
+                                    printf("      %s   conversion:intepretation conversion:null; \n",comment_out);
+                                    printf("      %s];                            \n",               comment_out);
    if(length(dataEnd)) {
                                     printf("      conversion:enhance [        \n");
                                     printf("         ov:csvRow %s;\n",dataEnd);


When generating the version map file, order versions oldest
first to make it easier for rtld to choose the oldest version
of a symbol.

Sumbitted by:	kan

--- share/mk/version_gen.awk
+++ share/mk/version_gen.awk
@@ -53,6 +53,7 @@
 			symver = $1;
 			versions[symver] = 1;
 			successors[symver] = "";
+			generated[symver] = 0;
 			version_count++;
 		}
 		else if (/^[ \t]*} *[a-zA-Z0-9._]+ *;/) {
@@ -141,26 +142,42 @@
 	    FILENAME, FNR, $0) > stderr;
 }

+function print_version(v)
+{
+	# This function is recursive, so return if this version
+	# has already been printed.  Otherwise, if there is an
+	# ancestral version, recursively print its symbols before
+	# printing the symbols for this version.
+	#
+	if (generated[v] == 1)
+		return;
+	if (successors[v] != "")
+		print_version(successors[v]);
+
+	printf("%s {\n", v);
+
+	# The version count is always one more that actual,
+	# so the loop ranges from 1 to n-1.
+	#
+	for (i = 1; i < versions[v]; i++) {
+		if (i == 1)
+			printf("global:\n");
+		printf("\t%s\n", symbols[v, i]);
+	}
+	if (successors[v] == "") {
+		# This version succeeds no other version.
+		printf("local:\n");
+		printf("\t*;\n");
+		printf("};\n");
+	}
+	else
+		printf("} %s;\n", successors[v]);
+	printf("\n");
+
+	generated[v] = 1;
+    }
 END {
 	for (v in versions) {
-		printf("\n");
-		printf("%s {\n", v);
-
-		# The version count is always one more that actual,
-		# so the loop ranges from 1 to n-1.
-		#
-		for (i = 1; i < versions[v]; i++) {
-			if (i == 1)
-				printf("global:\n");
-			printf("\t%s\n", symbols[v, i]);
-		}
-		if (successors[v] == "") {
-			# This version succeeds no other version.
-			printf("local:\n");
-			printf("\t*;\n");
-			printf("};\n");
-		}
-		else
-			printf("} %s;\n", successors[v]);
+		print_version(v);
 	}
 }


do not create _STR_ defines; this is useless, makes pcmciadevs.h larger and unclean.

--- dev/pcmcia/devlist2h.awk
+++ dev/pcmcia/devlist2h.awk
@@ -1,5 +1,5 @@
 #! /usr/bin/awk -f
-#	$OpenBSD: devlist2h.awk,v 1.3 1999/08/18 22:30:04 d Exp $
+#	$OpenBSD: devlist2h.awk,v 1.4 2000/02/01 16:54:41 fgsch Exp $
 #	$NetBSD: devlist2h.awk,v 1.2 1998/07/22 11:47:13 christos Exp $
 #
 # Copyright (c) 1998, Christos Zoulas
@@ -128,11 +128,11 @@
 	printf("#define\tPCMCIA_PRODUCT_%s_%s\t%s\n", products[nproducts, 1],
 	    products[nproducts, 2], products[nproducts, 3]) > hfile

-	products[nproducts, 5] = collectline(f, line)
-
-	printf("#define\tPCMCIA_STR_%s_%s\t\"%s\"\n",
-	    products[nproducts, 1], products[nproducts, 2],
-	    products[nproducts, 5]) > hfile
+#	products[nproducts, 5] = collectline(f, line)
+#
+#	printf("#define\tPCMCIA_STR_%s_%s\t\"%s\"\n",
+#	    products[nproducts, 1], products[nproducts, 2],
+#	    products[nproducts, 5]) > hfile

 	next
 }


Commons: use string "\0" to indicate NONE

--- include/Commons.awk
+++ include/Commons.awk
@@ -5,6 +5,7 @@
 # Initialize constants.
 function initConst() {
     NULLSTR = ""
+    NONE = "\0"
     TRUE = 1

     STDIN  = "/dev/stdin"