Help: enable 4-column reference tables

Help: enable 4-column reference tables

--- include/Help.awk
+++ include/Help.awk
@@ -237,22 +237,30 @@
 #     displayName = "endonym" or "name"
 function getReference(displayName,
                       ####
-                      code, col, cols, i, j, name, num, r, rows, saveSortedIn,
+                      code, col, cols, colNum, i, j, name, num, offset, r, rows, saveSortedIn,
                       t1, t2) {
     # number of language codes with stable support
     num = 0
-    for (code in Locale)
-        if (Locale[code]["support"] != "unstable")
-            num++
-    rows = int(num / 3) + (num % 3 ? 1 : 0)
-    cols[0][0] = cols[1][0] = cols[2][0] = NULLSTR
+    for (code in Locale) {
+        # only show languages that are supported
+        if (Locale[code]["supported-by"])
+           num++
+    }
+    colNum = (Option["width"] >= 104) ? 4 : 3
+    if (colNum == 4) {
+        rows = int(num / 4) + (num % 4 ? 1 : 0)
+        cols[0][0] = cols[1][0] = cols[2][0] = cols[3][0] = NULLSTR
+    } else {
+        rows = int(num / 3) + (num % 3 ? 1 : 0)
+        cols[0][0] = cols[1][0] = cols[2][0] = NULLSTR
+    }
     i = 0
     saveSortedIn = PROCINFO["sorted_in"]
     PROCINFO["sorted_in"] = displayName == "endonym" ? "@ind_num_asc" :
         "compName"
     for (code in Locale) {
-        # show languages only with stable support
-        if (Locale[code]["support"] != "unstable") {
+        # only show languages that are supported
+        if (Locale[code]["supported-by"]) {
             col = int(i / rows)
             append(cols[col], code)
             i++
@@ -261,99 +269,205 @@
     PROCINFO["sorted_in"] = saveSortedIn

     if (displayName == "endonym") {
-        r = "┌" replicate("─", 25) "┬" replicate("─", 25) "┬" replicate("─", 25) "┐" RS
-        for (i = 0; i < rows; i++) {
-            r = r "│"
-            for (j = 0; j < 3; j++) {
-                if (cols[j][i]) {
-                    t1 = getDisplay(cols[j][i])
-                    if (length(t1) > 17)
-                        t1 = substr(t1, 1, 14) "..."
-                    switch (cols[j][i]) { # fix rendered text width
-                    case "sa":
-                        t1 = sprintf(" %-21s", t1)
-                        break
-                    case "he": case "dv":
-                        t1 = sprintf(" %-20s", t1)
-                        break
-                    case "or": case "ur":
-                        t1 = sprintf(" %-19s", t1)
-                        break
-                    case "hi": case "gu": case "km": case "kn":
-                    case "my": case "ne": case "pa": case "si":
-                    case "ta": case "te": case "yi": case "as":
-                    case "bho": case "mai": case "gom":
-                        t1 = sprintf(" %-18s", t1)
-                        break
-                    case "yue":
-                        t1 = sprintf(" %-15s", t1)
-                        break
-                    case "ja": case "ko":
-                        t1 = sprintf(" %-14s", t1)
-                        break
-                    case "zh-CN": case "zh-TW":
-                        t1 = sprintf(" %-13s", t1)
-                        break
-                    default:
-                        if (length(t1) <= 17)
-                            t1 = sprintf(" %-17s", t1)
-                    }
-                    switch (length(cols[j][i])) {
-                    case 1: case 2: case 3: case 4:
-                        t2 = sprintf("- %s │", ansi("bold", sprintf("%4s", cols[j][i])))
-                        break
-                    case 5:
-                        t2 = sprintf("- %s│", ansi("bold", cols[j][i]))
-                        break
-                    case 6:
-                        t2 = sprintf("-%s│", ansi("bold", cols[j][i]))
-                        break
-                    case 7:
-                        t2 = sprintf("-%s", ansi("bold", cols[j][i]))
-                        break
-                    default:
-                        t2 = ansi("bold", cols[j][i])
-                    }
-                    r = r t1 t2
-                } else
-                    r = r sprintf("%25s│", NULLSTR)
+        if (colNum == 4) {  # 4-column
+            offset = int((Option["width"] - 104) / 4)
+            r = "┌" replicate("─", 25 + offset) "┬" replicate("─", 25 + offset) \
+                "┬" replicate("─", 25 + offset) "┬" replicate("─", 25 + offset) "┐" RS
+            for (i = 0; i < rows; i++) {
+                r = r "│"
+                for (j = 0; j < 4; j++) {
+                    if (cols[j][i]) {
+                        t1 = getDisplay(cols[j][i])
+                        if (length(t1) > 17 + offset)
+                            t1 = substr(t1, 1, 14 + offset) "..."
+                        switch (cols[j][i]) { # fix rendered text width
+                            case "sa":
+                                t1 = sprintf(" %-"21+offset"s", t1)
+                                break
+                            case "he": case "dv":
+                                t1 = sprintf(" %-"20+offset"s", t1)
+                                break
+                            case "bo": case "or": case "ur":
+                                t1 = sprintf(" %-"19+offset"s", t1)
+                                break
+                            case "as": case "gom": case "mai":
+                            case "gu": case "hi": case "bho":
+                            case "ta": case "te": case "my":
+                            case "ne": case "pa": case "km":
+                            case "kn": case "yi": case "si":
+                                t1 = sprintf(" %-"18+offset"s", t1)
+                                break
+                            case "lzh": case "yue":
+                                t1 = sprintf(" %-"15+offset"s", t1)
+                                break
+                            case "ja": case "ko":
+                                t1 = sprintf(" %-"14+offset"s", t1)
+                                break
+                            case "zh-CN": case "zh-TW":
+                                t1 = sprintf(" %-"13+offset"s", t1)
+                                break
+                            default:
+                                if (length(t1) <= 17+offset)
+                                    t1 = sprintf(" %-"17+offset"s", t1)
+                        }
+                        switch (length(cols[j][i])) {
+                            case 1: case 2: case 3: case 4:
+                                t2 = sprintf("- %s │", ansi("bold", sprintf("%4s", cols[j][i])))
+                                break
+                            case 5:
+                                t2 = sprintf("- %s│", ansi("bold", cols[j][i]))
+                                break
+                            case 6:
+                                t2 = sprintf("-%s│", ansi("bold", cols[j][i]))
+                                break
+                            case 7:
+                                t2 = sprintf("-%s", ansi("bold", cols[j][i]))
+                                break
+                            default:
+                                t2 = ansi("bold", cols[j][i])
+                        }
+                        r = r t1 t2
+                    } else
+                        r = r sprintf("%"25+offset"s│", NULLSTR)
+                }
+                r = r RS
             }
-            r = r RS
+            r = r "└" replicate("─", 25 + offset) "┴" replicate("─", 25 + offset) \
+                "┴" replicate("─", 25 + offset) "┴" replicate("─", 25 + offset) "┘"
+        } else {  # fixed-width 3-column
+            r = "┌" replicate("─", 25) "┬" replicate("─", 25) "┬" replicate("─", 25) "┐" RS
+            for (i = 0; i < rows; i++) {
+                r = r "│"
+                for (j = 0; j < 3; j++) {
+                    if (cols[j][i]) {
+                        t1 = getDisplay(cols[j][i])
+                        if (length(t1) > 17)
+                            t1 = substr(t1, 1, 14) "..."
+                        switch (cols[j][i]) { # fix rendered text width
+                            case "sa":
+                                t1 = sprintf(" %-21s", t1)
+                                break
+                            case "he": case "dv":
+                                t1 = sprintf(" %-20s", t1)
+                                break
+                            case "bo": case "or": case "ur":
+                                t1 = sprintf(" %-19s", t1)
+                                break
+                            case "as": case "gom": case "mai":
+                            case "gu": case "hi": case "bho":
+                            case "ta": case "te": case "my":
+                            case "ne": case "pa": case "km":
+                            case "kn": case "yi": case "si":
+                                t1 = sprintf(" %-18s", t1)
+                                break
+                            case "lzh": case "yue":
+                                t1 = sprintf(" %-15s", t1)
+                                break
+                            case "ja": case "ko":
+                                t1 = sprintf(" %-14s", t1)
+                                break
+                            case "zh-CN": case "zh-TW":
+                                t1 = sprintf(" %-13s", t1)
+                                break
+                            default:
+                                if (length(t1) <= 17)
+                                    t1 = sprintf(" %-17s", t1)
+                        }
+                        switch (length(cols[j][i])) {
+                            case 1: case 2: case 3: case 4:
+                                t2 = sprintf("- %s │", ansi("bold", sprintf("%4s", cols[j][i])))
+                                break
+                            case 5:
+                                t2 = sprintf("- %s│", ansi("bold", cols[j][i]))
+                                break
+                            case 6:
+                                t2 = sprintf("-%s│", ansi("bold", cols[j][i]))
+                                break
+                            case 7:
+                                t2 = sprintf("-%s", ansi("bold", cols[j][i]))
+                                break
+                            default:
+                                t2 = ansi("bold", cols[j][i])
+                        }
+                        r = r t1 t2
+                    } else
+                        r = r sprintf("%25s│", NULLSTR)
+                }
+                r = r RS
+            }
+            r = r "└" replicate("─", 25) "┴" replicate("─", 25) "┴" replicate("─", 25) "┘"
         }
-        r = r "└" replicate("─", 25) "┴" replicate("─", 25) "┴" replicate("─", 25) "┘"
     } else {
-        r = "┌" replicate("─", 25) "┬" replicate("─", 25) "┬" replicate("─", 25) "┐" RS
-        for (i = 0; i < rows; i++) {
-            r = r "│"
-            for (j = 0; j < 3; j++) {
-                if (cols[j][i]) {
-                    t1 = getName(cols[j][i])
-                    if (length(t1) > 17)
-                        t1 = substr(t1, 1, 14) "..."
-                    t1 = sprintf(" %-17s", t1)
-                    switch (length(cols[j][i])) {
-                    case 1: case 2: case 3: case 4:
-                        t2 = sprintf("- %s │", ansi("bold", sprintf("%4s", cols[j][i])))
-                        break
-                    case 5:
-                        t2 = sprintf("- %s│", ansi("bold", cols[j][i]))
-                        break
-                    case 6:
-                        t2 = sprintf("-%s│", ansi("bold", cols[j][i]))
-                        break
-                    case 7:
-                        t2 = sprintf("-%s", ansi("bold", cols[j][i]))
-                        break
-                    default:
-                        t2 = ansi("bold", cols[j][i])
-                    }
-                    r = r t1 t2
-                } else
-                    r = r sprintf("%25s│", NULLSTR)
+        if (colNum == 4) {  # 4-column
+            offset = int((Option["width"] - 104) / 4)
+            r = "┌" replicate("─", 25 + offset) "┬" replicate("─", 25 + offset) \
+                "┬" replicate("─", 25 + offset) "┬" replicate("─", 25 + offset) "┐" RS
+            for (i = 0; i < rows; i++) {
+                r = r "│"
+                for (j = 0; j < 4; j++) {
+                    if (cols[j][i]) {
+                        t1 = getName(cols[j][i])
+                        if (length(t1) > 17 + offset)
+                            t1 = substr(t1, 1, 14 + offset) "..."
+                        t1 = sprintf(" %-"17+offset"s", t1)
+                        switch (length(cols[j][i])) {
+                            case 1: case 2: case 3: case 4:
+                                t2 = sprintf("- %s │", ansi("bold", sprintf("%4s", cols[j][i])))
+                                break
+                            case 5:
+                                t2 = sprintf("- %s│", ansi("bold", cols[j][i]))
+                                break
+                            case 6:
+                                t2 = sprintf("-%s│", ansi("bold", cols[j][i]))
+                                break
+                            case 7:
+                                t2 = sprintf("-%s", ansi("bold", cols[j][i]))
+                                break
+                            default:
+                                t2 = ansi("bold", cols[j][i])
+                        }
+                        r = r t1 t2
+                    } else
+                        r = r sprintf("%"25+offset"s│", NULLSTR)
+                }
+                r = r RS
             }
-            r = r RS
+            r = r "└" replicate("─", 25 + offset) "┴" replicate("─", 25 + offset) \
+                "┴" replicate("─", 25 + offset) "┴" replicate("─", 25 + offset) "┘"
+        } else {  # fixed-width 3-column
+            r = "┌" replicate("─", 25) "┬" replicate("─", 25) "┬" replicate("─", 25) "┐" RS
+            for (i = 0; i < rows; i++) {
+                r = r "│"
+                for (j = 0; j < 3; j++) {
+                    if (cols[j][i]) {
+                        t1 = getName(cols[j][i])
+                        if (length(t1) > 17)
+                            t1 = substr(t1, 1, 14) "..."
+                        t1 = sprintf(" %-17s", t1)
+                        switch (length(cols[j][i])) {
+                            case 1: case 2: case 3: case 4:
+                                t2 = sprintf("- %s │", ansi("bold", sprintf("%4s", cols[j][i])))
+                                break
+                            case 5:
+                                t2 = sprintf("- %s│", ansi("bold", cols[j][i]))
+                                break
+                            case 6:
+                                t2 = sprintf("-%s│", ansi("bold", cols[j][i]))
+                                break
+                            case 7:
+                                t2 = sprintf("-%s", ansi("bold", cols[j][i]))
+                                break
+                            default:
+                                t2 = ansi("bold", cols[j][i])
+                        }
+                        r = r t1 t2
+                    } else
+                        r = r sprintf("%25s│", NULLSTR)
+                }
+                r = r RS
+            }
+            r = r "└" replicate("─", 25) "┴" replicate("─", 25) "┴" replicate("─", 25) "┘"
         }
-        r = r "└" replicate("─", 25) "┴" replicate("─", 25) "┴" replicate("─", 25) "┘"
     }
     return r
 }


Whitespace

Whitespace

--- files/awsm-cli/resources_by_region.awk
+++ files/awsm-cli/resources_by_region.awk
@@ -9,7 +9,7 @@
     for (i = 2; i <= NF; i++) {
       if ($i ~ /^arn:/) {
         split($i, arn_parts, /:/)
-        aws_service = arn_parts[3]
+        aws_service             = arn_parts[3]
         aws_resource_identifier = arn_parts[6]

         switch(aws_service) {


TestCommons: add toString()

TestCommons: add toString()

--- test/TestCommons.awk
+++ test/TestCommons.awk
@@ -125,6 +125,13 @@
         assertEqual(parameterize("foo 'bar", "\""), "\"foo 'bar\"")
         assertEqual(parameterize("foo \"bar\"", "\""), "\"foo \\\\\"bar\\\\\"\"")
     }
+    T("toString()", 4)
+    {
+        assertEqual(toString(""), "")
+        assertEqual(toString(42), "42")
+        assertEqual(toString("foo"), "foo")
+        assertEqual(toString("\"foo bar\""), "\"foo bar\"")
+    }
     T("squeeze()", 4)
     {
         assertEqual(squeeze(""), "")


TestParser: remove invalid JSON (hopefully get things right this time)

--- test/TestParser.awk
+++ test/TestParser.awk
@@ -107,17 +107,15 @@
         assertEqual(ast, expected)

         delete tokens; delete ast; delete expected
-        tokenize(tokens, "{\"answer\": {42}, \"Answer\": null}")
+        tokenize(tokens, "{\"answer\": {\"everything\": 42}}")
         parseJson(ast, tokens)
-        expected[0 SUBSEP "answer" SUBSEP] = 42
-        expected[0 SUBSEP "Answer"] = "null"
+        expected[0 SUBSEP "answer" SUBSEP "everything"] = "42"
         assertEqual(ast, expected)

         delete tokens; delete ast; delete expected
-        tokenize(tokens, "{\"answer\": {[42]}, \"Answer\": null}")
+        tokenize(tokens, "{\"answer\": {\"everything\": [42]}}")
         parseJson(ast, tokens)
-        expected[0 SUBSEP "answer" SUBSEP SUBSEP 0] = 42
-        expected[0 SUBSEP "Answer"] = "null"
+        expected[0 SUBSEP "answer" SUBSEP "everything" SUBSEP 0] = "42"
         assertEqual(ast, expected)

         # empty object - what is the "correct" parsing result?


add|sub rsp alter the indent

add|sub rsp alter the indent

--- tools/push_pop_indent.awk
+++ tools/push_pop_indent.awk
@@ -1,7 +1,7 @@
 #!/bin/sh

 exec awk '
-/pop/ {
+/pop|leave/ {
 	if(--indent < 0)
 		print "AWK: indent less than zero (" indent ")" #| "cat >&2"
 }
@@ -17,4 +17,11 @@
 /push/ {
 	indent++
 }
+
+/(add|sub) rsp/ {
+	n = $3 / 8
+	if($1 == "sub")
+		n = -n
+	indent -= n
+}
 '


ahrf.awk: Silence gawk(1) forever

ahrf.awk: Silence gawk(1) forever

--- ahrf.awk
+++ ahrf.awk
@@ -68,7 +68,7 @@
 	printf("<ul>\n")
 	for (u=1; u<=NF; u++) {
 		gsub(/^[\t ]*/,"",$u)
-		if (match($u, "\[[0-9]+\]")) {
+		if (match($u, "\\[[0-9]+\\]")) {
 			# RSTART can be replaced by 1, because we removed useless tabs/spaces
 			num = substr($u,RSTART,RLENGTH)
 			url = substr($u,RSTART+RLENGTH+1)


interp_utils.awk	-- added code to support log scales

--- lib/interp_utils.awk
+++ lib/interp_utils.awk
@@ -254,7 +254,7 @@
 				n_ary = split(work, ary, ":")
 				return ary[2]
 			}else
-				return IU_interpolate_grad(interp["values", idx - 1], v, interp["breaks", idx - 1], interp["breaks", idx])
+				return IU_interpolate_grad(interp, interp["values", idx - 1], v, interp["breaks", idx - 1], interp["breaks", idx])
 		}else if(interp["v_ob_info"] == "^"){	# ^bgg*$, lower out of bounds specified, take higher ob from last grad element
 			if(idx == 1)
 				return interp["values", 1]
@@ -263,7 +263,7 @@
 				n_ary = split(work, ary, ":")
 				return ary[2]
 			}else
-				return IU_interpolate_grad(interp["values", idx], v, interp["breaks", idx], interp["breaks", idx + 1])
+				return IU_interpolate_grad(interp, interp["values", idx], v, interp["breaks", idx], interp["breaks", idx + 1])
 		}else if(interp["v_ob_info"] == "$"){	# ^gg*b$, upper out of bounds specified, take lower ob from first grad element
 			if(idx == 1){
 				work = interp["values", 1]
@@ -272,12 +272,12 @@
 			}else if(idx == interp["nbreaks"] + 1)
 				return interp["values", idx - 1]
 			else
-				return IU_interpolate_grad(interp["values", idx - 1], v, interp["breaks", idx - 1], interp["breaks", idx])
+				return IU_interpolate_grad(interp, interp["values", idx - 1], v, interp["breaks", idx - 1], interp["breaks", idx])
 		}else{	# ^bgg*b$, lower & upper ob info specified
 			if(idx == 1 || idx == interp["nbreaks"] + 1)
 				return interp["values", idx]
 			else
-				return IU_interpolate_grad(interp["values", idx], v, interp["breaks", idx], interp["breaks", idx + 1])
+				return IU_interpolate_grad(interp, interp["values", idx], v, interp["breaks", idx], interp["breaks", idx + 1])
 		}
 	}
 }
@@ -313,7 +313,7 @@
 	return ""
 }

-function IU_interpolate_grad(grad, v, v_min, v_max,   n_ary, ary, n_ary2, ary2, i, g_min, g_max, f, rstr) {
+function IU_interpolate_grad(interp, grad, v, v_min, v_max,   n_ary, ary, n_ary2, ary2, i, g_min, g_max, f, rstr) {

 	# grad is well formed or IU_init() would have failed
 	n_ary = split(grad, ary, ":")
@@ -323,6 +323,15 @@
 	n_ary2 = split(ary[2], ary2, ",")
 	for(i = 1; i <= n_ary2; i++)
 		g_max[i] = ary2[i] + 0	# force numeric
+
+	# other scales may be possible but for now
+	if(interp["scale_type"] == "log"){
+		log10 = log(10)
+		v = log(v)/log10
+		v_min = log(v_min)/log10
+		v_max = log(v_max)/log10
+	}
+
 	f = (v - v_min) / (v_max - v_min)	# safe b/c IU_init() checked that v_max > v_min
 	rstr = ""
 	for(i = 1; i <= n_ary2; i++){


Translators/YandexTranslate: mark dictionary as broken

--- include/Translators/YandexTranslate.awk
+++ include/Translators/YandexTranslate.awk
@@ -216,7 +216,7 @@
             r = r prettify("languages", group[3])
         }

-        if (wShowDictionary) {
+        if (wShowDictionary && false) { # FIXME!
             # Dictionary API
             dicContent = yandexGetDictionaryResponse(text, _sl, _tl, _hl)
             tokenize(dicTokens, dicContent)


Report all malformed Sn/Ep strings in MHz

--- getMHzFromSitemap.awk
+++ getMHzFromSitemap.awk
@@ -213,8 +213,8 @@
     # and ones missing the second letter (Sn 1 E 1), (S1 E1), or wrong second letter (Sm 1 Ep 1)
     if (match (episodeTitle,\
         /[ ]*\(S[Nnm]*[ ]*[[:digit:]]{1,2}[ ]+[Ee][Pp]*[ ]*[[:digit:]]{1,3}[[:space:]]*\)/))  {
-            if (episodeTitle ~ /\(Sm /)
-                printf ("==> Malformed Sn in \"%s: %s\"\n", showTitle, episodeTitle) >> ERRORS
+            if (episodeTitle !~ / \(Sn [[:digit:]]{1,2} Ep [[:digit:]]{1,3}\)/)
+                printf ("==> Malformed Sn/Ep in \"%s: %s\"\n", showTitle, episodeTitle) >> ERRORS
             sub (/[ ]*\(S[Nnm]*[ ]*[[:digit:]]{1,2}[ ]+[Ee][Pp]*[ ]*[[:digit:]]{1,3}[[:space:]]*\)/,\
                 "",episodeTitle)
             # print "==> episodeTitle = " episodeTitle > "/dev/stderr"


bugfix

bugfix


include statuses gt 0 only

include statuses gt 0 only

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

--- scripts/tdb/statuses_clockss.awk
+++ scripts/tdb/statuses_clockss.awk
@@ -31,28 +31,28 @@
   s[0] = "expected"
   s[1] = "exists"
   s[2] = "manifest"
-#  s[3] = "wanted"
-  s[3] = "crawling"
-  s[4] = "testing"
-  s[5] = "notReady"
-  s[6] = "released"
-  s[7] = "down"
-#  s[9] = "superseded"
-#  s[10] = "zapped"
-  sn = 8
+  s[3] = "wanted"
+  s[4] = "crawling"
+  s[5] = "testing"
+  s[6] = "notReady"
+  s[7] = "released"
+  s[8] = "down"
+  s[9] = "superseded"
+  s[10] = "zapped"
+  sn = 11

   sc[0] = "expe"
   sc[1] = "exis"
   sc[2] = "mani"
-#  sc[3] = "want"
-  sc[3] = "craw"
-  sc[4] = "test"
-  sc[5] = "notR"
-  sc[6] = "rele"
-  sc[7] = "down"
-#  sc[9] = "supe"
-#  sc[10] = "zapp"
-  scn = 8
+  sc[3] = "want"
+  sc[4] = "craw"
+  sc[5] = "test"
+  sc[6] = "notR"
+  sc[7] = "rele"
+  sc[8] = "down"
+  sc[9] = "supe"
+  sc[10] = "zapp"
+  scn = 11

   #print out header
   printf "Publisher\tPlugin\tContr\tYear\tT\tTotal"
@@ -65,18 +65,22 @@
   for (i = 0 ; i < pn ; i++) {
     printf "%s\t%s\t%s\t%s\t%s\t%d", p[i], n[i], t[i], d[i], r[i], b[p[i],n[i],t[i],d[i]]
     for (j = 0 ; j < sn ; j++) {
+      if (x[s[j]] > 0){
       if (c[p[i],n[i],t[i],d[i],s[j]] == 0) {
       printf "\t.."
     } else {
         printf "\t%d", c[p[i],n[i],t[i],d[i],s[j]]
       }
     }
+    }
     printf "\n"
   }
     #print out bottom line sums
     printf "Publisher\tPlugin\tContr\tYear\tT\t%d", tt
     for (j = 0 ; j < sn ; j++) {
-    	printf "\t%d", x[s[j]]
+    	if (x[s[j]] > 0) {
+    		printf "\t%d", x[s[j]]
+      }
     }

   printf "\n"


Add headers

Add headers

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

--- scripts/tdb/statuses_clockss.awk
+++ scripts/tdb/statuses_clockss.awk
@@ -39,10 +39,23 @@
   s[9] = "superseded"
   s[10] = "zapped"
   sn = 11
+
+  sc[0] = "expe"
+  sc[1] = "exis"
+  sc[2] = "mani"
+  sc[3] = "want"
+  sc[4] = "craw"
+  sc[5] = "test"
+  sc[6] = "notR"
+  sc[7] = "rele"
+  sc[8] = "down"
+  sc[9] = "supe"
+  sc[10] = "zapp"
+  scn = 11

-  printf "Publisher\tPlugin\tContract\tYear\tTotal"
-  for (j = 0 ; j < sn ; j++) {
-    printf "\t%s", s[j]
+  printf "Publisher\tPlugin\tContr\tYear\tTotal"
+  for (j = 0 ; j < scn ; j++) {
+    printf "\t%s", sc[j]
   }
   printf "\n"


It seems SCO puts touch in a wierd place

--- extra/scripts/initfini.awk
+++ extra/scripts/initfini.awk
@@ -8,7 +8,7 @@
 { alignval="";
   endp=0;
   end=0;
-  system("/bin/touch crt[in].S");
+  system("touch crt[in].S");
   system("/bin/rm -f crt[in].S");
   omitcrti=0;
   omitcrtn=0;


minor edits

minor edits

--- scripts/deltadot.awk
+++ scripts/deltadot.awk
@@ -39,9 +39,8 @@
 }

 END{
-
 	for(e in edge1){
-		if(! (e in edge2)) edges[e "(" edge1[e] ")\", color=\"orange\"];"];
+		if(!(e in edge2)) edges[e "(" edge1[e] ")\", color=\"orange\"];"];
 		else {
 			# TODO flag losses?
 			diff =  edge2[e] - edge1[e];


this almost does the job

this almost does the job

--- purgatory/BibTeX2lout.awk
+++ purgatory/BibTeX2lout.awk
@@ -1,51 +1,54 @@
-  {	"Book",		"Book",		"B",		},
-  {	"Book",		"Booklet",	"B",		},
-  {	"Proceedings",	"Proceedings",	"",		},
-  {	"Proceedings",	"Conference",	"",		},
-  {	"PhDThesis",	"PhdThesis",	"D",		},
-  {	"TechReport",	"TechReport",	"R",		},
-  {	"TechReport",	"Manual",	"R",		},
-  {	"MastersThesis","MastersThesis","D",		},
-  {	"Misc",		"Misc", 	"O",		},
-  {	"Misc",		"Unpublished", 	"",		},
-  {	"Article",	"Article",	"J",		},
-  {	"InBook",	"InBook",	"P",		},
-  {	"InBook",	"InCollection",	"P",		},
-  {	"InProceedings","InProceedings","C",
+# /Book.*=.*/ {print "Book { " $4 " }"; next}
+# /Booklet.*=.*/ {print "Book { " $4 " }"; next}
+# /Proceedings.*=.*/ {print "Proceedings { " $4 " }"; next}
+# /Conference.*=.*/ {print "Proceedings { " $4 " }"; next}
+# /PhdThesis.*=.*/ {print "PhDThesis { " $4 " }"; next}
+# /TechReport.*=.*/ {print "TechReport { " $4 " }"; next}
+# /Manual.*=.*/ {print "TechReport { " $4 " }"; next}
+# /MastersThesis.*=.*/ {print "MastersThesis { " $4 " }"; next}
+# /Misc.*=.*/ {print "Misc { " $4 " }"; next}
+# /Unpublished.*=.*/ {print "Misc { " $4 " }"; next}
+# /Article.*=.*/ {print "Article { " $4 " }"; next}
+# /InBook.*=.*/ {print "InBook { " $4 " }"; next}
+# /InCollection.*=.*/ {print "InBook { " $4 " }"; next}
+/@inproceedings[ \t]*{.*/ {print "{ @Reference\n   @Type { InProceedings }"; have = 1; next}

+{ split($0, arr, "{"); split(arr[2], brr, "}"); cont = brr[1] }

+/typ.*=.*/ {print "   @Type { " cont " }"; next}
+/tag.*=.*/ {print "   @Tag { " cont " }"; next}
+# /.*=.*/ {print "   @Abstract { " cont " }"; next}
+/address.*=.*/ {print "   @Address { " cont " }"; next}
+/annote.*=.*/ {print "   @Annote { " cont " }"; next}
+/author.*=.*/ {print "   @Author { " cont " }"; next}
+/chapter.*=.*/ {} # print " { " cont " }"
+# /.*=.*/ {print "   @Day { " cont " }"; next}
+/edition.*=.*/ {print "   @Edition { " cont " }"; next}
+/howpublished.*=.*/ {print "   @HowPublished { " cont " }"; next}
+/editor.*=.*/ {print "   @InAuthor { " cont " }"; next}
+/booktitle.*=.*/ {print "   @InTitle { " cont " }"; next}
+/institution.*=.*/ {print "   @Institution { " cont " }"; next}
+/journal.*=.*/ {print "   @Journal { " cont " }"; next}
+/key.*=.*/ {print " { " cont " }"; next}
+# /.*=.*/ {print "   @Keywords { " cont " }"; next}
+# /.*=.*/ {print "   @Label { " cont " }"; next}
+/month.*=.*/ {print "   @Month { " cont " }"; next}
+/note.*=.*/ {print "   @Note { " cont " }"; next}
+/number.*=.*/ {print "   @Number { " cont " }"; next}
+/organization.*=.*/ {print "   @Organization { " cont " }"; next}
+/pages.*=.*/ {print "   @Pages { " cont " }"; next}
+#/pages.*=.*/ {print "   @Page { " cont " }"; next}
+# /.*=.*/ {print "   @Pinpoint { " cont " }"; next}
+/location.*=.*/ {print "   # @Location { " cont " }"; next}
+/doi.*=.*/ {print "   # @Doi { " cont " }"; next}
+/publisher.*=.*/ {print "   @Publisher { " cont " }"; next}
+/title.*=.*/ {print "   @Title { " cont " }"; next}
+# /.*=.*/ {print "   @TitleNote { " cont " }"; next}
+/type.*=.*/ {print "   @TRType { " cont " }"; next}
+/url.*=.*/ {print "   @URL { " cont " }"; next}
+/volume.*=.*/ {print "   @Volume { " cont " }"; next}
+/year.*=.*/ {print "   @Year { " cont " }"; next}
+/isbn.*=.*/ {print "   @ISBN { " cont " }"; next}

-
-
-
-  {	"@Type",	"typ",		"TYPE",		},
-  {	"@Tag",		"tag",		"NUMBER",	},
-  {	"@Abstract",	"",		"",		},
-  {	"@Address",	"address",	"",		},
-  {	"@Annote",	"annote",	"PROBLEM",	},
-  {	"@Author",	"author",	"AUTHOR",	},
-  {	"",		"chapter",	"",		},
-  {	"@Day",		"",		"",		},
-  {	"@Edition",	"edition",	"",		},
-  {	"@HowPublished","howpublished",	"",		},
-  {	"@InAuthor",	"editor",	"",		},
-  {	"@InTitle",	"booktitle",	"",		},
-  {	"@Institution",	"institution",	"INSTIT",	},
-  {	"@Journal",	"journal",	"SOURCE",	},
-  {	"",		"key",		"",		},
-  {	"@Keywords",	"",		"",		},
-  {	"@Label",	"",		"",		},
-  {	"@Month",	"month",	"",		},
-  {	"@Note",	"note",		"",		},
-  {	"@Number",	"number",	"ISSUE",	},
-  {	"@Organization","organization",	"",		},
-  {	"@Pages",	"pages",	"FIRSTPAGE",	},
-  {	"@Page",	"pages",	"",		},
-  {	"@Pinpoint",	"",		"",		},
-  {	"@Publisher",	"publisher",	"PUBLISHER",	},
-  {	"@Title",	"title",	"NAME",		},
-  {	"@TitleNote",	"",		"",		},
-  {	"@TRType",	"type",		"",		},
-  {	"@URL",		"url",		"",		},
-  {	"@Volume",	"volume",	"VOL",		},
-  {	"@Year",	"year", 	"YEAR",		},
+## close the record
+{if (have) print "}\n\n"; have = 0; next}


Languages: add Kurdish language

Languages: add Kurdish language

--- include/Languages.awk
+++ include/Languages.awk
@@ -169,6 +169,19 @@
     Locale["ky"]["iso"]                = "kir"
     Locale["ky"]["glotto"]             = "kirg1245"
     Locale["ky"]["script"]             = "Cyrl"
+
+    #? Kurdish, Latin alphabet
+    Locale["ku"]["name"]               = "Kurdish"
+    Locale["ku"]["endonym"]            = "Kurdî"
+    #Locale["ku"]["translations-of"]
+    #Locale["ku"]["definitions-of"]
+    #Locale["ku"]["synonyms"]
+    #Locale["ku"]["examples"]
+    #Locale["ku"]["see-also"]
+    Locale["ku"]["family"]             = "Indo-European"
+    Locale["ku"]["iso"]                = "kur"
+    Locale["ku"]["glotto"]             = "kurd1259"
+    Locale["ku"]["script"]             = "Latn"

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


Languages: Google Translate does not distinguish between Bokmål and Nynorsk

--- include/Languages.awk
+++ include/Languages.awk
@@ -1411,6 +1411,8 @@
     LocaleAlias["ji"] = "yi" # withdrawn language code for Yiddish
     LocaleAlias["jw"] = "jv" # withdrawn language code for Javanese
     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
+    LocaleAlias["nn"] = "no"
     LocaleAlias["sh"] = "sr" # Serbo-Croatian: default to Serbian
     LocaleAlias["zh"] = "zh-CN" # Chinese: default to Chinese Simplified
     LocaleAlias["zho"] = "zh-CN"


Allow generated python file to accept a -threads argument to limit the number of threads a solver uses.

--- fzn/fzn2py.awk
+++ fzn/fzn2py.awk
@@ -245,12 +245,14 @@
 END {
 	if (!error) {
 	print "solvers = ['Mistral', 'SCIP', 'MiniSat', 'Toulbar2', 'Gurobi']";
-	print "default = dict([('solver', 'Mistral'), ('verbose', 0), ('tcutoff', 900), ('var', 'DomainOverWDegree'), ('val', 'Lex'), ('rand', 2)])";
+	print "default = dict([('solver', 'Mistral'), ('verbose', 0), ('tcutoff', 900), ('var', 'DomainOverWDegree'), ('val', 'Lex'), ('rand', 2), ('threads', 1)])";
 	print "param = input(default)";
 	print "solver = model.load(param['solver'])";
 	print "solver.setVerbosity(param['verbose'])";
 	print "solver.setTimeLimit(param['tcutoff'] - int(time.clock()+0.5))";
 	print "solver.setHeuristic(param['var'], param['val'], param['rand'])";
+	print "if param['solver'] == 'Gurobi':";
+	print "    solver.setThreadCount(param['threads'])";
 	print "if param['solver'] == 'Mistral':";
 	print "    solver.solveAndRestart(GEOMETRIC, 256, 1.3)";
 	print "else:";


Python model, generated from Flatzinc, is now wrapped in a get_model() function so it can be imported easily.


GenTK: log tk value for future debugging (see #94#issuecomment-165719346)

--- include/GenTK.awk
+++ include/GenTK.awk
@@ -37,5 +37,10 @@
     a = genRL(a, ub)
     0 > a && (a = and(a, 2147483647) + 2147483648)
     a %= 1e6
-    return TK[text] = a "." xor(a, tkk)
+    TK[text] = a "." xor(a, tkk)
+
+    l(text, "text")
+    l(tkk, "tkk")
+    l(TK[text], "tk")
+    return TK[text]
 }


Match pbxproj generated with SwiftPM command

--- scripts/filter-build-settings.awk
+++ scripts/filter-build-settings.awk
@@ -11,15 +11,15 @@
 # copyright:
 #     Copyright © 2017 Toshihiro Suzuki. All rights reserved.
 #
-/\t\t\tbuildSettings/ {
+/[ \t][ \t]*buildSettings/ {
     B="filter"
     print $0
 }
-!/\t\t\tbuildSettings/ {
+!/[ \t][ \t]*buildSettings/ {
     if (B != "filter") {
         print $0
     } else {
-        if ($1 == "\t\t\t};") {
+        if ($1 == "\t\t\t};" || $1 == "         };") {
             B=""
             print $0
         }


Languages: add Cherokee language

Languages: add Cherokee language

--- include/Languages.awk
+++ include/Languages.awk
@@ -432,6 +432,19 @@
     Locale["xh"]["iso"]                = "xho"
     Locale["xh"]["glotto"]             = "xhos1239"
     Locale["xh"]["script"]             = "Latn"
+
+    #? Cherokee
+    Locale["chr"]["name"]               = "Cherokee"
+    Locale["chr"]["endonym"]            = "ᏣᎳᎩ"
+    #Locale["chr"]["translations-of"]
+    #Locale["chr"]["definitions-of"]
+    #Locale["chr"]["synonyms"]
+    #Locale["chr"]["examples"]
+    #Locale["chr"]["see-also"]
+    Locale["chr"]["family"]             = "Iroquoian"
+    Locale["chr"]["iso"]                = "chr"
+    Locale["chr"]["glotto"]             = "cher1273"
+    Locale["chr"]["script"]             = "Cher"

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


linkparser v0.3.1

linkparser v0.3.1

* Re-organize the code in a cleaner manner, which seems better
architectured.
* Get dependence file(.d, or .D) from cmd file(.cmd), replacing the
old algorithm.

--- linkparser/linkparser.awk
+++ linkparser/linkparser.awk
@@ -1,12 +1,11 @@
 BEGIN {
-	version = "0.2.0"
+	version = "0.3.1"
 	printf("link-parser, v%s\n", version)

 	true = 1
 	false = 0
-	g_pat_srccommon = "\\/sw\\/vobs.+"
-	g_sroot = ""
-	inst_root = ""
+	g_srcroot = ""
+	g_instroot = ""
 	tar_root = ""

 	# Colors
@@ -37,28 +36,57 @@
 		}
 	}

-	# Skip head lines
-	getline
+	# Get g_srcroot
+	getline line
+	get_g_srcroot(line)
+	printf("Parsing and dumping, this may take for a while...\n")
 }

 /^[^-]/ {
+	# A link is a file name suffixed with '.o', '.lib' or '.obj' in a line.
 	link = $0
 	# Remove the ending ' \'
 	gsub(/[ \t]+\\$/, "", link)

-	if (g_sroot == "") {
-		printf("Grabbing sources and headers ...\n")
-		g_sroot = get_sroot(link)
-		"date +%Y%m%d-%H%M%S" | getline date
-		inst_root = g_sroot"-"date
-	}
-
-	# ---------
-	# Sources
-	# ---------
-
+	# Parse .cmd files
 	cmd_file = link".cmd"
-	while ((getline line < cmd_file) > 0) {
+	parse_cmd(cmd_file)
+}
+
+function get_g_srcroot(line) {
+	if (g_srcroot)
+		return
+
+	patt = "\\/sw\\/vobs.+"
+	if (line !~ patt)
+		return
+
+	gsub(patt, "", line)
+	patt = ".+\\/"
+	gsub(patt, "", line)
+	g_srcroot = line
+	"date +%Y%m%d-%H%M%S" | getline date
+	g_instroot = g_srcroot"-"date
+
+	if (destdir)
+		g_instroot = destdir"/"g_instroot
+}
+
+function parse_cmd(cmd) {
+	while ((getline line < cmd) > 0) {
+		# Get dependence file, in the argument of option '-Wp,-MD'
+		patt = "cd (.+);.+-MD,([^ \t]+)\\.d.+"
+		if (line ~ patt) {
+			dep = gensub(patt, "\\1/\\2.D", "g", line)
+			# Parsing dependence file
+			parse_dep(dep)
+		} else if (pretend) {
+			print RED line NC
+		}
+
+		# Get source file, suffixed with '.c', '.cpp', or '.cc'
+		# ...
+
 		# abosolute path
 		if (line ~ /[ \t]+-c[ \t]+\/.+$/)
 			source = gensub(/^.+[ \t]+-c[ \t]+(.+)$/, "\\1", "g", line)
@@ -77,25 +105,19 @@
 		if (source ~ patt)
 			continue;

-		rel_install(source, g_sroot, inst_root)
-	}
-	close(cmd_file)
-
-	# ---------
-	# Headers
-	# ---------
-
-	gsub(/\.(obj|o|lib)$/, "", link)
-	dep_file = link ".D"
-
-	if ((getline < dep_file) < 0)
-		next
-
+		rel_install(source, g_srcroot, g_instroot)
+	}
+	close(cmd)
+}
+
+function parse_dep(dep) {
 	# Get path prefix
+	if ((getline < dep) < 0)
+		return
 	cur_path = $1
 	gsub(/^#/, "", cur_path)

-	while ((getline < dep_file) > 0) {
+	while ((getline < dep) > 0) {
 		gsub(/.+:/, " ")
 		for (i = 1; i <= NF; i++) {
 			#if ($i !~ /\.(h|hpp)$/)
@@ -108,15 +130,15 @@
 				if (header ~ patt) {
 					buildroot_host_path = gensub(patt, "\\1", "g", header)

-					patt = ".+\\/"g_sroot"\\/sw\\/vobs"
-					gsub(patt, inst_root"/sw/vobs", buildroot_host_path)
+					patt = ".+\\/"g_srcroot"\\/sw\\/vobs"
+					gsub(patt, g_instroot"/sw/vobs", buildroot_host_path)
 				}
 			}

-			rel_install(header, g_sroot, inst_root)
+			rel_install(header, g_srcroot, g_instroot)
 		}
 	}
-	close(dep_file)
+	close(dep)
 }

 END {
@@ -125,7 +147,7 @@
 	print "Total dumped files: " count

 	if (buildroot_host_path && arg !~ /pretend/)
-		system("mv " buildroot_host_path " " inst_root)
+		system("mv " buildroot_host_path " " g_instroot"/sw/")

 	if (arg ~ /tar/)
 		make_tarball(arg)
@@ -139,9 +161,6 @@
 	patt = "^.+\\/"rel_root"\\/(sw.+)"
 	rel_path = gensub(patt, "\\1", "g", dir)

-	if (destdir)
-		new_root = destdir "/" new_root
-
 	if (pretend) {
 		print source > rel_root".source.list"
 		print rel_path"/"base > rel_root".relative.list"
@@ -149,35 +168,29 @@
 	}

 	system("mkdir -p " new_root "/" rel_path)
+
+	cmdline = "if test -e " new_root "/" rel_path "/" base \
+		";then echo yes;else echo no;fi"
+	cmdline |getline ret
+	close(cmdline)
+	if (ret == "yes") {
+		count--
+		return 0
+	}
+
 	system("cp -fL " source " " new_root "/" rel_path)
 }

 function make_tarball(flag) {
-	tarball = inst_root ".tar.gz"
+	tarball = g_instroot ".tar.gz"
 	printf("Generating source tarball %s%s%s%s ...\n", RED, BOL, tarball, NC)

 	if (pretend || SKIP_END)
 		exit 0

-	"pwd" |getline oldpwd
-	if (destdir)
-		system("cd " destdir)
-
-	system("tar zcf " tarball " " inst_root)
+	system("tar zcf " tarball " " g_instroot)
 	if (flag ~ /purge/)
-		system("rm -r "inst_root)
-
-	if (destdir)
-		system("cd " oldpwd)
-}
-
-function get_sroot(line) {
-	if (line !~ g_pat_srccommon)
-		return ""
-
-	gsub(g_pat_srccommon, "", line);
-	gsub(/.+\//, "", line);
-	return line;
+		system("rm -r "g_instroot)
 }

 # dirname
@@ -217,10 +230,6 @@

 ###### Test #########
 function do_test() {
-	printf("%s%s%s%s\n", BLU, BOL, "---- Test get_sroot ----", NC)
-	test_get_sroot("/repo/lulinw/isam/sw/vobs/esam/build");
-	test_get_sroot("/repo/lulinw/isam/sw/esam/build");
-
 	printf("%s%s%s%s\n", BLU, BOL, "---- Test dirname ----", NC)
 	test_dirname("/home/abc");
 	test_dirname("home///abc//");
@@ -240,14 +249,6 @@
 	test_basename("/../abc/efg/")
 }

-function test_get_sroot(line) {
-	if ((ret = get_sroot(line)) == "") {
-		printf("Unexpected line [PAT=%s]:\n  %s%s%s\n",
-				g_pat_srccommon, RED, line, NC)
-	} else
-		printf("Root of %s is\n  %s%s%s\n", line, GRN, get_sroot(line), NC)
-}
-
 function test_dirname(path) {
 	printf("dirname(%s) is \n  %s%s%s\n", path, GRN, dirname(path), NC)
 }


Initialize first to -1; this will create a (nearly) empty file on failure,
instead of looping until the disk is full.  This kind of failure can
especially happen when a version of awk that doesn't support POSIX
character classes is used.

Submitted by:	David Wolfskill <david@catwhisker.org>

--- sys/boot/common/merge_help.awk
+++ sys/boot/common/merge_help.awk
@@ -8,7 +8,7 @@
 BEGIN \
 {
   state = 0;
-  first = 0;
+  first = -1;
   ind = 0;
 }


Add information about the payload format

git-svn-id: 392d0e5ce652024192c571322d40dcc23d6d83b0@146 8a65f31f-a56f-4bd6-98e8-2755f64920ec

--- scripts/long2html.awk
+++ scripts/long2html.awk
@@ -218,6 +218,12 @@
       PL[id] = $0
       id++

+      # The payload has the following format:
+      # 0000  74 2d 4c 65 6e 67 74 68 3a 20 32 31 33 0d 0a 50   t-Length: 213..P
+      # 0010  2d 41 73 73 65 72 74 65 64 2d 49 64 65 6e 74 69   -Asserted-Identi
+      # ....
+      # 0160  76 65 64 2d 55 73 65 72 3a 20 3c 73 69 70 3a 62   ved-User: <sip:b
+      # The following code block displays the data in a human readable format
       if ((length($1) == 4) && ($1 != "Data")) {
         PAYLOAD = substr($0, 7, 50)
         L = split(PAYLOAD, CHARS, " ")


Fix the modules path in the xpi chrome.manifests

--- common/process_manifest.awk
+++ common/process_manifest.awk
@@ -5,7 +5,7 @@
     $NF = "jar:chrome/" name ".jar!" $NF
 }
 {
-    sub("^\\.\\./liberator/", "", $NF)
+    sub("^\\.\\./common/", "", $NF)
     print
 }


change whitespace

change whitespace

--- scripts/label_dot_edge.awk
+++ scripts/label_dot_edge.awk
@@ -18,7 +18,7 @@

 BEGIN{FS="\t"; OFS="\t"}
 # load labels
-FNR == NR && $3 != "null"{label[$1$2]=$3}
+FNR == NR && $3 != "null"{label[$1 $2]=$3}

 # output lines that do not get labels
 FNR != NR && !/.* -> .*label=.*/ {print}


Split debug output into 4 files

Split debug output into 4 files

--- getBBoxEpisodesFrom-webscraper.awk
+++ getBBoxEpisodesFrom-webscraper.awk
@@ -13,7 +13,14 @@
     FS="\t"
     OFS="\t"
     print "Sortkey\tTitle\tSeasons\tEpisodes\tDuration\tYear(s)\tRating\tDescription"
-    print "Type\t#\tSortkey\tURL\tshowTitle\tepisodeTitle\tYear(s)" > "debug.csv"
+    # For debugging variations in seasons and episodes format
+    str = "date +%y%m%d.%H%M%S"
+    str | getline longdate
+    close str
+    for ( i = 1; i <= 4; i++ ) {
+        outfile = "BBox-scrapes/c" i "-" longdate ".csv"
+        print "Type\t#\tSortkey\tURL\tshowTitle\tepisodeTitle\tYear(s)" > outfile
+    }
 }

 {
@@ -43,7 +50,8 @@
         episodeNumber = substr(fld[nflds-1], 2)
         sortkey = sprintf ("%s%02dE%03d", showtype, seasonNumber, episodeNumber)
         c1Num += 1
-        printf ("c1\t%d\t%s\t%s\t%s\t%s\t%s\n",c1Num,sortkey,URL,showTitle,episodeTitle,Years) >>"debug.csv"
+        outfile = "BBox-scrapes/c1-" longdate ".csv"
+        printf ("c1\t%d\t%s\t%s\t%s\t%s\t%s\n",c1Num,sortkey,URL,showTitle,episodeTitle,Years) >> outfile
     } else if (URL ~ /_E[[:digit:]]*_[[:digit:]]*$/) {
         # /us/episode/35_Hours_E1_26129
         # 35 Hours, Episode 1
@@ -51,7 +59,8 @@
         episodeNumber = substr(fld[nflds-1], 2)
         sortkey = sprintf ("%s%02dE%03d", showtype, seasonNumber, episodeNumber)
         c2Num += 2
-        printf ("c2\t%d\t%s\t%s\t%s\t%s\t%s\n",c2Num,sortkey,URL,showTitle,episodeTitle,Years) >>"debug.csv"
+        outfile = "BBox-scrapes/c2-" longdate ".csv"
+        printf ("c2\t%d\t%s\t%s\t%s\t%s\t%s\n",c2Num,sortkey,URL,showTitle,episodeTitle,Years) >> outfile
     } else if (URL ~ /Episode_[[:digit:]]*_[[:digit:]]*$/) {
         # /us/episode/Episode_5_26089
         # Season 4, Episode 5
@@ -59,14 +68,16 @@
         episodeNumber = substr(fld[nflds-1], 1)
         sortkey = sprintf ("%s%02dE%03d", showtype, seasonNumber, episodeNumber)
         c3Num += 3
-        printf ("c3\t%d\t%s\t%s\t%s\t%s\t%s\n",c3Num,sortkey,URL,showTitle,episodeTitle,Years) >>"debug.csv"
+        outfile = "BBox-scrapes/c3-" longdate ".csv"
+        printf ("c3\t%d\t%s\t%s\t%s\t%s\t%s\n",c3Num,sortkey,URL,showTitle,episodeTitle,Years) >> outfile
     } else {
         URL ~ /^\/us\/movie\// ? showtype = "M" : showtype = "E"
         # /us/episode/Orkneys_Stone_Age_Temple_7144
         # A History of Ancient Britain Special, Orkney's Stone Age Temple
         sortkey = sprintf ("%s%05d", showtype, fld[nflds])
         c4Num += 4
-        printf ("c4\t%d\t%s\t%s\t%s\t%s\t%s\n",c4Num,sortkey,URL,showTitle,episodeTitle,Years) >>"debug.csv"
+        outfile = "BBox-scrapes/c4-" longdate ".csv"
+        printf ("c4\t%d\t%s\t%s\t%s\t%s\t%s\n",c4Num,sortkey,URL,showTitle,episodeTitle,Years) >> outfile
     }

     # Convert duration from minutes to HMS


Improving c2 but a few specials remaining

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

+    shortURL = URL
     if (match (episodeTitle, /^Season [[:digit:]]+|^Series [[:digit:]]+/))
         episodeSeason = substr(episodeTitle,8,RLENGTH-7)
     else
@@ -56,7 +57,6 @@
         # Give precedence to season number in episodeTitle over season number in URL
         if (episodeSeason != "" && seasonNumber+0 != episodeSeason+0) {
             revisedSeasons1 += 1
-            shortURL = URL
             sub (/^\/us\/episode\//,"",shortURL)
             printf ("==> Fixed c1 season: %02d-%02d\t%s\t%s\n", \
                     seasonNumber, episodeSeason, shortURL, episodeTitle) >> ERROR_FILE
@@ -70,7 +70,12 @@
         # /us/episode/35_Hours_E1_26129
         # 35 Hours, Episode 1
         revisedSeasons2 += 1
-        seasonNumber = "99"
+        episodeSeason = Years
+        if (episodeSeason != "" && seasonNumber+0 != episodeSeason+0) {
+            printf ("==> Fixed c2 season: %02d-%02d\t%s\t%s\n", \
+                    seasonNumber, episodeSeason, shortURL, episodeTitle) >> ERROR_FILE
+            seasonNumber = episodeSeason
+        }
         episodeNumber = substr(fld[nflds-1], 2)
         sortkey = sprintf ("%s%02dE%03d", showtype, seasonNumber, episodeNumber)
         c2Num += 1


comments

comments

--- scripts/label_dot_edge.awk
+++ scripts/label_dot_edge.awk
@@ -1,16 +1,16 @@
 #! /usr/bin/gawk -f

 # label_dot_edge.awk
-# example:
+# Attempts to augment opaque ontological terms with their current label
+# example usage:
 # label_dot_edge.awk predicate_curie_term_label.tab  in.dot > out.dot
 #
+# Arguments: two files
 # Loads the first file as a map from terms to labels:
 # (expects: [namespace:]<tab><term><tab><label>[<tab><whatever>])
-# the first set was generated via cypher queries agains whr scigerph (neo4j)
-# instance loaded with the ontologies we use.
-
-
-# In the second Graphviz digraph dot format file:
+# the first set was generated via cypher queries against our scigraph
+# (neo4j) instance loaded with the ontologies we use.
+# Reads the second Graphviz digraph dot format file:
 # looks for <term> as edge-text
 # and appends "! <label> (Iff <term> is found in map)
 # note: This "<term> ! <label>" structure is a convention used by Ontologists.


Languages: add Oriya script

Languages: add Oriya script

--- include/Languages.awk
+++ include/Languages.awk
@@ -1582,6 +1582,7 @@
     case "Latn": return "Latin"
     case "Mlym": return "Malayalam"
     case "Mymr": return "Myanmar"
+    case "Orya": return "Oriya"
     case "Sinh": return "Sinhala"
     case "Taml": return "Tamil"
     case "Telu": return "Telugu"


Languages: mark as stable: Luxembourgish

--- include/Languages.awk
+++ include/Languages.awk
@@ -192,8 +192,7 @@
     Locale["ku"]["glotto"]             = "kurd1259"
     Locale["ku"]["script"]             = "Latn"

-    #? Luxembourgish
-    Locale["lb"]["support"]            = "unstable"
+    # Luxembourgish
     Locale["lb"]["name"]               = "Luxembourgish"
     Locale["lb"]["endonym"]            = "Lëtzebuergesch"
     #Locale["lb"]["translations-of"]


Fixed problem of BSD awk returning -0 from 10 % 5.

darcs-hash:20060228153855-65a35-bda8dcdb283315c33c9b00b1290057437185821d.gz

--- libsofia-sip-ua/msg/msg_parser.awk
+++ libsofia-sip-ua/msg/msg_parser.awk
@@ -411,7 +411,9 @@
       if (h < 0)
 	continue;

-      for (j = h % MC_HASH_SIZE; j in header_hash;) {
+      j = h % MC_HASH_SIZE; if (j == -0) j = 0;
+
+      for (; j in header_hash;) {
 	if (++j == MC_HASH_SIZE) {
 	  j = 0;
 	}


Fix bug

Fix bug

--- creation/web_base/parse_starterlog.awk
+++ creation/web_base/parse_starterlog.awk
@@ -1,5 +1,6 @@
 BEGIN {
   year=strftime("%Y");
+  starttime=0;
   ended_jobs=0;
   total_used=0;
   goodputZ=0;
@@ -41,10 +42,10 @@
     }
   }
   shadow=$(changenr+3);
-  shadow=substr(shadow,3,length(shadow)-4)
+  shadow=substr(shadow,2,length(shadow)-2)
   #print  $1,$2,"Shadow:",shadow
 }
-/ Starting .* job with ID /{
+/ Starting .* job with ID: /{
   # 7/17 10:42:21 (pid:26855) Starting a VANILLA universe job with ID: 40.0
   #
   for (i=1; i<NF; i++) {
@@ -92,8 +93,14 @@
   if (ended<starttime) { # around new year
     ended=convert_date(year+1,$1,$2);
   }
-  joblength=ended-starttime;
-
+
+  if (starttime>0) {
+    joblength=ended-starttime;
+  } else {
+    # protect from incomplete data
+    joblength=0;
+  }
+
   ended_jobs++;
   total_used+=joblength;

@@ -117,6 +124,7 @@
   # cleanup, so it is not reused by accident
   jid="";
   shadow="";
+  starttime=0;
 }

 ########################################################################


new: vendor id for Apple Inc.

new: vendor id for Apple Inc.

--- scripts/lib/awk/fwts/bios_info.awk
+++ scripts/lib/awk/fwts/bios_info.awk
@@ -106,6 +106,10 @@
   vendor = tolower(vendor);

   switch (vendor) {
+    # Apple Inc.
+    case /apple/:
+      return "apple";
+
     # Phoenix Technologies Ltd.
     case /phoenix/:
       return "phoenix"


add awk program

add awk program


Print last two lines in Avg

Print last two lines in Avg


Do not check nisas

Do not check nisas

--- misc/rdf-nt.awk
+++ misc/rdf-nt.awk
@@ -25,7 +25,7 @@
     nsenses = split($3, senses, ", ");
     nisas   = split($5, isas,   ", ");

-    if (nsenses == 0 || nisas == 0) next;
+    if (nsenses == 0) next;

     print "<" URN "c" $1 ">", TYPE,  CONCEPT,            ".";
     print "<" URN "c" $1 ">", LABEL, "\"synset" $1 "\"", ".";


Translators/BingTranslator: fix for Hmong Daw

--- include/Translators/BingTranslator.awk
+++ include/Translators/BingTranslator.awk
@@ -226,6 +226,7 @@
     # See: <https://docs.microsoft.com/en-us/azure/cognitive-services/Translator/language-support>
     if (_sl == "auto")  _sl = "auto-detect"
     if (_sl == "tl")    _sl = "fil" # Bing uses 'fil' for Filipino
+    if (_sl == "hmn")   _sl = "mww" # Bing uses 'mww' for Hmong Daw
     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
@@ -233,6 +234,7 @@
     if (_sl == "zh-CN") _sl = "zh-Hans"
     if (_sl == "zh-TW") _sl = "zh-Hant"
     if (_tl == "tl")    _tl = "fil"
+    if (_tl == "hmn")   _tl = "mww"
     if (_tl == "no")    _tl = "nb"
     if (_tl == "pt-BR") _tl = "pt"
     else if (_tl == "pt-PT") _tl = "pt-pt"


Improve wording re bad durations

Improve wording re bad durations

--- getAcornFrom-seriesPages.awk
+++ getAcornFrom-seriesPages.awk
@@ -171,11 +171,11 @@
     split ($0,fld,"\"")
     # broken times in Jamaica Inn (may be temporary)
     if (episodeURL ~ /\/jamaicainn\// && fld[4] == "T-1M57S") {
-        printf ("==> Bad duration: %s  %s\n", episodeURL, fld[4]) >> ERROR_FILE
+        printf ("==> Corrected duration: %s  %s\n", episodeURL, fld[4]) >> ERROR_FILE
         fld[4] = "T59M18S"
     }
     if (episodeURL ~ /\/jamaicainn\/bonus\/cast-and-crew-interviews/ && fld[4] = "T09M08S") {
-            printf ("==> Bad duration: %s  %s\n", episodeURL, fld[4]) >> ERROR_FILE
+            printf ("==> Corrected duration: %s  %s\n", episodeURL, fld[4]) >> ERROR_FILE
         fld[4] = "T25M54S"
     }
     split (fld[4],tm,/[TMS]/)


dbcreate.csh -gld_has_db_fullpath now creates mumps.gld file with a pointer to corresponding mumps.repl file (#270)

--- com/dbcreate_multi.awk
+++ com/dbcreate_multi.awk
@@ -245,6 +245,8 @@
 	    }
 	    }
       }
+      if (value["gld_has_db_fullpath"])
+          print "change -instance -file_name=" ENVIRON["PWD"] "/mumps.repl"

       print "\\_GDE_EOF"
       print "$gtm_tst/com/usesprgde.csh >> dbcreate.gde"


SCCS mkdoc.awk 11/01/24 00:08:28: Updated Copyright

--- run/mkdoc.awk
+++ run/mkdoc.awk
@@ -1,6 +1,6 @@
 #-------------------------------------------------------------------------------
 # Phorward Software Development Kit
-# Copyright (C) 2009, 2010 by Phorward Software Technologies, Jan Max Meyer
+# Copyright (C) 2009-2011 by Phorward Software Technologies, Jan Max Meyer
 # http://www.phorward-software.com ++ contact<at>phorward<dash>software<dot>com
 # All rights reserved. See $PHOME/LICENSE for more information.
 #


Use FILENAME built-in variable.

Use FILENAME built-in variable.


Fix awk lint #chunks

Fix awk lint #chunks

--- chunks/chunks.awk
+++ chunks/chunks.awk
@@ -5,5 +5,7 @@
 #
 # sub(regexp, replacement [, target])

-print "something" > "/dev/stderr"
+{
+  print "something" > "/dev/stderr"
+}


Deleted awk script (old dependency)

Deleted awk script (old dependency)

--- spotify_song.awk
+++ spotify_song.awk
@@ -1,23 +0,0 @@
-/string  *"xesam:artist/{
-    while (1) {
-        getline line
-        if (line ~ /string "/) {
-            sub(/.*string "/, "artist:", line)
-            sub(/".*$/, "", line)
-            print line
-            break
-        }
-    }
-}
-/string  *"xesam:title/{
-    while(1) {
-        getline line
-        if (line ~ /string "/) {
-            sub(/.*string "/, "title:", line)
-            sub(/".*$/, "", line)
-            print line
-            break
-        }
-    }
-}
-


HvD: The SVN Id: string looks a little bit different from the CVS one. However, we cannot dispose of the CVS one as this appears in a quite a few Global Array files.  So I simply added a special set of commands to deal with SVN Id: strings to ensure they are properly extracted.

--- src/util/ids.awk
+++ src/util/ids.awk
@@ -2,7 +2,8 @@
 # This script is used by the makefile in building util_version.f.
 # It expects on standard input lines containing
 #
-# a CVS ID    -> produce a write statement with the ID
+# a CVS ID    -> produce a write statement with the ID ("Exp" at the end)
+# a SVN ID    -> produce a write statement with the ID (no "Exp" at the end)
 # module name -> produce a write statement for the module name
 # other       -> produce nothing
 #
@@ -33,6 +34,13 @@
 				 printf("      write(6,*) ' %s'\n",substr($0,i,n));
 				}

+/\$\I\d: [^\n]* \$/		{
+				 i = index($0, "$Id: ") + 5;
+				 n = index(substr($0,i), " $") - 1;
+				 if (n > (72 - 20)) n = 72 - 20;
+				 printf("      write(6,*) ' %s'\n",substr($0,i,n));
+				}
+
 END {
 		printf("      write(6,*)\n");
 		printf("      call util_flush(6)\n");


For now, comment out the broken part

For now, comment out the broken part

--- extra/scripts/initfini.awk
+++ extra/scripts/initfini.awk
@@ -19,12 +19,12 @@
     if(/\.align/) {alignval=$2}
 # here comes some special stuff for the SuperH targets
 # Search for all labels
-    if(/_GLOBAL_OFFSET_TABLE_/) {
-      sub (":","",last);
-      glb_label[glb_idx] = last;
-      glb_idx += 1;
-      glb = $0;
-    }
+#    if(/_GLOBAL_OFFSET_TABLE_/) {
+#      sub (":","",last);
+#      glb_label[glb_idx] = last;
+#      glb_idx += 1;
+#      glb = $0;
+#    }
     last = $1;
   }
   close("initfini.s");


parsegaspriceshtml.awk: Updated to work with changed simpler HTML.

They use to have tricky image offsets for the price.
They recently changed that to plain text. Thanks!

--- parsegaspriceshtml.awk
+++ parsegaspriceshtml.awk
@@ -13,11 +13,9 @@
    ai[i]=0
 }

-inGasPriceRecord && /
/ {
-   sub("
","
")
-   gsub("\">
/ {
+   sub("^.*
]*>","")
+   sub("
.*$","")
    # print
    price[i]=$0
 }


addr_utils.awk		-- fixed awkward comment

addr_utils.awk		-- fixed awkward comment

--- lib/addr_utils.awk
+++ lib/addr_utils.awk
@@ -105,7 +105,7 @@
 	# Street should be num [ dir ] str [ st ]
 	street = ary2[1]
 	if(options["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
+		# 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]


MONDRIAN: Strict checks that Pentaho copyright is up to date; looks for spaces
    after 'static' etc.

[git-p4: depot-paths = "//open/mondrian/": change = 15005]

--- bin/checkFile.awk
+++ bin/checkFile.awk
@@ -248,7 +248,9 @@
     prevImport = thisImport;
     prevImportGroup = importGroup;
 }
-/^\/\/ Copyright .* Julian/ && strict > 1 {
+/^\/\/ Copyright .* Pentaho/ && strict > 1 {
+    # We assume that '--strict' is only invoked on files currently being
+    # edited. Therefore we would expect the copyright to be current.
     if ($0 !~ /-2012/) {
         error(fname, FNR, "copyright is not current");
     }
@@ -257,22 +259,22 @@
     # Order of qualifiers: "public/private/protected static final abstract class ..."
     s2 = s;
     gsub(/\(.*$/, "", s2);
-    if (s2 ~ /abstract .*final/) {
+    if (s2 ~ /abstract .*final /) {
         error(fname, FNR, "'final' must come before 'abstract'");
     }
-    if (s2 ~ /final .*static/) {
+    if (s2 ~ /final .*static /) {
         error(fname, FNR, "'static' must come before 'final'");
     }
-    if (s2 ~ /abstract .*static/) {
+    if (s2 ~ /abstract .*static /) {
         error(fname, FNR, "'static' must come before 'abstract'");
     }
-    if (s2 ~ /static .*(public|protected|private)/) {
+    if (s2 ~ /static .*(public|protected|private) /) {
         error(fname, FNR, "'public/private/protected' must come before 'static'");
     }
-    if (s2 ~ /final .*(public|protected|private)/) {
+    if (s2 ~ /final .*(public|protected|private) /) {
         error(fname, FNR, "'public/private/protected' must come before 'final'");
     }
-    if (s2 ~ /abstract .*(public|protected|private)/) {
+    if (s2 ~ /abstract .*(public|protected|private) /) {
         error(fname, FNR, "'public/private/protected' must come before 'abstract'");
     }
 }


Dredge out edge drawing common to loops and edges between nodes.

--- share/bin/plain2mp.awk
+++ share/bin/plain2mp.awk
@@ -78,6 +78,40 @@
 	print "enddef;";

+	print "vardef fsmedge(expr tail, head, e, lab) =";
+
+	print "	drawarrow e withpen pencircle scaled 1bp;";
+
+	print "	if lab <> \"\":"
+	print "		pair bl;";
+	print "		pair ml; ml := .5[tail, head];"
+
+	# TODO: new idea; draw right angle from midpoint, and use that to find intersection with b
+	# this way it should always align for multiple edges, even if on a slant
+
+	print "		draw point (length b / 2) of b withpen pencircle scaled 4bp withcolor blue;"
+#	print "		draw tail -- head withpen pencircle scaled 1bp withcolor green;"
+#	print "		draw ml withpen pencircle scaled 5bp withcolor green;"
+
+	print "		bl := point (length b / 2) of b;"
+
+	# TODO: plus label delta, distancing it from point. make a label function
+	# TODO: maybe an "extend" function, to extend a path in its direction. use dotprod for that?
+
+	# lft | rt | top | bot | ulft | urt | llft | lrt
+	# TODO: round label coordinates to grid? quantize rather
+
+	# labels ought to be below, if they're below the straight line from head-tail, or above otherwise
+	# TODO: find what quadrant the line is, and make this .rt/.lft instead of .top/.bot
+	print "		if ypart bl < ypart ml:" # TODO: threshold for considering "below"
+	print "			label.bot(lab, bl shifted (0, -3bp));"
+	print "		else:"
+	print "			label.top(lab, bl shifted (0, +3bp));"
+	print "		fi;"
+	print "	fi;"
+
+	print "enddef;";
+
 	print "vardef fsmloop(expr node, diam, p, q, lab, loops) ="
 	print "	path pp; pp = node -- 0.5[p, q];"
 	print "	draw p -- q withpen pencircle scaled 0.5bp withcolor green;"
@@ -87,17 +121,12 @@
 	# extend loop 1.25 * diameter
 	# count number of self-loops for this node, and increment extension
 	print "	l := length pp;"
-	print "	pair m; m := (0.5 + 2 * mlog(loops + 1) / 256) * diam * unitvector(direction l of pp) shifted node;"
+	print "	pair m; m := (0.5 + 2 * mlog(loops + 2) / 256) * diam * unitvector(direction l of pp) shifted node;"
 	# u3 = u1 projectedalong u2;
 	print "	draw node -- m withpen pencircle scaled 0.5bp withcolor green;"

-	print "	if lab <> \"\":"
-	# TODO: top or bottom, depending on green line direction
-	print "		label.top(lab, m);"
-	print "	fi;"
-
 	print "	path b; b := node .. q .. m .. p .. node;"
-	print "	drawarrow b cutbefore q cutafter p withpen pencircle scaled 1bp;";
+	print "	fsmedge(node, node, b cutbefore q cutafter p, lab);"

 	print "enddef;";

@@ -114,48 +143,15 @@
 	print "	if head = tail:"
 	print "		fsmloop(head, headdiam, p, q, lab, loops);"
 	print "	else:"
-
 	print "		path b; b = tail .. q .. p .. head;"
-
 	# TODO: explain this. we permit a 2% lengthening threshold relative to graphviz's b-spline
 	# this affects NFA especially
+	# XXX: or (arclength b > 6in), but wigglyness would be a better metric
 	print "		r := arclength b / arclength e;";
-	print "		boolean g; g := (r > 1.02) or (r < 0.93);"; # XXX: or (arclength b > 6in);"; - no, wigglyness instead
-
-	print "		if g:"
+	print "		if (r > 1.02) or (r < 0.93):";
 	print "			b := e;"
 	print "		fi;"
-
-	print "		if lab <> \"\":"
-	print "			pair bl;";
-	print "			pair ml; ml := .5[tail, head];"
-
-	# TODO: new idea; draw right angle from midpoint, and use that to find intersection with b
-	# this way it should always align for multiple edges, even if on a slant
-
-	print "			draw point (length b / 2) of b withpen pencircle scaled 4bp withcolor blue;"
-#	print "			draw tail -- head withpen pencircle scaled 1bp withcolor green;"
-#	print "			draw ml withpen pencircle scaled 5bp withcolor green;"
-
-	print "			bl := point (length b / 2) of b;"
-
-	# TODO: plus label delta, distancing it from point. make a label function
-	# TODO: maybe an "extend" function, to extend a path in its direction. use dotprod for that?
-
-	# lft | rt | top | bot | ulft | urt | llft | lrt
-	# TODO: round label coordinates to grid? quantize rather
-
-	# labels ought to be below, if they're below the straight line from head-tail, or above otherwise
-	# TODO: find what quadrant the line is, and make this .rt/.lft instead of .top/.bot
-	print "			if ypart bl < ypart ml:" # TODO: threshold for considering "below"
-	print "				label.bot(lab, bl shifted (0, -3bp));"
-	print "			else:"
-	print "				label.top(lab, bl shifted (0, +3bp));"
-	print "			fi;"
-	print "		fi;"
-
-	print "	drawarrow b cutbefore q cutafter p withpen pencircle scaled 1bp;";
-
+	print "		fsmedge(tail, head, b cutbefore q cutafter p, lab);"
 	print "	fi;"

 	print "enddef;";
@@ -263,6 +259,8 @@

 	# TODO: find what time (lx,ly) is along graphviz's edge, e
 	# then pass the time and use that for placing our label on our edge
+	# use intersectiontimes to find the time of (lx,ly) along e
+	# or find by e cutbefore (lx,ly) and use arctime to find the time wrt e

 	printf "fsmgvedge(%s, %s.diam, %s, %s.diam, e, \"%s\", %s.loops);", tail, tail, head, head, label, head;


mmake/mwg_pp.awk (v2.1): Update.

mmake/mwg_pp.awk (v2.1): Update.

--- mmake/mwg_pp.awk
+++ mmake/mwg_pp.awk
@@ -1474,6 +1474,8 @@
     print_error("could not open the include file '" file "'");
   close(file);

+  dependency_add(file);
+
   _originalFile=m_lineno_cfile;
   _originalLine=m_lineno_cline;
   for(_i=0;_i<_n;_i++){
@@ -1618,7 +1620,7 @@
   if(m_comment_cpp)
     sub(/^\/\//,"#",_line);
   if(m_comment_pragma)
-    sub(/^\#pragma/,"#",_line);
+    sub(/^[[:space:]]*\#[[:space:]]*pragma/,"#",_line);
   if(m_comment_c&&match(_line,/^\/\*(.+)\*\/$/,_cap)>0)
     _line="#" _cap[1];

@@ -1695,6 +1697,10 @@
   m_lineno        =int(ENVIRON["PPLINENO"])!=0;

   INCLUDE_DIRECTORY=ENVIRON["HOME"] "/.mwg/mwgpp/include"
+
+  m_dependency_count=0
+  m_dependency_guard[""]=1;
+  m_dependency[0]="";
 }

 {
@@ -1709,4 +1715,35 @@
   process_line($1);
 }

-END{if(global_errorCount)exit(1);}
+function dependency_add(file){
+  if(!m_dependency_guard[file]){
+    m_dependency_guard[file]=1;
+    m_dependency[m_dependency_count++]=file;
+  }
+}
+function dependency_generate(output,target, _i,_iMax){
+  if(!target){
+    target=m_rfile;
+    sub(/\.pp$/,"",target);
+    target=target ".out";
+  }
+
+  if(m_dependency_count==0){
+    print target ": " m_rfile > output
+  }else{
+    print target ": " m_rfile " \\" > output
+    _iMax=m_dependency_count-1;
+    for(_i=0;_i<_iMax;_i++)
+      print "  " m_dependency[_i] " \\" >> output;
+    print "  " m_dependency[_iMax] >> output;
+  }
+}
+
+END{
+  # output dependencies
+  DEPENDENCIES_OUTPUT=ENVIRON["DEPENDENCIES_OUTPUT"];
+  if(DEPENDENCIES_OUTPUT)
+    dependency_generate(DEPENDENCIES_OUTPUT,ENVIRON["DEPENDENCIES_TARGET"]);
+
+  if(global_errorCount)exit(1);
+}


Add usual string functions link to awk #chunks

--- chunks/chunks.awk
+++ chunks/chunks.awk
@@ -1,3 +1,7 @@

 match($0, /^mix ([^ ]+) +# +(.*)/, arr) { print arr[1] "\t" arr[2] }

+# https://www.gnu.org/software/gawk/manual/html_node/String-Functions.html
+#
+# sub(regexp, replacement [, target])
+


bump version to 0.9.1-dev

bump version to 0.9.1-dev

--- metainfo.awk
+++ metainfo.awk
@@ -1,7 +1,7 @@
 BEGIN {
     Name        = "Translate Shell"
     Description = "Google Translate to serve as a command-line tool"
-    Version     = "0.9.0.5"
+    Version     = "0.9.1-dev"
     ReleaseDate = "2015-05-29"
     Command     = "trans"
     EntryPoint  = "translate.awk"


layerman: don't use env to find awk

layerman: don't use env to find awk

linux and osx treat it differently :(

Signed-off-by: Koen Kooi <42e3d96910f922bdd7dd1805fe3f8aff634f391d@dominion.thruhere.net>

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

 BEGIN {
 	FS =",";


Revert "ahrf.awk: Enable comment exported to HTML. This is not final"
This reverts commit bf2753dc3852b74d87001eb74526587eb8f87654.

Remove this commit. It is just bloat and it won't be enough used.


CWS-TOOLING: integrate CWS hr75

CWS-TOOLING: integrate CWS hr75

--- sw/inc/poolfmt.awk
+++ sw/inc/poolfmt.awk
@@ -1,15 +1,28 @@
 #*************************************************************************
-#*
-#*    $Workfile:        dbgxtor.awk
-#*
-#*    Ersterstellung    JP  05.10.95
-#*    Letzte Aenderung  $Author: hr $ $Date: 2000-09-18 17:14:27 $
-#*    $Revision: 1.1.1.1 $
-#*
-#*    $Logfile:   T:/sw/inc/poolfmt.awv  $
-#*
-#*    Copyright (c) 1990-1996, STAR DIVISION
-#*
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org.  If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
 #*************************************************************************

 #


mpers.awk: add support for DWARF version 2 format

* mpers.awk: Handle DW_AT_data_member_location in DWARF v2 format.

--- mpers.awk
+++ mpers.awk
@@ -158,8 +158,9 @@
 	}
 }
 /^DW_AT_data_member_location/ {
-	match($0, /[[:digit:]]+/, temparray)
-	array[idx]["location"] = temparray[0]
+	if (!match($0, /\(DW_OP_plus_uconst:[[:space:]]+([[:digit:]]+)\)/, temparray))
+		match($0, /([[:digit:]]+)/, temparray)
+	array[idx]["location"] = temparray[1]
 }
 /^DW_AT_name/ {
 	match($0, /:[[:space:]]+([[:alpha:]_][[:alnum:]_[:space:]]*)/, \


s/CID/CIS/

s/CID/CIS/

--- dev/sdmmc/devlist2h.awk
+++ dev/sdmmc/devlist2h.awk
@@ -1,5 +1,5 @@
 #! /usr/bin/awk -f
-#	$OpenBSD: devlist2h.awk,v 1.1 2006/06/01 21:15:40 uwe Exp $
+#	$OpenBSD: devlist2h.awk,v 1.2 2006/06/02 21:16:44 uwe Exp $
 #	$NetBSD: devlist2h.awk,v 1.2 1998/07/22 11:47:13 christos Exp $
 #
 # Copyright (c) 1998, Christos Zoulas
@@ -122,7 +122,7 @@
 	else {
 		products[nproducts, 4] = "{ NULL, NULL, NULL, NULL }"
 	}
-	printf("#define\tSDMMC_CID_%s_%s\t%s\n",
+	printf("#define\tSDMMC_CIS_%s_%s\t%s\n",
 	    products[nproducts, 1], products[nproducts, 2],
 	    products[nproducts, 4]) > hfile
 	printf("#define\tSDMMC_PRODUCT_%s_%s\t%s\n", products[nproducts, 1],


TINKERPOP-2073 Generate tabs for static code blocks

--- docs/preprocessor/awk/tabify.awk
+++ docs/preprocessor/awk/tabify.awk
@@ -63,9 +63,17 @@
   status = 1
   lang = gensub(/^\[gremlin-([^,\]]+).*/, "\\1", "g", $0)
   code = ""
+  evaluate = 1
 }

-/^\[source,(csharp|groovy|java|python)/ {
+/^\[source,(csharp|groovy|java|javascript|python),tab\]/ {
+  status = 1
+  lang = gensub(/^\[source,([^,\]]+).*/, "\\1", "g", $0)
+  code = ""
+  evaluate = 0
+}
+
+/^\[source,(csharp|groovy|java|javascript|python)\]/ {
   if (status == 3) {
     status = 1
     lang = gensub(/^\[source,([^\]]+).*/, "\\1", "g", $0)
@@ -73,7 +81,7 @@
   }
 }

-! /^\[source,(csharp|groovy|java|python)/ {
+! /^\[source,(csharp|groovy|java|javascript|python)/ {
   if (status == 3 && $0 != "") {
     print_tabs(next_id, tabs, blocks)
     next_id = next_id + length(tabs)
@@ -96,7 +104,7 @@
 { if (status == 3) {
     if ($0 == "----") {
       i = length(blocks) + 1
-      if (i == 1) {
+      if (i == 1 && evaluate == 1) {
         tabs[i] = "console (" lang ")"
         blocks[i] = code_header code "\n" $0 "\n"
         i++
@@ -114,7 +122,7 @@
     }
   } else {
     if (status == 0) print
-    else if (status == 1) code_header = $0
+    else if (status == 1) code_header = gensub(/,tab/, "", "g", $0)
     else code = code "\n" $0
   }
 }


doc: remove ~ from sphinx refs

doc: remove ~ from sphinx refs


MONDRIAN: New checkFile rule. Mainline mondrian code already complies.

[git-p4: depot-paths = "//open/mondrian/": change = 13245]

--- bin/checkFile.awk
+++ bin/checkFile.awk
@@ -22,13 +22,13 @@
     return !isCpp(fname);
 }
 function push(val) {
-   switchStack[switchStackLen++] = val;
+    switchStack[switchStackLen++] = val;
 }
 function pop() {
-   --switchStackLen
-   val = switchStack[switchStackLen];
-   delete switchStack[switchStackLen];
-   return val;
+    --switchStackLen
+    val = switchStack[switchStackLen];
+    delete switchStack[switchStackLen];
+    return val;
 }
 BEGIN {
     # pre-compute regexp for single-quoted strings
@@ -163,36 +163,47 @@
 s ~ /[[:alnum:]]\(/ &&
 s !~ /\<(if|while|for|switch|assert)\>/ {
     ss = s;
-    gsub(/.*[[:alnum:]]\(/, "(", ss);
-    opens = ss;
-    gsub(/[^(]/, "", opens);
-    closes = ss;
-    gsub(/[^)]/, "", closes);
-    if (length(opens) > length(closes)) {
-        if (s ~ /,$/) {
-            bras = s;
-            gsub(/[^<]/, "", bras);
-            kets = s;
-            gsub(/[^>]/, "", kets);
-            if (length(bras) > length(kets)) {
-                # Ignore case like 'for (Map.Entry<Foo,{nl} Bar> entry : ...'
-            } else if (s ~ / for /) {
-                # Ignore case like 'for (int i = 1,{nl} j = 2; i < j; ...'
+    while (match(ss, /[[:alnum:]]\(/)) {
+        ss = substr(ss, RSTART + RLENGTH - 1);
+        parens = ss;
+        gsub(/[^()]/, "", parens);
+        while (substr(parens, 1, 2) == "()") {
+            parens = substr(parens, 3);
+        }
+        opens = parens;
+        gsub(/[^(]/, "", opens);
+        closes = parens;
+        gsub(/[^)]/, "", closes);
+        if (length(opens) > length(closes)) {
+            if (ss ~ /,$/) {
+                bras = ss;
+                gsub(/[^<]/, "", bras);
+                kets = ss;
+                gsub(/->/, "", kets);
+                gsub(/[^>]/, "", kets);
+                if (length(bras) > length(kets)) {
+                    # Ignore case like 'for (Map.Entry<Foo,{nl} Bar> entry : ...'
+                } else if (s ~ / for /) {
+                    # Ignore case like 'for (int i = 1,{nl} j = 2; i < j; ...'
+                } else {
+                    error(                                              \
+                        fname, FNR,                                     \
+                        "multi-line parameter list should start with newline");
+                    break;
+                }
+            } else if (s ~ /[;(]( *\\)?$/) {
+                # If open paren is at end of line (with optional backslash
+                # for macros), we're fine.
+            } else if (s ~ /@.*\({/) {
+                # Ignore Java annotations.
             } else {
                 error(                                                  \
                     fname, FNR,                                         \
-                    "multi-line parameter list should start with newline");
+                    "Open parenthesis should be at end of line (function call spans several lines)");
+                break;
             }
-        } else if (s ~ /[;(]( *\\)?$/) {
-            # If open paren is at end of line (with optional backslash
-            # for macros), we're fine.
-        } else if (s ~ /@.*\({/) {
-            # Ignore Java annotations.
-        } else {
-            error(                                                      \
-                fname, FNR,                                             \
-                "Open parenthesis should be at end of line (function call spans several lines)");
         }
+        ss = substr(ss, 2); # remove initial "("
     }
 }
 s ~ /\<switch\>/ {
@@ -309,6 +320,13 @@
     else if (lenient && fname ~ /(fennel)/ && a[1] = ",") {} # not enabled yet
     else {
         error(fname, FNR, "operator '" a[2] "' must be followed by space");
+    }
+}
+match(s, /( )(,)/, a) {
+    # < and > are not handled here - they have special treatment below
+    if (!matchFile(fname)) {}
+    else {
+        error(fname, FNR, "operator '" a[2] "' must not be preceded by space");
     }
 }
 match(s, / (+|-|\*|\/|==|>=|<=|!=|<<|<<<|>>|&|&&|\|\||\?|:)$/, a) || \


Utils: ignore stderr when invoking `rev`

--- include/Utils.awk
+++ include/Utils.awk
@@ -20,9 +20,9 @@
 # Fallback to Unix `rev` if not found.
 function initBiDi() {
     FriBidi = detectProgram("fribidi", "--version", 1)
-    BiDiNoPad = FriBidi ? "fribidi --nopad" : "rev"
+    BiDiNoPad = FriBidi ? "fribidi --nopad" : "rev" SUPERR
     BiDi = FriBidi ? "fribidi --width %s" :
-        "rev | sed \"s/'/\\\\\\'/\" | xargs printf '%%s '"
+        "rev" SUPERR "| sed \"s/'/\\\\\\'/\" | xargs printf '%%s '"
 }

 # Detect external readline wrapper (rlwrap).


Commons: add join() and da()

Commons: add join() and da()

--- lib/Commons.awk
+++ lib/Commons.awk
@@ -29,3 +29,44 @@
         if (string ~ "^" patterns[i]) return patterns[i]
     return ""
 }
+
+# Join an array into one string;
+# Return the string.
+function join(array, separator, sortedIn,
+              ####
+              i, j, saveSortedIn, temp) {
+    # Default parameters
+    if (!separator)
+        separator = " "
+    if (!sortedIn)
+        sortedIn = "@ind_num_asc"
+
+    temp = ""
+    j = 0
+    saveSortedIn = PROCINFO["sorted_in"]
+    PROCINFO["sorted_in"] = sortedIn
+    for (i in array)
+        temp = j++ ? temp separator array[i] : array[i]
+    PROCINFO["sorted_in"] = saveSortedIn
+
+    return temp
+}
+
+# Debug an array.
+function da(array, formatString, sortedIn,
+                ####
+                i, j, saveSortedIn) {
+    # Default parameters
+    if (!formatString)
+        formatString = "_[%s]='%s'"
+    if (!sortedIn)
+        sortedIn = "@ind_num_asc"
+
+    saveSortedIn = PROCINFO["sorted_in"]
+    PROCINFO["sorted_in"] = sortedIn
+    for (i in array) {
+        split(i, j, SUBSEP)
+        d(sprintf(formatString, join(j, ","), array[i]))
+    }
+    PROCINFO["sorted_in"] = saveSortedIn
+}


Now 2014.

Now 2014.

git-svn-id: 293778eaa97c8c94097d610b1bd5133a8f478f36@34005 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 = 2013
+  current_year = 2014
   end_year = 0
   incontract = 0
   test_year = ""


Account for change in episode files

Account for change in episode files

--- getAcornFrom-episodePages.awk
+++ getAcornFrom-episodePages.awk
@@ -40,7 +40,7 @@
 }

 # When we get to the bottom of the episode
-/^ Served from:/ {
+/<div class="container footer"/ {
     printf ("%s\n", episodeDescription) >> EPISODE_DESCRIPTION_FILE
     #
     # Grab the URL from the EPISODE_CURL_FILE - you can't dig it out from here


Commons: add literal()

Commons: add literal()

--- lib/Commons.awk
+++ lib/Commons.awk
@@ -1,4 +1,29 @@
 #!/usr/bin/gawk -f
+
+# Convert a literal-formatted string into its original string.
+function literal(string,
+                 ####
+                 c, escaping, i, s) {
+    if (string !~ /^".*"$/)
+        return string
+
+    split(string, s, "")
+    string = ""
+    escaping = 0
+    for (i = 2; i < length(s); i++) {
+        c = s[i]
+        if (escaping) {
+            string = string c
+            escaping = 0 # escape ends
+        } else {
+            if (c == "\\")
+                escaping = 1 # escape begins
+            else
+                string = string c
+        }
+    }
+    return string
+}

 # Append an element into an array (zero-based).
 function append(array, element) {


Commons: add NULLSTR

Commons: add NULLSTR

--- include/Commons.awk
+++ include/Commons.awk
@@ -13,6 +13,8 @@
     SUPOUT = " > /dev/null "  # suppress output
     SUPERR = " 2> /dev/null " # suppress error
     PIPE = " | "
+
+    NULLSTR = ""
 }

 # Initialize `UrlEncoding`.


Replace iterator with a diff.

Replace iterator with a diff.

--- creation/web_base/parse_starterlog.awk
+++ creation/web_base/parse_starterlog.awk
@@ -151,16 +151,16 @@
   #since it is rounded, the sum could exceed tj
   tcnt=0;
   tgnz=updiv(goodjobsNZ,parallelism);tcnt=tcnt+tgnz;
-  while (tcnt>tj) {tgnz=tgnz-1; tcnt=tcnt-1;}
+  if (tcnt>tj) {tgnz=tgnz-(tcnt-tj); tcnt=tj;}
   tbjs=updiv(badjobsSignal,parallelism);tcnt=tcnt+tbjs;
-  while (tcnt>tj) {tbjs=tbjs-1; tcnt=tcnt-1;}
+  if (tcnt>tj) {tbjs=tbjs-(tcnt-tj); tcnt=tj;}
   tbjo=updiv(badjobsOther,parallelism);tcnt=tcnt+tbjo;
-  while (tcnt>tj) {tbjo=tbjo-1; tcnt=tcnt-1;}
+  if (tcnt>tj) {tbjo=tbjo-(tcnt-tj); tcnt=tj;}

   # if needed, penalize the "good jobs" the most
   # we mostly want to monitor failures
   tgz=updiv(goodjobsZ,parallelism); tcnt=tcnt+tgz;
-  while (tcnt>tj) {tgz=tgz-1; tcnt=tcnt-1;}
+  if (tcnt>tj) {tgz=tgz-(tcnt-tj); tcnt=tj;}
   # please notice that the percentages will still be accurate

   print "=================";


Fix executing movingavg filter using mawk

The mawk interpreter does not support lshift().

--- tools/playfilter.movingavg.awk
+++ tools/playfilter.movingavg.awk
@@ -85,7 +85,7 @@
 	}

 	# use 20 fix-point fraction bits to calculate the buffer sum
-	SUM_TO   = lshift(1, 20)
+	SUM_TO   = 1048576
 	SUM_FROM = 1. / SUM_TO
 }


fix comment that mislabeled field numbers

--- getBBoxCatalogFrom-sitemap.awk
+++ getBBoxCatalogFrom-sitemap.awk
@@ -6,7 +6,7 @@
 # Field numbers
 #     1 Sortkey       2 Title           3 Seasons          4 Episodes      5 Duration     6 Year
 #     7 Rating        8 Description     9 Content Type    10 Content ID   11 Entity ID   12 Genre
-#    13 Show Type    14 Date Type      15 Original Date   16 Show ID      16 Season ID   13 Sn #   14 Ep #
+#    13 Show Type    14 Date Type      15 Original Date   16 Show ID      17 Season ID   18 Sn #   19 Ep #

 BEGIN {
     # Print header


Remove if statement.

Remove if statement.

Unnecessary if statement.

--- awk.awk
+++ awk.awk
@@ -1 +1 @@
-BEGIN { if ( NF == 0 ) print "Hello, world!" }
+BEGIN { print "Hello, world!" }


ahrf.awk: Reduce URL length, in case it's >60

--- ahrf.awk
+++ ahrf.awk
@@ -72,7 +72,11 @@
 			# RSTART can be replaced by 1, because we removed useless tabs/spaces
 			num = substr($u,RSTART,RLENGTH)
 			url = substr($u,RSTART+RLENGTH+1)
-			printf("\t
%s %s
\n", num, url, url)
+			if (length(url) >= 60) {
+				printf("\t
%s %.60s...
\n", num, url, url)
+			} else {
+				printf("\t
%s %s
\n", num, url, url)
+			}
 		}
 	}
 	printf("
\n")


use `0-9` instead of [:digit:] to match digit char

--- scripts/split_version.awk
+++ scripts/split_version.awk
@@ -3,8 +3,8 @@
     if (arr[2] == "") {
 	while ((getline line < ARGV[2]) > 0) {
 	    if (line ~ arr[1]) {
-		if (line ~ /\[-[[:digit:].]*\]/) {
-		    match(line, /[[:digit:].]+/);
+		if (line ~ /\[-[0-9.]+\]/) {
+		    match(line, /[0-9.]+/);
 		    print arr[1], substr(line, RSTART, RLENGTH);
 		}
 	    }


sysconfig -> rc.conf Submitted by:	Igor Vinokurov <igor@cs.ibank.ru>

--- usr.sbin/ndc/ndcedit.awk
+++ usr.sbin/ndc/ndcedit.awk
@@ -1,4 +1,4 @@
-# $Id$
+# $Id: ndcedit.awk,v 1.4 1997/02/22 16:08:19 peter Exp $
 NR == 3 {
 	print "#"
 	print "# This file is generated automatically, do not edit it here!"
@@ -7,15 +7,15 @@
 	print ""

 	print "# If there is a global system configuration file, suck it in."
-	print "if [ -f /etc/sysconfig ]; then"
-	print "\t. /etc/sysconfig"
+	print "if [ -f /etc/rc.conf ]; then"
+	print "\t. /etc/rc.conf"
 	print "fi\n"
 }
 {
 	if ($1 == "named") {
-		printf "\t\t# $namedflags is imported from /etc/sysconfig\n"
-		printf "\t\tif [ \"X${namedflags}\" != \"XNO\" ]; then\n"
-		printf "\t\t\tnamed ${namedflags} && {\n"
+		printf "\t\t# $namedflags is imported from /etc/rc.conf\n"
+		printf "\t\tif [ \"X${named_flags}\" != X\"NO\" ]; then\n"
+		printf "\t\t\tnamed ${named_flags} && {\n"
 		getline
 		printf "\t%s\n", $0
 		getline


Fix .rc processing issue on FreeBSD

Fix .rc processing issue on FreeBSD

This change fixes issue that occurs on FreeBSD when compiling the
.rc files into the gettext format. For some reason, the shell
expression evaluation returns the resulting resource id as a string
datatype. That leads to a failure when trying to format the result
as a hex number using sprintf.
The change ensures that if that happens, the type is changed to numeric.

--- src/dlls/mscorrc/processrc.awk
+++ src/dlls/mscorrc/processrc.awk
@@ -45,6 +45,8 @@
         cmd = "echo $(("expression"))";
         cmd | getline var;
         close(cmd);
+        # in case shell returned the result as a string, ensure the var has numeric type
+        var = var + 0;
         # sprintf can only handle signed ints, so we need to convert
         # values >= 0x80000000 to negative values
         if (var >= 2147483648)


Print info on changed titles

Print info on changed titles

--- getBBoxCatalogFrom-sitemap.awk
+++ getBBoxCatalogFrom-sitemap.awk
@@ -1,8 +1,16 @@
 # Broduce a raw data spreadsheet of fields in BritBox Catalog --  apple_catalogue_feed.xml
+
+# INVOCATION
+#   awk -v ERROR_FILE=$ERROR_FILE -f getBBoxCatalogFrom-sitemap.awk $SITEMAP_FILE >$CATALOG_SPREADSHEET
+
+# Field numbers
+#     1 Sortkey       2 Title           3 Seasons          4 Episodes      5 Duration     6 Year
+#     7 Rating        8 Description     9 Content Type    10 Content ID   11 Entity ID   12 Genre
+#    13 Show Type    14 Date Type      15 Original Date   16 Show ID      16 Season ID   13 Sn #   14 Ep #

 BEGIN {
     # Print header
-    printf ("Sortkey\tTitle\tSeasons\tEpisodes\tDuration\tYear(s)\tRating\tDescription\t")
+    printf ("Sortkey\tTitle\tSeasons\tEpisodes\tDuration\tYear\tRating\tDescription\t")
     printf ("Content Type\tContent ID\tEntity ID\tGenre\tShow Type\tDate Type\tOriginal Date\t")
     printf ("Show ID\tSeason ID\tSn #\tEp #\n")
 }
@@ -53,7 +61,7 @@
     episodeNumber = ""
     description = ""
     # Generated fields
-    years = ""
+    year = ""
     # New fields that haven't been created yet
     numSeasons = 111
     numEpisodes = 222
@@ -116,10 +124,10 @@
     dateType = fld[2]
     sub (/original/,"",dateType)
     originalDate = fld[3]
-    years = substr (originalDate,1,4)
+    year = substr (originalDate,1,4)
     # print "dateType = " dateType
     # print "originalDate = " originalDate
-    # print "years = " years
+    # print "year = " year
 }

 # Grab showContentId
@@ -172,19 +180,29 @@
     }

     if (title == "Porridge") {
-        if (EntityId == "_9509")
+        if (EntityId == "_9509") {
+            revisedTitles += 1
+            printf ("==> Changed title '%s' to 'Porridge (1974-1977)'\n", title) >> ERROR_FILE
             title = "Porridge (1974-1977)"
-        else if (EntityId == "_14747")
+        } else if (EntityId == "_14747") {
+            revisedTitles += 1
+            printf ("==> Changed title '%s' to 'Porridge (2016-2017)'\n", title) >> ERROR_FILE
             title = "Porridge (2016-2017)"
+        }
         # print "==> title = " title
         # print "==> EntityId = " EntityId
     }

     if (title == "A Midsummer Night's Dream") {
-        if (EntityId == "_26179")
+        if (EntityId == "_26179") {
+            revisedTitles += 1
+            printf ("==> Changed title '%s' to 'A Midsummer Night\'s Dream (1981)'\n", title) >> ERROR_FILE
             title = "A Midsummer Night's Dream (1981)"
-        else if (EntityId == "_15999")
+        } else if (EntityId == "_15999") {
+            revisedTitles += 1
+            printf ("==> Changed title '%s' to 'A Midsummer Night\'s Dream (2016)'\n", title) >> ERROR_FILE
             title = "A Midsummer Night's Dream (2016)"
+        }
         # print "==> title = " title
         # print "==> EntityId = " EntityId
     }
@@ -218,7 +236,7 @@
     # printf ("Show ID\tSeason ID\tSn #\tEp #\n")

     printf ("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", \
-            sortkey, title, numSeasons, numEpisodes, duration, years, rating, description, \
+            sortkey, title, numSeasons, numEpisodes, duration, year, rating, description, \
             contentType, contentId, EntityId, genre, showType, dateType, originalDate, \
             showContentId, seasonContentId, seasonNumber, episodeNumber)
 }
@@ -228,3 +246,11 @@
 /<item contentType="movie"/,/<\/item>/ {
     # print
 }
+
+END {
+    printf ("In getBBoxCatalogFrom-sitemap.awk\n") > "/dev/stderr"
+    if (revisedTitles > 0 ) {
+        revisedTitles == 1 ? field = "title" : field = "titles"
+        printf ("    %2d %s revised in %s\n", revisedTitles, field, FILENAME) > "/dev/stderr"
+    }
+}


mmake/mwg_pp: fix

mmake/mwg_pp: fix

--- mmake/mwg_pp.awk
+++ mmake/mwg_pp.awk
@@ -1593,7 +1593,7 @@
       for (_i = 0; _i < m_dependency_count; _i++) {
         _file = m_dependency[_i];
         gsub(/[[:space:]]/, "\\\\&", _file);
-        printf("%s:\n\n", _file);
+        printf("%s:\n\n", _file) > output;
       }
     }
   }


Look specifically for schemes in xcodebuild -list

Targets may not have identical names, and we should prefer schemes.


Fixed formatting.

Fixed formatting.

--- scripts/misc/one-vs-rest.awk
+++ scripts/misc/one-vs-rest.awk
@@ -1,17 +1,17 @@
 BEGIN{ FS="\t"; OFS="\t"; }
 {
- 	possible_labels=$1;
- 	rowid=$2;
-    label=$3;
+	possible_labels=$1;
+	rowid=$2;
+	label=$3;
     features=$4;

- 	label_count = split(possible_labels, label_array, ",");
-
+	label_count = split(possible_labels, label_array, ",");
+
 	for(i = 1; i <= label_count; i++) {
-    	if (label_array[i] == label)
-      		print rowid, label, 1, features;
-      	else
-      		print rowid, label_array[i], -1, features;
+		if (label_array[i] == label)
+			print rowid, label, 1, features;
+		else
+			print rowid, label_array[i], -1, features;
 	}
 }
 END{}