Translate: fix play(), close #73

Translate: fix play(), close #73

--- include/Translate.awk
+++ include/Translate.awk
@@ -92,7 +92,7 @@

 # Play using Google Text-to-Speech engine.
 function play(text, tl,    url) {
-    url = HttpProtocol HttpHost "/translate_tts?ie=UTF-8"       \
+    url = HttpProtocol HttpHost "/translate_tts?ie=UTF-8&client=t"	\
         "&tl=" tl "&q=" preprocess(text)

     # Don't use getline from pipe here - the same pipe will be run only once for each AWK script!


Translate: -i should just fail if input file not found

--- include/Translate.awk
+++ include/Translate.awk
@@ -563,16 +563,22 @@
     if (Option["interactive"])
         prompt()

-    i = 0
-    while (getline line < Option["input"]) {
-        # Non-interactive verbose mode: separator between sources
-        if (!Option["interactive"])
-            if (Option["verbose"] && i++ > 0)
-                p(prettify("source-seperator", replicate(Option["chr-source-seperator"], Option["width"])))
-
-        if (Option["interactive"])
-            repl(line)
-        else
-            translate(line)
-    }
-}
+    if (Option["input"] == STDIN || fileExists(Option["input"])) {
+        i = 0
+        while (getline line < Option["input"])
+            if (line) {
+                # Non-interactive verbose mode: separator between sources
+                if (!Option["interactive"])
+                    if (Option["verbose"] && i++ > 0)
+                        p(prettify("source-seperator",
+                                   replicate(Option["chr-source-seperator"],
+                                             Option["width"])))
+
+                if (Option["interactive"])
+                    repl(line)
+                else
+                    translate(line)
+            }
+    } else
+        e("[ERROR] File not found: " Option["input"])
+}


Translate: send Cookie in getResponse()

Translate: send Cookie in getResponse()

--- include/Translate.awk
+++ include/Translate.awk
@@ -84,7 +84,7 @@
     return text
 }

-# Send an HTTP request and get response from an online translator.
+# Send an HTTP GET request and get response from an online translator.
 function getResponse(text, sl, tl, hl,    content, header, isBody, url) {
     url = _RequestUrl(text, sl, tl, hl)

@@ -93,6 +93,8 @@
         "Connection: close\n"
     if (Option["user-agent"])
         header = header "User-Agent: " Option["user-agent"] "\n"
+    if (Cookie)
+        header = header "Cookie: " Cookie "\n"

     content = NULLSTR; isBody = 0
     print header |& HttpService


Help: fix indentation

Help: fix indentation

--- include/Help.awk
+++ include/Help.awk
@@ -210,51 +210,51 @@
     return "Usage:\t" Command " [options] [source]:[target] [" ansi("underline", "text") "] ..." RS \
         "\t" Command " [options] [source]:[target1]+[target2]+... [" ansi("underline", "text") "] ..." RS RS \
         "Options:" RS                                                   \
-        I ansi("bold", "-V, -version") RS                               \
-        I I "Print version and exit." RS                                \
-        I ansi("bold", "-H, -h, -help") RS                              \
-        I I "Print this help message and exit." RS                      \
-        I ansi("bold", "-M, -m, -manual") RS                            \
-        I I "Show the manual." RS                                       \
-        I ansi("bold", "-r, -reference") RS                             \
-        I I "Print a list of languages (displayed in endonyms) and their ISO 639 codes for reference, and exit." RS \
-        I ansi("bold", "-R, -reference-english") RS                     \
-        I I "Print a list of languages (displayed in English names) and their ISO 639 codes for reference, and exit." RS \
-        I ansi("bold", "-v, -verbose") RS                               \
-        I I "Verbose mode. (default)" RS                                \
-        I ansi("bold", "-b, -brief") RS                                 \
-        I I "Brief mode." RS                                            \
-        I ansi("bold", "-no-ansi") RS                                   \
-        I I "Don't use ANSI escape codes in the translation." RS        \
-        I ansi("bold", "-w [num], -width [num]") RS                     \
-        I I "Specify the screen width for padding when displaying right-to-left languages." RS \
-        I ansi("bold", "-browser [program]") RS                         \
-        I I "Specify the web browser to use." RS                        \
-        I ansi("bold", "-p, -play") RS                                  \
-        I I "Listen to the translation." RS                             \
-        I ansi("bold", "-player [program]") RS                          \
-        I I "Specify the command-line audio player to use, and listen to the translation." RS \
-        I ansi("bold", "-x [proxy], -proxy [proxy]") RS                 \
-        I I "Use proxy on given port." RS                               \
-        I ansi("bold", "-I, -interactive") RS                           \
-        I I "Start an interactive shell, invoking `rlwrap` whenever possible (unless `-no-rlwrap` is specified)." RS \
-        I ansi("bold", "-no-rlwrap") RS                                 \
-        I I "Don't invoke `rlwrap` when starting an interactive shell with `-I`." RS \
-        I ansi("bold", "-E, -emacs") RS                                 \
-        I I "Start an interactive shell within GNU Emacs, invoking `emacs`." RS \
-        I ansi("bold", "-prompt [prompt_string]") RS                    \
-        I I "Customize your prompt string in the interactive shell." RS \
-        I ansi("bold", "-prompt-color [color_code]") RS                 \
-        I I "Customize your prompt color in the interactive shell." RS  \
-        I ansi("bold", "-i [file], -input [file]") RS                   \
-        I I "Specify the input file name." RS                           \
-        I ansi("bold", "-o [file], -output [file]") RS                  \
-        I I "Specify the output file name." RS                          \
-        I ansi("bold", "-l [code], -lang [code]") RS                    \
-        I I "Specify your own, native language (\"home/host language\")." RS \
-        I ansi("bold", "-s [code], -source [code]") RS                  \
-        I I "Specify the source language (language of the original text)." RS \
-        I ansi("bold", "-t [codes], -target [codes]") RS                \
-        I I "Specify the target language(s) (language(s) of the translated text)." RS RS \
-        "See the man page " Command "(1) for more information."
+        ansi("bold", "-V, -version") RS                                 \
+        ins(1, "Print version and exit.") RS                            \
+        ansi("bold", "-H, -h, -help") RS                                \
+        ins(1, "Print this help message and exit.") RS                  \
+        ansi("bold", "-M, -m, -manual") RS                              \
+        ins(1, "Show the manual.") RS                                   \
+        ansi("bold", "-r, -reference") RS                               \
+        ins(1, "Print a list of languages (displayed in endonyms) and their ISO 639 codes for reference, and exit.") RS \
+        ansi("bold", "-R, -reference-english") RS                       \
+        ins(1, "Print a list of languages (displayed in English names) and their ISO 639 codes for reference, and exit.") RS \
+        ansi("bold", "-v, -verbose") RS                                 \
+        ins(1, "Verbose mode. (default)") RS                            \
+        ansi("bold", "-b, -brief") RS                                   \
+        ins(1, "Brief mode.") RS                                        \
+        ansi("bold", "-no-ansi") RS                                     \
+        ins(1, "Don't use ANSI escape codes in the translation.") RS    \
+        ansi("bold", "-w [num], -width [num]") RS                       \
+        ins(1, "Specify the screen width for padding when displaying right-to-left languages.") RS \
+        ansi("bold", "-browser [program]") RS                           \
+        ins(1, "Specify the web browser to use.") RS                    \
+        ansi("bold", "-p, -play") RS                                    \
+        ins(1, "Listen to the translation.") RS                         \
+        ansi("bold", "-player [program]") RS                            \
+        ins(1, "Specify the command-line audio player to use, and listen to the translation.") RS \
+        ansi("bold", "-x [proxy], -proxy [proxy]") RS                   \
+        ins(1, "Use proxy on given port.") RS                           \
+        ansi("bold", "-I, -interactive") RS                             \
+        ins(1, "Start an interactive shell, invoking `rlwrap` whenever possible (unless `-no-rlwrap` is specified).") RS \
+        ansi("bold", "-no-rlwrap") RS                                   \
+        ins(1, "Don't invoke `rlwrap` when starting an interactive shell with `-I`.") RS \
+        ansi("bold", "-E, -emacs") RS                                   \
+        ins(1, "Start an interactive shell within GNU Emacs, invoking `emacs`.") RS \
+        ansi("bold", "-prompt [prompt_string]") RS                      \
+        ins(1, "Customize your prompt string in the interactive shell.") RS \
+        ansi("bold", "-prompt-color [color_code]") RS                   \
+        ins(1, "Customize your prompt color in the interactive shell.") RS \
+        ansi("bold", "-i [file], -input [file]") RS                     \
+        ins(1, "Specify the input file name.") RS                       \
+        ansi("bold", "-o [file], -output [file]") RS                    \
+        ins(1, "Specify the output file name.") RS                      \
+        ansi("bold", "-l [code], -lang [code]") RS                      \
+        ins(1, "Specify your own, native language (\"home/host language\").") RS \
+        ansi("bold", "-s [code], -source [code]") RS                    \
+        ins(1, "Specify the source language (language of the original text).") RS \
+        ansi("bold", "-t [codes], -target [codes]") RS                  \
+        ins(1, "Specify the target language(s) (language(s) of the translated text).") RS \
+        RS "See the man page " Command "(1) for more information."
 }


Main: fix a regression bug with option -play

--- include/Main.awk
+++ include/Main.awk
@@ -37,7 +37,7 @@
     Option["width"] = ENVIRON["COLUMNS"] ? ENVIRON["COLUMNS"] : 64

     Option["play"] = 0
-    Option["player"] = ENVIRON["PLAYER"] ? ENVIRON["PLAYER"] : AudioPlayer
+    Option["player"] = ENVIRON["PLAYER"]

     Option["interactive"] = 0
     Option["no-rlwrap"] = 0
@@ -129,10 +129,7 @@
         # -p, -play
         match(ARGV[pos], /^--?p(l(ay?)?)?$/)
         if (RSTART) {
-            if (Option["player"] || SpeechSynthesizer)
-                Option["play"] = 1
-            else
-                w("[WARNING] No available audio player or speech synthesizer is found.")
+            Option["play"] = 1
             continue
         }

@@ -302,8 +299,17 @@

     if (Option["play"]) {
         # Initialize audio player or speech synthesizer
-        initAudioPlayer()
-        if (!AudioPlayer) initSpeechSynthesizer()
+        if (!Option["player"]) {
+            initAudioPlayer()
+            Option["player"] = AudioPlayer ? AudioPlayer : Option["player"]
+            if (!Option["player"])
+                initSpeechSynthesizer()
+        }
+
+        if (!Option["player"] && !SpeechSynthesizer) {
+            w("[WARNING] No available audio player or speech synthesizer is found.")
+            Option["play"] = 0
+        }
     }

     if (pos < ARGC) {


Support also different version of Hadoop (=Fedora).

--- files/accounting/quota.awk
+++ files/accounting/quota.awk
@@ -19,8 +19,13 @@
 	print "INSERT INTO measure (name) VALUES ('quota');";
 }

-{
+/^[0-9]+[ 	]+[0-9]+[ 	]+\/.*/ {
 	used=$1
 	user=$4
 	print "INSERT INTO quota (id_measure, user, used) VALUES (last_insert_id(), " dbstr(user) ", " dbi(used) ");"
 }
+/^[0-9]+[ 	]+\/.*/ {
+	used=$1
+	user=$3
+	print "INSERT INTO quota (id_measure, user, used) VALUES (last_insert_id(), " dbstr(user) ", " dbi(used) ");"
+}


Languages: update Tigrinya (Google support)

--- include/Languages.awk
+++ include/Languages.awk
@@ -1590,6 +1590,19 @@
     Locale["th"]["glotto"]             = "thai1261"
     Locale["th"]["script"]             = "Thai"

+    # Tigrinya
+    Locale["ti"]["name"]               = "Tigrinya"
+    Locale["ti"]["endonym"]            = "ትግርኛ"
+    #Locale["ti"]["translations-of"]
+    #Locale["ti"]["definitions-of"]
+    #Locale["ti"]["synonyms"]
+    #Locale["ti"]["examples"]
+    #Locale["ti"]["see-also"]
+    Locale["ti"]["family"]             = "Afro-Asiatic"
+    Locale["ti"]["iso"]                = "tir"
+    Locale["ti"]["glotto"]             = "tigr1271"
+    Locale["ti"]["script"]             = "Ethi"
+
     #96 Turkish
     Locale["tr"]["name"]               = "Turkish"
     Locale["tr"]["endonym"]            = "Türkçe"
@@ -2006,20 +2019,6 @@
     Locale["rm"]["iso"]                = "roh"
     Locale["rm"]["glotto"]             = "roma1326"
     Locale["rm"]["script"]             = "Latn"
-
-    #? Tigrinya
-    Locale["ti"]["support"]            = "unstable"
-    Locale["ti"]["name"]               = "Tigrinya"
-    Locale["ti"]["endonym"]            = "ትግርኛ"
-    #Locale["ti"]["translations-of"]
-    #Locale["ti"]["definitions-of"]
-    #Locale["ti"]["synonyms"]
-    #Locale["ti"]["examples"]
-    #Locale["ti"]["see-also"]
-    Locale["ti"]["family"]             = "Afro-Asiatic"
-    Locale["ti"]["iso"]                = "tir"
-    Locale["ti"]["glotto"]             = "tigr1271"
-    Locale["ti"]["script"]             = "Ethi"

     #? Tibetan (Standard Tibetan)
     Locale["bo"]["support"]            = "unstable"


pushing

pushing

--- auk/sdtree.auk
+++ auk/sdtree.auk
@@ -16,16 +16,14 @@
       if (c < max)
         kept(r,c, Data[r][c], Data[r][k], ranges)
   use = best(ranges,sorted)
-  #for(r=length(sorted); r>=1; r--)
   for(r=length(sorted); r>=1; r--)
     if (sorted[r].column == use)
-      if (length( sorted[r].rows ) > length(Data)^0.5)
         kids(use, sorted[r],max,k,pre)
 }
 function kids(use,range,max,k,pre,    txt) {
-   txt =  report(range.rows) pre Name[use] " = " range.value
-   print(txt)
-   tree(range.rows,max,k,"|__ " pre)
+   if (length( range.rows ) > length(Data)^0.5) {
+     print  report(range.rows) pre Name[use] " = " range.value
+     tree(range.rows,max,k,"|__ " pre)  }
 }
 function range(i,c,x) {
   num(i)
@@ -45,7 +43,6 @@
   n = musort(ranges,sorted)
   return sorted[n].column
 }
-
 function report(rows,   w,n,r,txt) {
   for(w in W) {
     num(n)


[as] Create bytes with the size of the instruction

It is impossible to know the number of bytes that we have to copy, so the bytes
array must be always as big as the instruction size.

--- as/target/gen.awk
+++ as/target/gen.awk
@@ -56,7 +56,8 @@
 			       opsize[i], opformat[i]

 			if (opbytes[i] != "")
-				printf "\t\t.bytes = (unsigned char []) {%s},\n",
+				printf "\t\t.bytes = (unsigned char [%d]) {%s},\n",
+				        opsize[i],
 				        opbytes[i]

 			a = str2args(opargs[i])


TranslatorInterface: add abstract method _PostRequestContentType()

--- include/TranslatorInterface.awk
+++ include/TranslatorInterface.awk
@@ -17,6 +17,12 @@
 # Abstract method foobarPostRequestUrl(text, sl, tl, hl, type: string): string
 function _PostRequestUrl(text, sl, tl, hl, type,    vm) {
     vm = engineMethod("PostRequestUrl")
+    return @vm(text, sl, tl, hl, type)
+}
+
+# Abstract method foobarPostRequestContentType(text, sl, tl, hl, type: string): string
+function _PostRequestContentType(text, sl, tl, hl, type,    vm) {
+    vm = engineMethod("PostRequestContentType")
     return @vm(text, sl, tl, hl, type)
 }


display bequeath indicator and date separator and format code


Help: add option -no-autocorrect

Help: add option -no-autocorrect

--- include/Help.awk
+++ include/Help.awk
@@ -105,6 +105,8 @@
         ins(2, "Do not use any other theme than default.") RS           \
         ins(1, ansi("bold", "-no-ansi")) RS                             \
         ins(2, "Do not use ANSI escape codes.") RS                      \
+        ins(1, ansi("bold", "-no-autocorrect")) RS                      \
+        ins(2, "Do not autocorrect. (if defaulted by the translation engine)") RS \
         ins(1, ansi("bold", "-no-bidi")) RS                             \
         ins(2, "Do not convert bidirectional texts.") RS                \
         RS "Audio options:" RS                                          \


Help: cleanup

Help: cleanup

--- include/Help.awk
+++ include/Help.awk
@@ -181,7 +181,7 @@
 #     displayName = "endonym" or "name"
 function getReference(displayName,
                       ####
-                      code, col, cols, i, j, name, rows, r, saveSortedIn, t, tt) {
+                      code, col, cols, i, j, name, r, rows, saveSortedIn, t, tt) {
     rows = int(length(Locale) / 3) + 1
     cols[0][0] = cols[1][0] = cols[2][0] = NULLSTR
     i = 0


Remove temporary Jamaica Inn fix

Remove temporary Jamaica Inn fix

--- getAcornFrom-seriesPages.awk
+++ getAcornFrom-seriesPages.awk
@@ -172,15 +172,6 @@
 # Extract the episode duration
 /<meta itemprop="timeRequired"/ {
     split ($0,fld,"\"")
-    # broken times in Jamaica Inn (may be temporary)
-    if (episodeURL ~ /\/jamaicainn\// && fld[4] == "T-1M57S") {
-        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 ("==> Corrected duration: %s  %s\n", episodeURL, fld[4]) >> ERROR_FILE
-        fld[4] = "T25M54S"
-    }
     split (fld[4],tm,/[TMS]/)
     secs = tm[3]
     mins = tm[2] + int(secs / 60)
@@ -295,15 +286,6 @@
             seasonNumber = URLseasonNumber
         }
     }
-    # Jamaica Inn has wrong episode numbers as of 180918 (may be temporary)
-    if (episodeURL ~ /jamaicainn\/episode-[1-9]/) {
-        split (episodeURL, episode, "-")
-        if (episodeNumber != episode[2]) {
-            printf ("==> Corrected mismatch: %s was episode %d\n", \
-               episodeURL, episodeNumber) >> ERROR_FILE
-            episodeNumber = episode[2]
-        }
-    }

     if ((episodeNumber + 0) == 0)
         print "==> Episode number is 00: " episodeURL >> ERROR_FILE


nix/deps/gradle: include Gradle targets with numbers in names

This fixes an issue first detected in:
https://github.com/status-im/status-react/pull/12141

Which resulted in dependencies being ignored for `react-native-nagivation`.

Signed-off-by: Jakub Sokołowski <1d3764b91b902f6b45836e2498da81fe35caf6d6@status.im>

--- nix/deps/gradle/gradle_parser.awk
+++ nix/deps/gradle/gradle_parser.awk
@@ -17,7 +17,7 @@
 # Gradle outputs dependencies in groups defined by configurations.
 # Those configurations are words followed by a dash and a description.
 # There's also a special 'classpath' configuration we want.
-/^(classpath|[a-zA-Z]+)( - .*)?$/ {
+/^(classpath|[a-zA-Z0-9]+)( - .*)?$/ {
     # Ignore configurations starting with 'test'
     if (tolower($1) ~ /^test/) {
         next


LanguageData: empty string should not be an alias (fix #436)

--- include/LanguageData.awk
+++ include/LanguageData.awk
@@ -2274,13 +2274,15 @@
 function initLocaleAlias(    i) {
     for (i in Locale) {
         # ISO 639-3 codes as aliases
-        LocaleAlias[Locale[i]["iso"]] = i
-
+        if ("iso" in Locale[i])
+            LocaleAlias[Locale[i]["iso"]] = i
         # Names and endonyms as aliases
-        LocaleAlias[tolower(Locale[i]["name"])] = i
+        if ("name" in Locale[i])
+            LocaleAlias[tolower(Locale[i]["name"])] = i
         if ("name2" in Locale[i])
             LocaleAlias[tolower(Locale[i]["name2"])] = i
-        LocaleAlias[tolower(Locale[i]["endonym"])] = i
+        if ("endonym" in Locale[i])
+            LocaleAlias[tolower(Locale[i]["endonym"])] = i
         if ("endonym2" in Locale[i])
             LocaleAlias[tolower(Locale[i]["endonym2"])] = i
     }


Languages: add Kinyarwanda language

Languages: add Kinyarwanda language

--- include/Languages.awk
+++ include/Languages.awk
@@ -143,6 +143,19 @@
     Locale["ie"]["iso"]                = "ile"
     Locale["ie"]["glotto"]             = "occi1241"
     Locale["ie"]["script"]             = "Latn"
+
+    #? Kinyarwanda
+    Locale["rw"]["name"]               = "Kinyarwanda"
+    Locale["rw"]["endonym"]            = "Ikinyarwanda"
+    #Locale["rw"]["translations-of"]
+    #Locale["rw"]["definitions-of"]
+    #Locale["rw"]["synonyms"]
+    #Locale["rw"]["examples"]
+    #Locale["rw"]["see-also"]
+    Locale["rw"]["family"]             = "Atlantic-Congo"
+    Locale["rw"]["iso"]                = "kin"
+    Locale["rw"]["glotto"]             = "kiny1244"
+    Locale["rw"]["script"]             = "Latn"

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


removing debug print

removing debug print

--- lib/resplit.awk
+++ lib/resplit.awk
@@ -15,7 +15,6 @@
   currentIndex = 0
   items[0] = ""
   for(i = 1; i <= NF; i++) {
-    print $i > "/dev/stderr"
     if($i == "\\") {
       if(escaped) {
         items[currentIndex] = items[currentIndex] $i


script

script


open_c/version.awk: fixed whitespace

open_c/version.awk: fixed whitespace

darcs-hash:20081127232830-db55f-f7f8f25ba5a9a5f7ab12fe9f3d6f92e98edfd502.gz

--- open_c/version.awk
+++ open_c/version.awk
@@ -1,7 +1,7 @@
 #! /bin/gawk
 #
 # This script extracts the version information from configure.ac
-# and re-generates win32/config.h and
+# and re-generates win32/config.h and
 # libsofia-sip-ua/features/sofia_sip_features.h
 #
 # --------------------------------------------------------------------
@@ -38,7 +38,7 @@

 IN && /^AC_INIT/ { version=$2; gsub(/[\]\[)]/, "", version); }

-OUT && /@[A-Z_]+@/ {
+OUT && /@[A-Z_]+@/ {
   gsub(/@PACKAGE_VERSION@/, version);
   gsub(/@PACKAGE_BUGREPORT@/, "sofia-sip-devel@lists.sourceforge.net");
   gsub(/@PACKAGE_NAME@/, "sofia-sip");


interpretation misspell

interpretation misspell

--- bin/util/header2params2.awk
+++ bin/util/header2params2.awk
@@ -144,7 +144,7 @@
    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   conversion:interpretation conversion:null; \n",comment_out);
                                     printf("      %s];                            \n",               comment_out);
    if(length(dataEnd)) {
                                     printf("      conversion:enhance [        \n");


tests/getdents: handle older getdents calls

If the tools we use call older getdents syscalls where d_type isn't
passed back, or the arch is old (like Alpha) and can't pass back in
either version, make sure we don't fail.

* tests/getdents.awk (d_type_dir, d_type_reg): Accept DT_UNKNOWN.

--- tests/getdents.awk
+++ tests/getdents.awk
@@ -11,8 +11,9 @@
   d_name_1 = "d_name=\"\\.\""
   d_name_2 = "d_name=\"\\.\\.\""
   d_name_3 = "d_name=\"(A\\\\n){127}Z\""
-  d_type_dir = "d_type=DT_DIR"
-  d_type_reg = "d_type=DT_REG"
+  # Some older systems might not pass back d_type at all like Alpha.
+  d_type_dir = "d_type=DT_(DIR|UNKNOWN)"
+  d_type_reg = "d_type=DT_(REG|UNKNOWN)"

   dirent_1   = "\\{" d_ino ", " d_off ", " d_reclen ", " d_name_1 ", " d_type_dir "\\}"
   dirent_2   = "\\{" d_ino ", " d_off ", " d_reclen ", " d_name_2 ", " d_type_dir "\\}"


Total fix.

Total fix.

--- TeamOne/do.awk
+++ TeamOne/do.awk
@@ -21,9 +21,14 @@
 }

 END {
+    lines=0;
+    rasa=0;
     for (var in File) {
+        lines+=Lines[var];
+        rasa+=Rask[var];
         print File[var], ": lines ", Lines[var], ", RaSa ", Rask[var];
     }
+    print "Total: lines ", lines, ", Rasa ", rasa;
 }

 {


Main: -sp => -speak

Main: -sp => -speak

--- include/Main.awk
+++ include/Main.awk
@@ -367,7 +367,7 @@
         }

         # -speak
-        match(ARGV[pos], /^--?speak$/)
+        match(ARGV[pos], /^--?sp(e(ak?)?)?$/)
         if (RSTART) {
             Option["play"] = 2
             continue


Use `.perim` rather than recreating node outlines, and draw edges to their centre points for `fsmedge()` to clip.

--- share/bin/plain2mp.awk
+++ share/bin/plain2mp.awk
@@ -51,14 +51,12 @@

 	# TODO: better explain this
 	# TODO: explain reversed for q, else we'd find p again, where head == tail
-	print "	path sn; sn := fullcircle scaled head.diam shifted head;" # outline
-	print "	path st; st := fullcircle scaled tail.diam shifted tail;" # outline
-	print "	pair p; p = e intersectionpoint sn;\n";
-	print "	pair q; q = (reverse e) intersectionpoint st;\n";
+	print "	pair p; p = e           intersectionpoint head.perim;\n";
+	print "	pair q; q = (reverse e) intersectionpoint tail.perim;\n";

 	print "	if head = tail:"
 	print "		head.loops := head.loops + 1;"
-	print "		fsmloop(head)(p, q, lab);"
+	print "		fsmloop(head)(q, p, lab);"
 	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
@@ -67,7 +65,6 @@
 	print "		r := arclength b / arclength e;";
 	print "		if (r > 1.02) or (r < 0.93):";
 	print "			b := e;"
-					# TODO: maybe best to have tail .. e .. head
 	print "		fi;"
 	print "		t0 := -1;"
 	print "		if lab <> \"\":"
@@ -149,7 +146,12 @@
 	# last two points (control, knot) are ontop of each other, in the head node
 	# coordinates are in inches

-	printf "\te :=\n";
+	# We connect graphviz's path to endpoints at each node's centre, to ensure
+	# a path between nodes does intersect with each node. This is just to be on
+	# the safe side; the graphviz endpoints ought to be inside the node anyway
+	# due to -Etailclip=false and -Eheadclip=false.
+
+	printf "\te := %s .. \n", tail;
 	for (i = 1; i <= n - 1; i += 3) {
 		# knot
 		ox = a[(i + 0) * 2 + 3];
@@ -171,7 +173,7 @@
 		# knot
 		ox = a[(n + 0) * 2 + 3];
 		oy = a[(n + 0) * 2 + 4];
-		printf "\t(%fin, %fin);\n", ox, oy;
+		printf "\t(%fin, %fin) .. %s;\n", ox, oy, head;
 	}

 	# XXX: assuming no space in label


Add SDT DTrace probes for VFS vnode operations in the vfs:vop
provider namespace.  These are inserted dynamically into the
VOP_..._AP() functions created from vnode_if.src.  Each VOP has
entry and return probes, as arg0 the primary vnode, arg1 the
vnode operation argument structure pointer, providing access to
IN and OUT arguments, and for return probes, arg2 the return
value.

MFC after:	1 month
Sponsored by:	Google, Inc.

--- sys/tools/vnode_if.awk
+++ sys/tools/vnode_if.awk
@@ -165,11 +165,17 @@

 if (cfile) {
 	printc(common_head \
+	    "#include \"opt_kdtrace.h\"\n" \
+	    "\n" \
 	    "#include <sys/param.h>\n" \
 	    "#include <sys/event.h>\n" \
+	    "#include <sys/kernel.h>\n" \
 	    "#include <sys/mount.h>\n" \
+	    "#include <sys/sdt.h>\n" \
 	    "#include <sys/systm.h>\n" \
 	    "#include <sys/vnode.h>\n" \
+	    "\n" \
+	    "SDT_PROVIDER_DECLARE(vfs);\n" \
 	    "\n" \
 	    "struct vnodeop_desc vop_default_desc = {\n" \
 	    "	\"default\",\n" \
@@ -348,6 +354,10 @@
 		printc("\tVDESC_NO_OFFSET");
 		printc("};");

+		printc("\n");
+		printc("SDT_PROBE_DEFINE2(vfs, vop, " name ", entry, \"struct vnode *\", \"struct " name "_args *\");\n");
+		printc("SDT_PROBE_DEFINE3(vfs, vop, " name ", return, \"struct vnode *\", \"struct " name "_args *\", \"int\");\n");
+
 		# Print out function.
 		printc("\nint\n" uname "_AP(struct " name "_args *a)");
 		printc("{");
@@ -364,6 +374,7 @@
 		printc("\t    vop->"name" == NULL && vop->vop_bypass == NULL)")
 		printc("\t\tvop = vop->vop_default;")
 		printc("\tVNASSERT(vop != NULL, a->a_" args[0]", (\"No "name"(%p, %p)\", a->a_" args[0]", a));")
+		printc("\tSDT_PROBE(vfs, vop, " name ", entry, a->a_" args[0] ", a, 0, 0, 0);\n");
 		for (i = 0; i < numargs; ++i)
 			add_debug_code(name, args[i], "Entry", "\t");
 		add_pre(name);
@@ -372,6 +383,7 @@
 		printc("\telse")
 		printc("\t\trc = vop->vop_bypass(&a->a_gen);")
 		printc(ctrstr);
+		printc("\tSDT_PROBE(vfs, vop, " name ", return, a->a_" args[0] ", a, rc, 0, 0);\n");
 		printc("\tif (rc == 0) {");
 		for (i = 0; i < numargs; ++i)
 			add_debug_code(name, args[i], "OK", "\t\t");


inject a precisionbook keymap under us|machdep

--- arch/hppa/gsc/makemap.awk
+++ arch/hppa/gsc/makemap.awk
@@ -1,5 +1,5 @@
 #! /usr/bin/awk -f
-#	$OpenBSD: makemap.awk,v 1.1 2003/02/16 01:42:49 miod Exp $
+#	$OpenBSD: makemap.awk,v 1.2 2003/05/27 15:31:52 mickey Exp $
 #
 # Copyright (c) 2003, Miodrag Vallat.
 # All rights reserved.
@@ -210,10 +210,50 @@
 /};/ {
 	if (mapnum == 0) {
 		# Add 241 to the US map...
-		printf("    KC(241),\tKS_Delete,\n")
+		print "    KC(241),\tKS_Delete"
+		print $0
+		print "\nstatic const keysym_t pckbd_keydesc_precisionbook[] = {"
+		print "/*  pos      command\t\tnormal		shifted */"
+		print "    KC(7),   KS_Cmd_Screen0,\tKS_f1,"
+		print "    KC(15),  KS_Cmd_Screen1,\tKS_f2,"
+		print "    KC(23),  KS_Cmd_Screen2,\tKS_f3,"
+		print "    KC(31),  KS_Cmd_Screen3,\tKS_f4,"
+		print "    KC(39),  KS_Cmd_Screen4,\tKS_f5,"
+		print "    KC(47),  KS_Cmd_Screen5,\tKS_f6,"
+		print "    KC(55),  KS_Cmd_Screen6,\tKS_f7,"
+		print "    KC(63),  KS_Cmd_Screen7,\tKS_f8,"
+		print "    KC(71),  KS_Cmd_Screen8,\tKS_f9,"
+		print "    KC(79),  KS_Cmd_Screen9,\tKS_f10,"
+		print "    KC(86),  KS_Cmd_Screen10,\tKS_f11,"
+		print "    KC(94),  KS_Cmd_Screen11,\tKS_f12,"
+		print "    KC(8),   KS_Cmd_Debugger,\tKS_Escape,"
+		print "    KC(87),\t\t\tKS_Print_Screen,"
+		print "    KC(92),\t\t\tKS_backslash,\tKS_bar,"
+		print "    KC(96),\t\t\tKS_KP_Down,\tKS_KP_2,"
+		print "    KC(95),\t\t\tKS_Hold_Screen,"
+		print "    KC(97),\t\t\tKS_KP_Left,\tKS_KP_4,"
+		print "    KC(98),\t\t\tKS_Pause, /* Break */"
+		print "    KC(99),\t\t\tKS_KP_Up,\tKS_KP_8,"
+		print "    KC(100),\t\t\tKS_KP_Delete,\tKS_KP_Decimal,"
+		print "    KC(101),\t\t\tKS_KP_End,\tKS_KP_1,"
+		print "    KC(103),\t\t\tKS_KP_Insert,\tKS_KP_0,"
+		print "    KC(106),\t\t\tKS_KP_Right,\tKS_KP_6,"
+		print "    KC(109),\t\t\tKS_KP_Next,\tKS_KP_3,"
+		print "    KC(110),\t\t\tKS_KP_Home,\tKS_KP_7,"
+		print "    KC(111),\t\t\tKS_KP_Prior,\tKS_KP_9,"
+		print "    KC(20),\t\t\tKS_Caps_Lock,"
+		print "    KC(17),  KS_Cmd1,\t\tKS_Control_L,"
+		print "    KC(88),  KS_Cmd1,\t\tKS_Control_R,"
+		print "    KC(25),  KS_Cmd2,\t\tKS_Alt_L,"
+		print "    KC(57),  KS_Cmd2,\t\tKS_Alt_R,\tKS_Multi_key,"
+		print "    KC(139),\t\t\tKS_Meta_L,"
+		print "    KC(140),\t\t\tKS_Meta_R,"
 	}
 	mapnum++
 }
+/{0, 0, 0, 0}/ {
+	printf("\tKBD_MAP(KB_US | KB_MACHDEP,\tKB_US,\tpckbd_keydesc_precisionbook),\n");
+}
 {
 	print $0
 }


version 0.8.20

version 0.8.20

--- metainfo.awk
+++ metainfo.awk
@@ -1,7 +1,7 @@
 BEGIN {
     Name        = "Translate Shell"
     Description = "Google Translate to serve as a command-line tool"
-    Version     = "0.8.19"
+    Version     = "0.8.20"
     Command     = "trans"
     EntryPoint  = "translate.awk"
 }


Cleaned up Amazon URLs

Cleaned up Amazon URLs

--- generateLinkFrom-text.awk
+++ generateLinkFrom-text.awk
@@ -14,6 +14,10 @@
 #
 # Paste them in the same order they are in the Netflix "viewing activity" page

+# https://www.amazon.com/gp/video/detail/B07XZ8G9WJ/ref=stream_prime_hd_ep?autoplay=1&t=0
+/ref=stream_prime/ {
+    sub (/\/ref=stream.*/,"")
+}
 /^https:/ {
     link = $0
     if ((getline title) > 0) {


[bin] Add comment to parse-git-blame.awk to mention doesn't work with OSX awk

--- bin/parse-git-blame.awk
+++ bin/parse-git-blame.awk
@@ -1,4 +1,10 @@
 #!/usr/bin/env awk -f
+# Parses `git blame -p` to produce a Github-like blame view, where consecutive lines affected
+# by the same commit are collapsed.
+#
+# Doesn't work with OSX awk if there are accents and other interesting UTF-8 characters.
+# Recommend using GNU awk.
+
 BEGIN {
   # ensure lines is an array
   lines[0] = "test";


Fix valgrind script

Fix valgrind script

The script was not correctly handling the number in the form 3,120. The
',' was breaking the counter.

--- build/CheckValgrind.awk
+++ build/CheckValgrind.awk
@@ -5,18 +5,22 @@
 }

 $0 ~ /==.*==.*definitely lost: .* bytes in .* blocks/ {
+	sub(",", "", $4)
 	leak += $4
 }

 $0 ~ /==.*==.*indirectly lost: .* bytes in .* blocks/ {
+	sub(",", "", $4)
 	leak += $4
 }

 $0 ~ /==.*==.*possibly lost: .* bytes in .* blocks/ {
+	sub(",", "", $4)
 	leak += $4
 }

 $0 ~ /==.*==.*still reachable: .* bytes in .* blocks/ {
+	sub(",", "", $4)
 	reachable += $4
 }


addr_utils.awk	-- deal with "delta" ranges, ie ranges where the 2d value is just new suffix of the 1st: 945-51 -> 945-951

--- lib/addr_utils.awk
+++ lib/addr_utils.awk
@@ -236,7 +236,7 @@
 		return c_nwords[1] == r_nwords[1] ? 2 : 1
 	}
 }
-function AU_get_rtab(street, rtab,   n_rtab, i, nw, work) {
+function AU_get_rtab(street, rtab,   n_rtab, i, nw, work, l_pfx, e_work2) {

 	n_rtab = split(street, rtab, ";")
 	for(i = 1; i <= n_rtab; i++){
@@ -244,6 +244,22 @@
 		if(nw > 1){
 			rtab[i, 1] = work[1] + 0	# force number
 			rtab[i, 2] = work[2] + 0	# force number
+
+			if(rtab[i,1] > rtab[i,2]){
+				# Is this a "delta" range where the 2d value shows only the different address suffix?
+				# If so try to fix it
+				# For example 945-51 would be expanded to 945-951 which is good, but
+				# 945-37 would be expanded to 945-937 which is still wrong.
+				l_pfx = length(work[1]) - length(work[2])
+				e_work2 = ((l_pfx > 0) ? ((substr(work[1], 1, l_pfx) work[2])) : work[2]) + 0
+				# did we fix it?
+				if(rtab[i, 1] > e_work2){
+					printf("ERROR: bad range 1st precedes 2nd: %d-%d\n", rtab[i, 1], rtab[i, 2]) > "/dev/stderr"
+					return 0
+				}else
+					rtab[i, 2] = e_work2
+			}
+
 			rtab[i, "rng"] = 1
 			if(rtab[i, 1] % 2 != rtab[i, 2] % 2){
 				printf("ERROR: bad range: odd/even %d-%d\n", rtab[i, 1], rtab[i, 2]) > "/dev/stderr"


Commons: add yn(string)

Commons: add yn(string)

--- include/Commons.awk
+++ include/Commons.awk
@@ -212,6 +212,12 @@
     return temp
 }

+# Return 0 if the string starts with '0', 'f' or 'n';
+# Otherwise, return 1.
+function yn(string) {
+    return (tolower(string) ~ /^[0fn]/) ? 0 : 1
+}
+
 # Initialize ANSI escape codes (ANSI X3.64 Standard Control Sequences).
 # See: <https://en.wikipedia.org/wiki/ANSI_escape_code>
 function initAnsiCode() {


Strip spaces and comments more agressively.

--- sys/boot/ficl/softwords/softcore.awk
+++ sys/boot/ficl/softwords/softcore.awk
@@ -1,6 +1,15 @@
 #!/usr/bin/awk -f
+#
 # Convert forth source files to a giant C string
+#
 # Joe Abley <jabley@patho.gen.nz>, 12 January 1999
+#
+# 02-oct-1999:  Cleaned up awk slightly; added some additional logic
+#               suggested by dcs to compress the stored forth program.
+#
+# Note! This script uses strftime() which is a gawk-ism, and the
+# POSIX [[:space:]] character class.
+#
 # $FreeBSD$

 BEGIN \
@@ -26,9 +35,9 @@

 # some general early substitutions
 {
-  gsub("\t", "    ");			# replace each tab with 4 spaces
-  gsub("\"", "\\\"");			# escape quotes
-  gsub("\\\\[[:space:]]+$", "");	# toss empty comments
+  gsub(/\t/, "    ");			# replace each tab with 4 spaces
+  gsub(/\"/, "\\\"");			# escape quotes
+  gsub(/\\[[:space:]]+$/, "");		# toss empty comments
 }

 # strip out empty lines
@@ -38,18 +47,18 @@
 }

 # emit / ** lines as multi-line C comments
-/^\\[[:space:]]\*\*/ && (commenting == 0) \
+/^\\[[:space:]]\*\*/ \
 {
-  sub("^\\\\[[:space:]]", "");
-  printf "/*\n%s\n", $0;
+  sub(/^\\[[:space:]]/, "");
+  if (commenting == 0) printf "/*\n";
+  printf "%s\n", $0;
   commenting = 1;
   next;
 }

-/^\\[[:space:]]\*\*/ \
+# strip blank lines
+/^[[:space:]]*$/ \
 {
-  sub("^\\\\[[:space:]]", "");
-  printf "%s\n", $0;
   next;
 }

@@ -64,13 +73,44 @@
 /^\\[[:space:]]#/ \
 {
   if (commenting) end_comments();
-  sub("^\\\\[[:space:]]", "");
+  sub(/^\\[[:space:]]/, "");
   printf "%s\n", $0;
   next;
 }

-# toss all other full-line comments
+# toss all other full-line \ comments
 /^\\/ \
+{
+  if (commenting) end_comments();
+  next;
+}
+
+# lop off trailing \ comments
+/\\[[:space:]]+/ \
+{
+  sub(/\\[[:space:]]+.*$/, "");
+}
+
+# expunge ( ) comments
+/[[:space:]]+\([[:space:]][^)]*\)/ \
+{
+  sub(/[[:space:]]+\([[:space:]][^)]*\)/, "");
+}
+
+# remove leading spaces
+/^[[:space:]]+/ \
+{
+  sub(/^[[:space:]]+/, "");
+}
+
+# removing trailing spaces
+/[[:space:]]+$/ \
+{
+  sub(/[[:space:]]+$/, "");
+}
+
+# strip out empty lines again (preceding rules may have generated some)
+/^[[:space:]]*$/ \
 {
   if (commenting) end_comments();
   next;
@@ -80,9 +120,7 @@
 {
   if (commenting) end_comments();

-  sub("\\\\[[:space:]]+.*$", "");	# lop off trailing \ comments
-  sub("[[:space:]]+$", "");		# remove trailing spaces
-  printf "    \"%s \\n\"\n", $0;
+  printf "    \"%s \"\n", $0;
   next;
 }


vector extraction script updated

vector extraction script updated

--- scripts/get_vectors.awk
+++ scripts/get_vectors.awk
@@ -18,17 +18,22 @@
 	    printf("Incorrect line format: %s", $0) > "/sys/stderr"
 	    exit 2
 	}
+        $1 = lower($1)
+        if ($1 in WORD2SEEK)
+          continue
+
 	WORD2SEEK[$1] = ""
+        ++w_cnt
     }
     ARGV[1] = ARGV[2] = ""
     # obtain random line numbers to fetch
     srand()
-    wcl = WCL - 1
+    wcl = WCL > 1? WCL - 1: 0
     for (i = 1; i < WCL; ++i) {
 	randarr[i] = rand() * wcl + 1
     }
     asorti(randarr, tmparr)
-    wcl = WCL / 1000
+    wcl = WCL / 500
     for (i = 1; i < wcl; ++i) {
 	FNR2SEEK[tmparr[i]] = ""
     }


Add identifier KEY so we can see where we are in -v script

--- generateIMDbScriptsFrom-titles.awk
+++ generateIMDbScriptsFrom-titles.awk
@@ -4,11 +4,21 @@
         sub (/^"/,"\"The ", title)
         sub (/, The"$/,"\"", title)
     }
-    printf ("echo ==\\> %3d: %s\n",NR,title) >> TITLES_SCRIPT
+
+    if (FILENAME ~ /Acorn/)
+        KEY = "A"
+    if (FILENAME ~ /BBox/)
+        KEY = "B"
+    if (FILENAME ~ /MHz/)
+        KEY = "M"
+    if (FILENAME ~ /Watched/)
+        KEY = "W"
+
+    printf ("echo ==\\> %sT %3d: %s\n", KEY, NR, title) >> TITLES_SCRIPT
     printf ("./getIMDbInfoFrom-titles.py %s\n",title) >> TITLES_SCRIPT
     printf ("echo \n\n") >> TITLES_SCRIPT

-    printf ("echo ==\\> %3d: %s\n",NR,title) >> ID_SCRIPT
+    printf ("echo ==\\> %sI %3d: %s\n", KEY, NR, title) >> ID_SCRIPT
     printf ("./getIMDb_IDsFrom-titles.py %s | head -7\n",title) >> ID_SCRIPT
     printf ("echo \n\n") >> ID_SCRIPT
 }


update comment

update comment

--- scripts/distill_dot.awk
+++ scripts/distill_dot.awk
@@ -9,7 +9,7 @@

 BEGIN {hi = -2^PREC; lo = 2^PREC; THRESHOLD = 10}

-# there is an unfortunate case where the term label contains parens e.g.
+# there was an unfortunate case where the term label contains parens e.g.
 # ZFIN -> LITERAL [label=<dc:title ! title (dce) (30783)>];
 # AspGD -> GO [label=<RO:0002331 ! involved in (-12)>, color="pink"];


remove no longer needed exceptions and a spellcheck pass

--- scripts/ntriple2dot.awk
+++ scripts/ntriple2dot.awk
@@ -3,21 +3,21 @@
 #  Reduce the subject and object of RDF triples (ntriples format)
 #  down to their curie prefix (or literal object)
 #  Reduce predicates to the specific term identifier
-#  and the ontology namespace they are from. (curi prefix )
+#  and the ontology namespace they are from. (curie prefix )
 #  Express the subject and object as nodes with a directed edge
 #  labeled with the predicate in the graphviz dot format
 #  Include a tally of each combination of nodes and edge

 #  This may over generalize in some cases because I do not have
-#  a handy way to differentiate uri for subjects and objects
+#  a handy way to differentiate URI for subjects and objects
 #  which may belong to a "structural" ontology (t-box) as opposed to
-#  a data uri (a-box).
+#  a data URI (a-box).

 #  Post processing to augment predicate identifiers
 #  with their labels seems to improve usefulness.

 function usage(){
-    print "usage: ntriple2dot.awk prefix_baseurl.yaml rdf.nt > dot.gv"
+    print "usage: ntriple2dot.awk prefix_baseurl.yaml RDF.nt > dot.gv"
 }

 ##########################################################
@@ -68,7 +68,7 @@
     return str
 }

-# Replace IRI with CuriePrefix when possible
+# Replace URI with CuriePrefix when possible
 # Otherwise whinge and return a gv printable version of the original
 function contract(uri,  u){
     u = tokenize(uri)
@@ -83,7 +83,7 @@
     #    # exit(1)  # while testing
     # }

-    # shorten till longest uri in curi map is found (or not)
+    # shorten till longest uri in curie map is found (or not)
     while(!(u in prefix) && index(u, SUBSEP)>0)
         u = detail(u)

@@ -121,8 +121,6 @@
 BEGIN{
     # exceptions
     prefix["BNODE"]="BNODE"  # is a fixed point
-    prefix[tokenize("https://monarchinitiative.org/.well-known/genid")]="BNODE"
-    prefix[tokenize("https://archive.monarchinitiative.org/")]="MonarchArchive"
     ############################################################
     # not expected to be added to curie map
     # in HPOA
@@ -135,7 +133,7 @@
     # https://raw.githubusercontent.com/monarch-initiative/dipper/master/dipper/curie_map.yaml

     # in mgi/impc
-    prefix[tokenize("https://www.mousephenotype.org/")]="IMPC"
+    prefix[tokenize("https://www.mousephenotype.org/")]="IMPC"  # TOO GENERAL
     # in IMPC (not httpS  --- hmm all three IRI exist)
     # note in curie_map IMPC is:
     # http://www.mousephenotype.org/data/genes/
@@ -145,36 +143,28 @@
     # note in curie_map WormBase is
     # 'https://www.wormbase.org/get?name='

-    # various, transient?
-    prefix[tokenize("http://www.ncbi.nlm.nih.gov/gene/")]="NCBIGene"
-    prefix[tokenize("http://www.ncbi.nlm.nih.gov/genome/")]="NCBIGenome"
-    prefix[tokenize("http://www.ncbi.nlm.nih.gov/assembly?term=")]="NCBIAssembly"
-    # kegg
-    prefix[tokenize("http://www.genome.jp/kegg/pathway/map/")]="KEGG-img"
-    # in EOM
-    prefix[tokenize("https://elementsofmorphology.nih.gov/images/terms/")]="EOM_IMG"
-    # prefix[tokenize("http://elementsofmorphology.nih.gov/index.cgi?tid=")]="EOM"  # w/o httpS
+    # various, transient? (fewer now https or not is transparent)
+

     # playing with the idea of a LOCAL identifier
     # not the same as a bnode in that tools won't rewrite identifier
     # and their IRI are unroutable, i.e in same machine (or local net)
     # this is motivated in part by not wanting to publish
-    # urls to our own servers which go nowhere.
-    # prefix["https://127.0.0.1/.well-known/genid"]="BNODE"  # exists, phase out
+    # URLs to our own servers which go nowhere.
     # prefix["http://0.0.0.0/.well-known/genid"]="BNODE"     # prefer
     # prefix["http://0.0.0.0/"]="LCL"                              # ID halfway house

     # LCL's obvious down side is zero options for global collisions
-    # best you can do is go the uuid which is ugly, or
-    # belive your obscure but readable string _is_ a special snowflake
+    # best you can do is go the UUID which is ugly, or
+    # believe your obscure but readable string _is_ a special snowflake
 }

 # main loop
 # parse and stash the curie yaml file (first file)
-# YAML format is tic delimited word (the curi prefix)
-# a colon, whitespace
-# then a tic delimited url
-# convert the base url to a path in a multi-dimensional array
+# YAML format is tic delimited word (the curie prefix)
+# a colon, white space
+# then a tic delimited URL
+# convert the base URL to a path in a multi-dimensional array
 # (FNR == NR) && /^'[fht]\+tp[^']*'.*/ { # loosing some?
 (FNR == NR) && /^'.*/ {
     split($0, arr, "'")
@@ -267,8 +257,8 @@
     print "}"

     ######################################################
-    # dump a summary of significant numbers of unresolved-curi uri  to stderr
-    # FNR gives at least half the number ot URI attempted to resolve for %s
+    # dump a summary of significant numbers of unresolved-curie uri  to stderr
+    # FNR gives at least half the number of URI attempted to resolve for %s
     # FILENAME gives filename we know where they were generated
     # have warn[uri] = count
     toofew = 3


Languages: mark as stable: Pashto

Languages: mark as stable: Pashto

--- include/Languages.awk
+++ include/Languages.awk
@@ -247,15 +247,14 @@
     Locale["or"]["glotto"]             = "macr1269"
     Locale["or"]["script"]             = "Orya"

-    #? Pashto
-    Locale["ps"]["support"]            = "unstable"
+    # Pashto
     Locale["ps"]["name"]               = "Pashto"
     Locale["ps"]["endonym"]            = "پښتو"
-    #Locale["ps"]["translations-of"]
-    #Locale["ps"]["definitions-of"]
-    #Locale["ps"]["synonyms"]
-    #Locale["ps"]["examples"]
-    #Locale["ps"]["see-also"]
+    Locale["ps"]["translations-of"]    = "د %sژباړې"
+    Locale["ps"]["definitions-of"]     = "د%s تعریفونه"
+    Locale["ps"]["synonyms"]           = "مترادف لغتونه"
+    Locale["ps"]["examples"]           = "بېلګې"
+    Locale["ps"]["see-also"]           = "دا هم ووینئ"
     Locale["ps"]["family"]             = "Indo-European"
     Locale["ps"]["iso"]                = "pus"
     Locale["ps"]["glotto"]             = "pash1269"


tests: extend getdents to support all filesystems regardless of file order

* tests/getdents.awk: Include all 6 possible permutations of 3
direntries to regexps.


Omit throw-away separators variables.

Omit throw-away separators variables.

--- src/cloudfront.awk
+++ src/cloudfront.awk
@@ -42,7 +42,7 @@

 /^#Fields: / {
     rest = substr($0, length("#Fields: ") + 1)
-    split(rest, fields, " ", seps)
+    split(rest, fields, " ")
     numFields = length(fields)
 }

@@ -51,7 +51,7 @@
 }

 ! /^#/ {
-    split($0, fieldsThisLine, " ", sepsThrowAway)
+    split($0, fieldsThisLine, " ")
     if (NF == numFields) {
         print "\t{"
         for(i = 1; i < NF; i++)


Use the term "deprecated" instead of "old name" in order to be more explicit. (dm)

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

--- Programs/brldefs.awk
+++ Programs/brldefs.awk
@@ -20,12 +20,12 @@
   brlCommandValue = 0
   brlKeyValue = 0

-  brlBlockAlias["CLIP_NEW"] = "CUTBEGIN"
-  brlBlockAlias["CLIP_ADD"] = "CUTAPPEND"
-  brlBlockAlias["COPY_LINE"] = "CUTLINE"
-  brlBlockAlias["COPY_RECT"] = "CUTRECT"
-  brlBlockAlias["CLIP_COPY"] = "COPYCHARS"
-  brlBlockAlias["CLIP_APPEND"] = "APNDCHARS"
+  brlBlockDeprecations["CLIP_NEW"] = "CUTBEGIN"
+  brlBlockDeprecations["CLIP_ADD"] = "CUTAPPEND"
+  brlBlockDeprecations["COPY_LINE"] = "CUTLINE"
+  brlBlockDeprecations["COPY_RECT"] = "CUTRECT"
+  brlBlockDeprecations["CLIP_COPY"] = "COPYCHARS"
+  brlBlockDeprecations["CLIP_APPEND"] = "APNDCHARS"
 }

 /^ *BRL_CMD_/ {
@@ -40,9 +40,9 @@
   help = getComment($0)
   brlBlock(name, $2, value, help)

-  if (name in brlBlockAlias) {
-    alias = brlBlockAlias[name]
-    brlBlock(alias, prefix alias, value, "alias for " name " - " help)
+  if (name in brlBlockDeprecations) {
+    alias = brlBlockDeprecations[name]
+    brlBlock(alias, prefix alias, value, "deprecated definition of " name " - " help)
   }

   next


ctx: recognize surf url here

ctx: recognize surf url here

--- src/ctx.awk
+++ src/ctx.awk
@@ -51,6 +51,8 @@
 	setCtx("app.exe", "hgtk")
 	split_file(m[1], ctx, "ctx.file")
     }
+    if(get("ctx.xprop.wm_class_name") == "Surf")
+	setCtx("app.url", get("ctx.xprop.url"))

     # working directory
     setCtx("wdir", ENVIRON["PWD"])


LanguageData: update section W

LanguageData: update section W

--- include/LanguageData.awk
+++ include/LanguageData.awk
@@ -2565,9 +2565,24 @@
     Locale["vi"]["spoken-in"]          = "Vietnam"
     Locale["vi"]["supported-by"]       = "google; bing; yandex"

-
-
-    #103 Welsh
+    # Volapük
+    Locale["vo"]["name"]               = "Volapük"
+    Locale["vo"]["endonym"]            = "Volapük"
+    #Locale["vo"]["translations-of"]
+    #Locale["vo"]["definitions-of"]
+    #Locale["vo"]["synonyms"]
+    #Locale["vo"]["examples"]
+    #Locale["vo"]["see-also"]
+    Locale["vo"]["family"]             = "Constructed language"
+    #Locale["vo"]["branch"]
+    Locale["vo"]["iso"]                = "vol"
+    Locale["vo"]["glotto"]             = "vola1234"
+    Locale["vo"]["script"]             = "Latn"
+    Locale["vo"]["spoken-in"]          = "worldwide"
+    Locale["vo"]["description"]        = "an international auxiliary language"
+    Locale["vo"]["supported-by"]       = ""
+
+    # Welsh
     Locale["cy"]["name"]               = "Welsh"
     Locale["cy"]["endonym"]            = "Cymraeg"
     Locale["cy"]["translations-of"]    = "Cyfieithiadau %s"
@@ -2576,11 +2591,14 @@
     Locale["cy"]["examples"]           = "Enghreifftiau"
     Locale["cy"]["see-also"]           = "Gweler hefyd"
     Locale["cy"]["family"]             = "Indo-European"
+    Locale["cy"]["branch"]             = "Celtic"
     Locale["cy"]["iso"]                = "cym"
     Locale["cy"]["glotto"]             = "wels1247"
     Locale["cy"]["script"]             = "Latn"
-
-    #104 West Frisian
+    Locale["cy"]["spoken-in"]          = "Wales in the UK"
+    Locale["cy"]["supported-by"]       = "google; bing; yandex"
+
+    # West Frisian
     Locale["fy"]["name"]               = "Frisian"
     Locale["fy"]["endonym"]            = "Frysk"
     Locale["fy"]["translations-of"]    = "Oersettings fan %s"
@@ -2589,9 +2607,30 @@
     Locale["fy"]["examples"]           = "Foarbylden"
     Locale["fy"]["see-also"]           = "Sjoch ek"
     Locale["fy"]["family"]             = "Indo-European"
+    Locale["fy"]["branch"]             = "West Germanic"
     Locale["fy"]["iso"]                = "fry"
     Locale["fy"]["glotto"]             = "west2354"
     Locale["fy"]["script"]             = "Latn"
+    Locale["fy"]["spoken-in"]          = "Friesland in the Netherlands"
+    Locale["fy"]["supported-by"]       = "google"
+
+    # Wolof
+    Locale["wo"]["name"]               = "Wolof"
+    Locale["wo"]["endonym"]            = "Wollof"
+    #Locale["wo"]["translations-of"]
+    #Locale["wo"]["definitions-of"]
+    #Locale["wo"]["synonyms"]
+    #Locale["wo"]["examples"]
+    #Locale["wo"]["see-also"]
+    Locale["wo"]["family"]             = "Atlantic-Congo"
+    Locale["wo"]["branch"]             = "Atlantic"
+    Locale["wo"]["iso"]                = "wol"
+    Locale["wo"]["glotto"]             = "wolo1247"
+    Locale["wo"]["script"]             = "Latn"
+    Locale["wo"]["spoken-in"]          = "Senegal; Mauritania; the Gambia"
+    Locale["wo"]["supported-by"]       = ""
+
+

     #105 Xhosa
     Locale["xh"]["name"]               = "Xhosa"
@@ -2682,34 +2721,6 @@
     Locale["oc"]["iso"]                = "oci"
     Locale["oc"]["glotto"]             = "occi1239"
     Locale["oc"]["script"]             = "Latn"
-
-    #? Volapük
-    Locale["vo"]["support"]            = "unstable"
-    Locale["vo"]["name"]               = "Volapük"
-    Locale["vo"]["endonym"]            = "Volapük"
-    #Locale["vo"]["translations-of"]
-    #Locale["vo"]["definitions-of"]
-    #Locale["vo"]["synonyms"]
-    #Locale["vo"]["examples"]
-    #Locale["vo"]["see-also"]
-    Locale["vo"]["family"]             = "Constructed language"
-    Locale["vo"]["iso"]                = "vol"
-    #Locale["vo"]["glotto"]
-    Locale["vo"]["script"]             = "Latn"
-
-    #? Wolof
-    Locale["wo"]["support"]            = "unstable"
-    Locale["wo"]["name"]               = "Wolof"
-    Locale["wo"]["endonym"]            = "Wollof"
-    #Locale["wo"]["translations-of"]
-    #Locale["wo"]["definitions-of"]
-    #Locale["wo"]["synonyms"]
-    #Locale["wo"]["examples"]
-    #Locale["wo"]["see-also"]
-    Locale["wo"]["family"]             = "Atlantic-Congo"
-    Locale["wo"]["iso"]                = "wol"
-    Locale["wo"]["glotto"]             = "wolo1247"
-    Locale["wo"]["script"]             = "Latn"

     #? Cherokee
     Locale["chr"]["support"]           = "unstable"


LanguageData: update section H

LanguageData: update section H

--- include/LanguageData.awk
+++ include/LanguageData.awk
@@ -825,9 +825,7 @@
     Locale["gu"]["spoken-in"]          = "the Indian state of Gujarat"
     Locale["gu"]["supported-by"]       = "google; bing; yandex"

-
-
-    #32 Haitian Creole
+    # Haitian Creole
     Locale["ht"]["name"]               = "Haitian Creole"
     Locale["ht"]["endonym"]            = "Kreyòl Ayisyen"
     Locale["ht"]["translations-of"]    = "Tradiksyon %s"
@@ -836,11 +834,14 @@
     Locale["ht"]["examples"]           = "Egzanp:"
     Locale["ht"]["see-also"]           = "Wè tou"
     Locale["ht"]["family"]             = "Indo-European"
+    Locale["ht"]["branch"]             = "French Creole"
     Locale["ht"]["iso"]                = "hat"
     Locale["ht"]["glotto"]             = "hait1244"
     Locale["ht"]["script"]             = "Latn"
-
-    #33 Hawaiian
+    Locale["ht"]["spoken-in"]          = "Haiti"
+    Locale["ht"]["supported-by"]       = "google; bing; yandex"
+
+    # Hawaiian
     Locale["haw"]["name"]              = "Hawaiian"
     Locale["haw"]["endonym"]           = "ʻŌlelo Hawaiʻi"
     #Locale["haw"]["translations-of"]
@@ -849,11 +850,14 @@
     #Locale["haw"]["examples"]
     #Locale["haw"]["see-also"]
     Locale["haw"]["family"]            = "Austronesian"
+    Locale["haw"]["branch"]            = "Malayo-Polynesian"
     Locale["haw"]["iso"]               = "haw"
     Locale["haw"]["glotto"]            = "hawa1245"
     Locale["haw"]["script"]            = "Latn"
-
-    #34 Hausa, Latin alphabet
+    Locale["haw"]["spoken-in"]         = "the US state of Hawaii"
+    Locale["haw"]["supported-by"]      = "google"
+
+    # Hausa, Latin alphabet
     Locale["ha"]["name"]               = "Hausa"
     Locale["ha"]["endonym"]            = "Hausa"
     Locale["ha"]["translations-of"]    = "Fassarar %s"
@@ -862,11 +866,14 @@
     Locale["ha"]["examples"]           = "Misalai"
     Locale["ha"]["see-also"]           = "Duba kuma"
     Locale["ha"]["family"]             = "Afro-Asiatic"
+    Locale["ha"]["branch"]             = "Chadic"
     Locale["ha"]["iso"]                = "hau"
     Locale["ha"]["glotto"]             = "haus1257"
     Locale["ha"]["script"]             = "Latn"
-
-    #35 Hebrew
+    Locale["ha"]["spoken-in"]          = "Chad; Nigeria; Niger; Ghana; Cameroon; Benin"
+    Locale["ha"]["supported-by"]       = "google"
+
+    # Hebrew
     Locale["he"]["name"]               = "Hebrew"
     Locale["he"]["endonym"]            = "עִבְרִית"
     Locale["he"]["translations-of"]    = "תרגומים של %s"
@@ -875,12 +882,31 @@
     Locale["he"]["examples"]           = "דוגמאות"
     Locale["he"]["see-also"]           = "ראה גם"
     Locale["he"]["family"]             = "Afro-Asiatic"
+    Locale["he"]["branch"]             = "Semitic"
     Locale["he"]["iso"]                = "heb"
     Locale["he"]["glotto"]             = "hebr1245"
     Locale["he"]["script"]             = "Hebr"
     Locale["he"]["rtl"]                = "true" # RTL language
-
-    #36 Hindi
+    Locale["he"]["spoken-in"]          = "Israel"
+    Locale["he"]["supported-by"]       = "google; bing; yandex"
+
+    # Hill Mari / Western Mari
+    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"]["branch"]            = "Mari"
+    Locale["mrj"]["iso"]               = "mrj"
+    Locale["mrj"]["glotto"]            = "west2392"
+    Locale["mrj"]["script"]            = "Cyrl"
+    Locale["mrj"]["spoken-in"]         = "the Gornomariysky, Yurinsky and Kilemarsky districts of Mari El, Russia"
+    Locale["mrj"]["supported-by"]      = "yandex"
+
+    # Hindi
     Locale["hi"]["name"]               = "Hindi"
     Locale["hi"]["endonym"]            = "हिन्दी"
     Locale["hi"]["translations-of"]    = "%s के अनुवाद"
@@ -889,11 +915,14 @@
     Locale["hi"]["examples"]           = "उदाहरण"
     Locale["hi"]["see-also"]           = "यह भी देखें"
     Locale["hi"]["family"]             = "Indo-European"
+    Locale["hi"]["branch"]             = "Indo-Aryan"
     Locale["hi"]["iso"]                = "hin"
     Locale["hi"]["glotto"]             = "hind1269"
     Locale["hi"]["script"]             = "Deva"
-
-    #37 Hmong (First Vernacular Hmong)
+    Locale["hi"]["spoken-in"]          = "India"
+    Locale["hi"]["supported-by"]       = "google; bing; yandex"
+
+    # Hmong (First Vernacular Hmong)
     Locale["hmn"]["name"]              = "Hmong"
     Locale["hmn"]["endonym"]           = "Hmoob"
     Locale["hmn"]["translations-of"]   = "Lus txhais: %s"
@@ -902,11 +931,25 @@
     #Locale["hmn"]["examples"]
     #Locale["hmn"]["see-also"]
     Locale["hmn"]["family"]            = "Hmong-Mien"
+    Locale["hmn"]["branch"]            = "Hmongic"
     Locale["hmn"]["iso"]               = "hmn"
     Locale["hmn"]["glotto"]            = "firs1234"
     Locale["hmn"]["script"]            = "Latn"
-
-    #38 Hungarian
+    Locale["hmn"]["spoken-in"]         = "China; Vietnam; Laos; Myanmar; Thailand"
+    Locale["hmn"]["supported-by"]      = "google; bing"
+
+    # Hmong Daw (White Hmong)
+    #Locale["mww"]["name"]              = "Hmong Daw"
+    #Locale["mww"]["endonym"]           = "Hmoob Daw"
+    #Locale["mww"]["family"]            = "Hmong-Mien"
+    #Locale["mww"]["branch"]            = "Hmongic"
+    #Locale["mww"]["iso"]               = "mww"
+    #Locale["mww"]["glotto"]            = "hmon1333"
+    #Locale["mww"]["script"]            = "Latn"
+    #Locale["mww"]["spoken-in"]         = "China; Vietnam; Laos; Myanmar; Thailand"
+    #Locale["mww"]["supported-by"]      = "bing"
+
+    # Hungarian
     Locale["hu"]["name"]               = "Hungarian"
     Locale["hu"]["endonym"]            = "Magyar"
     Locale["hu"]["translations-of"]    = "%s fordításai"
@@ -915,9 +958,14 @@
     Locale["hu"]["examples"]           = "Példák"
     Locale["hu"]["see-also"]           = "Lásd még"
     Locale["hu"]["family"]             = "Uralic"
+    Locale["hu"]["branch"]             = "Ugric"
     Locale["hu"]["iso"]                = "hun"
     Locale["hu"]["glotto"]             = "hung1274"
     Locale["hu"]["script"]             = "Latn"
+    Locale["hu"]["spoken-in"]          = "Hungary"
+    Locale["hu"]["supported-by"]       = "google; bing; yandex"
+
+

     #39 Icelandic
     Locale["is"]["name"]               = "Icelandic"
@@ -2084,15 +2132,6 @@
     Locale["zu"]["glotto"]             = "zulu1248"
     Locale["zu"]["script"]             = "Latn"

-    #* Hmong Daw (White Hmong)
-    Locale["mww"]["support"]           = "bing-only"
-    Locale["mww"]["name"]              = "Hmong Daw"
-    Locale["mww"]["endonym"]           = "Hmoob Daw"
-    Locale["mww"]["family"]            = "Hmong-Mien"
-    Locale["mww"]["iso"]               = "mww"
-    Locale["mww"]["glotto"]            = "hmon1333"
-    Locale["mww"]["script"]            = "Latn"
-
     #* Portuguese (European)
     Locale["pt-PT"]["support"]         = "bing-only"
     Locale["pt-PT"]["name"]            = "Portuguese (European)"
@@ -2188,20 +2227,6 @@
     Locale["mhr"]["iso"]               = "mhr"
     Locale["mhr"]["glotto"]            = "east2328"
     Locale["mhr"]["script"]            = "Cyrl"
-
-    #? 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"
@@ -2356,6 +2381,7 @@
     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["mww"] = "hmn" # mww (Hmong Daw) treated the same as hmn (the inclusive code for Hmong)
     LocaleAlias["nb"] = "no" # Google Translate does not distinguish between Bokmål and Nynorsk (but Bing does!)
     LocaleAlias["nn"] = "no"
     LocaleAlias["pt"] = "pt-BR" # Portuguese: default to Brazilian Portuguese (as in Google Translate)


Revert rev 1.7 which moved us away from POSIX character classes. The community feels our base AWK must handle them.

--- sys/boot/ficl/softwords/softcore.awk
+++ sys/boot/ficl/softwords/softcore.awk
@@ -6,6 +6,9 @@
 #
 # 02-oct-1999:  Cleaned up awk slightly; added some additional logic
 #               suggested by dcs to compress the stored forth program.
+#
+# Note! This script uses strftime() which is a gawk-ism, and the
+# POSIX [[:space:]] character class.
 #
 # $FreeBSD$

@@ -34,7 +37,7 @@
 {
   gsub(/\t/, "    ");			# replace each tab with 4 spaces
   gsub(/\"/, "\\\"");			# escape quotes
-  gsub(/\\[ 	]+$/, "");		# toss empty comments
+  gsub(/\\[[:space:]]+$/, "");		# toss empty comments
 }

 # strip out empty lines
@@ -44,9 +47,9 @@
 }

 # emit / ** lines as multi-line C comments
-/^\\[ 	]\*\*/ \
+/^\\[[:space:]]\*\*/ \
 {
-  sub(/^\\[ 	]/, "");
+  sub(/^\\[[:space:]]/, "");
   if (commenting == 0) printf "/*\n";
   printf "%s\n", $0;
   commenting = 1;
@@ -54,7 +57,7 @@
 }

 # strip blank lines
-/^[ 	]*$/ \
+/^[[:space:]]*$/ \
 {
   next;
 }
@@ -67,10 +70,10 @@
 }

 # pass commented preprocessor directives
-/^\\[ 	]#/ \
+/^\\[[:space:]]#/ \
 {
   if (commenting) end_comments();
-  sub(/^\\[ 	]/, "");
+  sub(/^\\[[:space:]]/, "");
   printf "%s\n", $0;
   next;
 }
@@ -83,31 +86,31 @@
 }

 # lop off trailing \ comments
-/\\[ 	]+/ \
+/\\[[:space:]]+/ \
 {
-  sub(/\\[ 	]+.*$/, "");
+  sub(/\\[[:space:]]+.*$/, "");
 }

 # expunge ( ) comments
-/[ 	]+\([ 	][^)]*\)/ \
+/[[:space:]]+\([[:space:]][^)]*\)/ \
 {
-  sub(/[ 	]+\([ 	][^)]*\)/, "");
+  sub(/[[:space:]]+\([[:space:]][^)]*\)/, "");
 }

 # remove leading spaces
-/^[ 	]+/ \
+/^[[:space:]]+/ \
 {
-  sub(/^[ 	]+/, "");
+  sub(/^[[:space:]]+/, "");
 }

 # removing trailing spaces
-/[ 	]+$/ \
+/[[:space:]]+$/ \
 {
-  sub(/[ 	]+$/, "");
+  sub(/[[:space:]]+$/, "");
 }

 # strip out empty lines again (preceding rules may have generated some)
-/^[ 	]*$/ \
+/^[[:space:]]*$/ \
 {
   if (commenting) end_comments();
   next;


Translators/BingTranslator: use code pt-pt for Portuguese

--- include/Translators/BingTranslator.awk
+++ include/Translators/BingTranslator.awk
@@ -200,12 +200,14 @@
     # Hot-patches for Bing's own translator language codes
     # See: <https://msdn.microsoft.com/en-us/library/hh456380.aspx>
     if (_sl == "auto")  _sl = "auto-detect"
-    if (_sl == "no")    _sl = "nb" # Bing uses Norwegian Bokmål
-    if (_sl == "bs")    _sl = "bs-Latn" # 'bs' is not recognized as valid code
+    if (_sl == "bs")    _sl = "bs-Latn"  # 'bs' is not recognized as valid code
+    if (_sl == "no")    _sl = "nb"  # Bing uses Norwegian Bokmål
+    if (_sl == "pt")    _sl = "pt-pt"  # 'pt' and 'pt-PT' are not recognized (FIXME: support pt-br)
     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 == "bs")    _tl = "bs-Latn"
+    if (_tl == "pt")    _tl = "pt-pt"
     if (_tl == "zh-CN") _tl = "zh-Hans"
     if (_tl == "zh-TW") _tl = "zh-Hant"


Fix forEach snippet

Fix forEach snippet

--- bin/snip.awk
+++ bin/snip.awk
@@ -12,7 +12,7 @@
   FIXED["javascript:fn"]       = "function"
   FIXED["javascript:function"] = "function (|) {}"
   FIXED["javascript:fori"]     = "for (let i = 0; i < |; i + = 1) {"
-  FIXED["javascript:fe"]       = "foreach"
+  FIXED["javascript:fe"]       = "forEach"
   FIXED["javascript:)"]        = ") => "
   PREFIX["javascript:json"]       = "JSON.stringify"
   PREFIX["javascript:require"]    = "require(\"|\")"


LanguageData: update section Y & Z

LanguageData: update section Y & Z

--- include/LanguageData.awk
+++ include/LanguageData.awk
@@ -2694,9 +2694,19 @@
     Locale["xh"]["spoken-in"]          = "South Africa; Zimbabwe"
     Locale["xh"]["supported-by"]       = "google; yandex"

-
-
-    #106 Yiddish
+    # Yakut / Sakha
+    Locale["sah"]["name"]              = "Yakut"
+    Locale["sah"]["name2"]             = "Sakha"
+    Locale["sah"]["endonym"]           = "Sakha"
+    Locale["sah"]["family"]            = "Turkic"
+    Locale["sah"]["branch"]            = "Siberian Turkic"
+    Locale["sah"]["iso"]               = "sah"
+    Locale["sah"]["glotto"]            = "yaku1245"
+    Locale["sah"]["script"]            = "Latn"
+    Locale["sah"]["spoken-in"]         = "the Republic of Sakha (Yakutia) in Russia"
+    Locale["sah"]["supported-by"]      = "yandex"
+
+    # Yiddish
     Locale["yi"]["name"]               = "Yiddish"
     Locale["yi"]["endonym"]            = "ייִדיש"
     Locale["yi"]["translations-of"]    = "איבערזעצונגען פון %s"
@@ -2705,12 +2715,16 @@
     Locale["yi"]["examples"]           = "ביישפילע"
     Locale["yi"]["see-also"]           = "זייען אויך"
     Locale["yi"]["family"]             = "Indo-European"
+    Locale["yi"]["branch"]             = "West Germanic"
     Locale["yi"]["iso"]                = "yid"
     Locale["yi"]["glotto"]             = "yidd1255"
     Locale["yi"]["script"]             = "Hebr"
     Locale["yi"]["rtl"]                = "true" # RTL language
-
-    #107 Yoruba
+    Locale["yi"]["spoken-in"]          = "worldwide"
+    Locale["yi"]["description"]        = "a West Germanic language historically spoken by Ashkenazi Jews"
+    Locale["yi"]["supported-by"]       = "google; yandex"
+
+    # Yoruba
     Locale["yo"]["name"]               = "Yoruba"
     Locale["yo"]["endonym"]            = "Yorùbá"
     Locale["yo"]["translations-of"]    = "Awọn itumọ ti %s"
@@ -2719,11 +2733,25 @@
     Locale["yo"]["examples"]           = "Awọn apẹrẹ"
     Locale["yo"]["see-also"]           = "Tun wo"
     Locale["yo"]["family"]             = "Atlantic-Congo"
+    #Locale["yo"]["branch"]
     Locale["yo"]["iso"]                = "yor"
     Locale["yo"]["glotto"]             = "yoru1245"
     Locale["yo"]["script"]             = "Latn"
-
-    #108 Zulu
+    Locale["yo"]["spoken-in"]          = "Nigeria; Benin"
+    Locale["yo"]["supported-by"]       = "google"
+
+    # Yucatec Maya
+    Locale["yua"]["name"]              = "Yucatec Maya"
+    Locale["yua"]["endonym"]           = "Màaya T'àan"
+    Locale["yua"]["family"]            = "Mayan"
+    #Locale["yua"]["branch"]
+    Locale["yua"]["iso"]               = "yua"
+    Locale["yua"]["glotto"]            = "yuca1254"
+    Locale["yua"]["script"]            = "Latn"
+    Locale["yua"]["spoken-in"]         = "Mexico; Belize"
+    Locale["yua"]["supported-by"]      = "bing"
+
+    # Zulu
     Locale["zu"]["name"]               = "Zulu"
     Locale["zu"]["endonym"]            = "isiZulu"
     Locale["zu"]["translations-of"]    = "Ukuhumusha i-%s"
@@ -2732,18 +2760,12 @@
     Locale["zu"]["examples"]           = "Izibonelo"
     Locale["zu"]["see-also"]           = "Bheka futhi"
     Locale["zu"]["family"]             = "Atlantic-Congo"
+    Locale["zu"]["branch"]             = "Bantu"
     Locale["zu"]["iso"]                = "zul"
     Locale["zu"]["glotto"]             = "zulu1248"
     Locale["zu"]["script"]             = "Latn"
-
-    #* Yucatec Maya
-    Locale["yua"]["support"]           = "bing-only"
-    Locale["yua"]["name"]              = "Yucatec Maya"
-    Locale["yua"]["endonym"]           = "Màaya T'àan"
-    Locale["yua"]["family"]            = "Mayan"
-    Locale["yua"]["iso"]               = "yua"
-    Locale["yua"]["glotto"]            = "yuca1254"
-    Locale["yua"]["script"]            = "Latn"
+    Locale["zu"]["spoken-in"]          = "South Africa; Lesotho; Eswatini"
+    Locale["zu"]["supported-by"]       = "google; bing; yandex"

 }


Commons: fix detectProgram()

Commons: fix detectProgram()

--- include/Commons.awk
+++ include/Commons.awk
@@ -446,7 +446,7 @@
 # Detect whether a program exists in path.
 # Return the name (or output) if the program call writes anything to stdout;
 # Otherwise, return a null string.
-function detectProgram(prog, arg, returnOutput) {
+function detectProgram(prog, arg, returnOutput,    temp) {
     if (returnOutput) {
         prog " " arg SUPERR | getline temp
         return temp


build.awk: add a recursive readSqueezed()

--- build.awk
+++ build.awk
@@ -124,6 +124,25 @@
     return 0
 }

+function readSqueezed(fileName, squeezed,    group, line, ret) {
+    if (fileName ~ /\*$/) # glob simulation
+        return readSqueezed(fileName ".awk", squeezed)
+
+    ret = NULLSTR
+    if (fileExists(fileName))
+        while (getline line < fileName) {
+            match(line, /^[[:space:]]*@include[[:space:]]*"(.*)"$/, group)
+            if (RSTART) { # @include
+                if (ret) ret = ret RS
+                ret = ret readSqueezed(group[1] ".awk", squeezed)
+            } else if (!squeezed || line = squeeze(line)) { # effective LOC
+                if (ret) ret = ret RS
+                ret = ret line
+            }
+        }
+    return ret
+}
+
 function build(target, type,    group, inline, line, temp) {
     # Default target: bash
     if (!target) target = "bash"
@@ -143,23 +162,7 @@
         print "if ! [[ $LANG =~ '[UTF|utf]-?8$' ]]; then export LANG=en_US.UTF-8; fi" > Trans

         print "read -r -d '' TRANS_PROGRAM << 'EOF'" > Trans
-        if (fileExists(EntryPoint))
-            while (getline line < EntryPoint) {
-                match(line, /^[[:space:]]*@include[[:space:]]*"(.*)"$/, group)
-                if (RSTART) {
-                    # Include file
-                    if (fileExists(group[1] ".awk"))
-                        while (getline inline < (group[1] ".awk"))
-                            if (inline = squeeze(inline))
-                                print inline > Trans # effective LOC
-                } else {
-                    if (line && line !~ /^[[:space:]]*#!/) {
-                        # Remove preceding spaces
-                        gsub(/^[[:space:]]+/, "", line)
-                        print line > Trans
-                    }
-                }
-            }
+        print readSqueezed(EntryPoint, TRUE) > Trans
         print "EOF" > Trans

         print "read -r -d '' TRANS_MANPAGE << 'EOF'" > Trans
@@ -185,24 +188,11 @@
     } else if (target == "awk" || target == "gawk") {

         "uname -s" | getline temp
-
-        if (fileExists(EntryPoint))
-            while (getline line < EntryPoint) {
-                match(line, /^[[:space:]]*@include[[:space:]]*"(.*)"$/, group)
-                if (RSTART) {
-                    # Include file
-                    if (fileExists(group[1] ".awk"))
-                        while (getline inline < (group[1] ".awk"))
-                            if (inline = squeeze(inline, 1))
-                                print inline > TransAwk
-                } else {
-                    if (temp == "Darwin" && line == "#!/usr/bin/gawk -f")
-                        # OS X: gawk not in /usr/bin, use a better shebang
-                        print "#!/usr/bin/env gawk -f" > TransAwk
-                    else
-                        print line > TransAwk
-                }
-            }
+        print (temp == "Darwin" ?
+               "#!/usr/bin/env gawk -f" : # OS X
+               "#!/usr/bin/gawk -f") > TransAwk
+
+        print readSqueezed(EntryPoint, TRUE) > TransAwk

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


2012-03-28: parsegaspriceshtml.awk: Changed for Thorntons images.

--- parsegaspriceshtml.awk
+++ parsegaspriceshtml.awk
@@ -36,6 +36,8 @@
 }

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


Translators/BingTranslator: fix original phonetics

--- include/Translators/BingTranslator.awk
+++ include/Translators/BingTranslator.awk
@@ -278,7 +278,11 @@
             split(_sl, group, "-")
             #content = postResponse(text, group[1], group[1], _hl, "transliterate")
             #oPhonetics = unparameterize(content)
-            # FIXME!
+            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"])
             if (oPhonetics == text) oPhonetics = ""
         }

@@ -330,9 +334,9 @@
                 tokenize(dicTokens, dicContent)
                 parseJson(dicAst, dicTokens)

-                l(dicContent, "content", 1, 1)
-                l(dicTokens, "tokens", 1, 0, 1)
-                l(dicAst, "ast")
+                l(dicContent, "dicContent", 1, 1)
+                l(dicTokens, "dicTokens", 1, 0, 1)
+                l(dicAst, "dicAst")

                 saveSortedIn = PROCINFO["sorted_in"]
                 PROCINFO["sorted_in"] = "compareByIndexFields"


fixed bugs in the awkscript which were not ignoring upper case lines, set the pt grabbing routine to only work on lines with more than 10 fields

--- src/pt-phi-grab.awk
+++ src/pt-phi-grab.awk
@@ -1,7 +1,7 @@
 ## run as awk -f pt-phi-grab.awk < stuff
 ## match event lines and print something
 BEGIN{count = 0;}
-/^event/{ count++;
+/^event#/{ count++;
     print( "# event", count)
 }

@@ -16,15 +16,15 @@
 function asin(x) { return atan2(x, sqrt(1-x*x)) }

 ## on lines which are particles output pt, phi and rap
-## this seems to only read about 600 lines?
-!/(^[a-z])/{
+!/(^[a-zA-Z])/{ ## forgot to screen out upper case chars (dumb)
+    if(NF > 10){ ## ok so only go on potential particle lines
         en = $5
         px = $6;
         py = $7;
         pz = $8;
         ch = $12;
         pabs = sqrt(px*px + py*py + pz*pz)
-        #printf("(%lf %lf %lf) %lf %lf\n", px, py, pz, en, pabs)
+        ##printf("(%lf %lf %lf) %lf %lf\n", px, py, pz, en, pabs)
         if(abs(pabs) > 0 && abs(pz) > 0 && abs(pabs-pz) > 0 && abs(pabs+pz)>0){
             rap = 0.5*log((pabs + pz)/(pabs - pz))
         } else {
@@ -46,5 +46,6 @@
         }

         printf("%d %lf %lf %lf\n", ch, pt, phi, rap);
+    }
 }


mpers.awk: relax union member name absence check

This fixes mpersing of unions containing nameless members,
e.g. struct btrfs_ioctl_vol_args_v2.

* mpers.awk (what_is): Print names of union_type members as is.

--- mpers.awk
+++ mpers.awk
@@ -146,7 +146,7 @@
 			if ("parent" in array[item] && \
 				array_get(item, "parent") == what_idx) {
 				returned = what_is(item)
-				printf("%s", array_get(item, "name"))
+				printf("%s", array[item]["name"])
 				if ("" != returned) {
 					printf("[%s]", returned)
 				}


increase maximum sequence length limits

increase maximum sequence length limits

--- parse_blast.awk
+++ parse_blast.awk
@@ -125,9 +125,9 @@
     if (mode=="summary") {
 	printf("%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",hit_id,SEQ_ID,SUBJ_ID,BLAST_SCORE,E_VALUE,IDENTITY_PERCENT,BLAST_FRAME,QUERY_START,QUERY_END,SUBJ_START,SUBJ_END);
     }
-    QUERY_START=9999999;
+    QUERY_START=9999999999;
     QUERY_END= -1;
-    SUBJ_START=9999999;
+    SUBJ_START=9999999999;
     SUBJ_END= -1;
 }

@@ -136,7 +136,7 @@
 /^Query=/ {
     SEQ_ID=$2;
     TITLE=substr($0,index($0,$3));
-    QUERY_START=9999999;
+    QUERY_START=9999999999;
     QUERY_END= -1;
 }

@@ -173,7 +173,7 @@
     }
     QUERY_SEQ="";
     SUBJ_SEQ="";
-    SUBJ_START=9999999;
+    SUBJ_START=9999999999;
     SUBJ_END= -1;
 }


exports syms not objects without modversions

--- scripts/modpost.awk
+++ scripts/modpost.awk
@@ -801,7 +801,7 @@
 		val = "" $1; sec = $(NF-2); offset = $(NF-1); sym = $NF
 		flags = substr($0, length(val)+2, 7)
 		if (substr(flags,1,1) == "l") {
-		    if (substr(flags,7,1) == "O") {
+		    if (substr(flags,7,1) == "O" || !values["modversions"]) {
 			if (sec == ".modinfo") {
 			    if (sym ~ /^_?__mod_version[0-9]*$/)
 				mod_vers[mod] = 1
@@ -820,7 +820,7 @@
 		    continue
 		}
 		if (substr(flags,1,1) == "g") {
-		    if (substr(flags,7,1) == "O") {
+		    if (substr(flags,7,1) == "O" || !values["modversions"]) {
 			if (sub(/^_?_?__ksymtab/,"",sec)) {
 			    sub(/\+.*/,"",sec)
 			    if (sub(/^_?__ksymtab_/,"",sym)) {


cfg80211: fix parsing when db.txt ends on a rule

If genregdb.awk assumes the file will end with an
extra empty line or a comment line. This is could
not be true so just address this.

Signed-off-by: Luis R. Rodriguez <d4fa18192c5a479e564d29c2300c2e15afd1d8d7@do-not-panic.com>
Acked-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>
Signed-off-by: Johannes Berg <bff32994ff0f8d048f262a8388145a71b6071bfe@intel.com>

--- net/wireless/genregdb.awk
+++ net/wireless/genregdb.awk
@@ -143,6 +143,8 @@
 }

 END {
+	if (active)
+		print_tail_country()
 	print regdb "};"
 	print ""
 	print "int reg_regdb_size = ARRAY_SIZE(reg_regdb);"


invisible h1 now appears

invisible h1 now appears

--- tools/hierarchy.awk
+++ tools/hierarchy.awk
@@ -6,16 +6,23 @@
     hier[heading] = $0
     sub(/<\/a>/, "", hier[heading])
     sub(/<\/a>/, "", hier[heading])
-    print hier[heading]
+    print "
"
+    if (heading > 1) {
+	print "
" hier[heading] "
"
+    }
+    for (i=1; i < heading; ++i) {
+	print "<h" i " style='color: #C0C0C0;'>" hier[i] "</h" i ">"
+    }
+    print "<h" heading ">" hier[heading]
     hunt = 0
     next
 }

 /
/ {
-    print "
"
+    #print "
"
     heading = 1
     hunt = 1
-    print
+    #print
     next
 }

@@ -27,28 +34,28 @@

 /
/ && heading == 0 {
     print "
"
-    print "
"
-    print "
" hier[1] "
"
+    #print "
"
+    #print "
" hier[1] "
"
     heading = 2
     hunt = 1
-    print
+    #print
     next
 }

 /
/ && heading == 0 {
     print "
"
-    print "
"
-    print "
" hier[1] "
"
-    print "
" hier[2] "
"
+    #print "
"
+    #print "
" hier[1] "
"
+    #print "
" hier[2] "
"
     heading = 3
     hunt = 1
-    print
+    #print
     next
 }

 /
/ && heading == 3 {
     heading = 4
     hunt = 1
-    print
+    #print
     next
 }


[as-x86] Remove debug information from gen.awk

--- as/target/x86/gen.awk
+++ as/target/x86/gen.awk
@@ -1,6 +1,5 @@

 BEGIN		{
-		print "bits=",bits > "/dev/stderr"
 		FS = "\t"
 		printf "#include \"../../../inc/scc.h\"\n"\
 		       "#include \"../../as.h\"\n"\


unix-yy.test: fix portability issue

unix-yy.test: fix portability issue

* tests/unix-yy-connect.awk (r_close_listen): Quote square brackets
that are not part of a bracket expression.


Robustify mpers.awk against input containing index loops

Make mpers.awk check for potential index loops.  Such loops should not
normally happen, but mpers.awk will not go into infinite recursion if
they do.

* mpers.awk (enter, leave): New functions.
(what_is): Use them.

--- mpers.awk
+++ mpers.awk
@@ -15,9 +15,26 @@
 	}
 	return array_return
 }
+function enter(array_idx)
+{
+	if (called[array_idx]) {
+		printf("%s: index loop detected:", FILENAME) > "/dev/stderr"
+		for (item in called)
+			printf(" %s", item) > "/dev/stderr"
+		print "" > "/dev/stderr"
+		exit 1
+	}
+	called[array_idx] = 1
+}
+function leave(array_idx, to_return)
+{
+	delete called[array_idx]
+	return to_return
+}
 function what_is(what_idx, type_idx, special, item, \
 		 location, prev_location, prev_returned_size)
 {
+	enter(what_idx)
 	special = array_get(what_idx, "special")
 	switch (special) {
 	case "base_type":
@@ -52,7 +69,7 @@
 		returned_size = to_return * returned_size
 		if ("" == to_return)
 			to_return = "00"
-		return to_return
+		return leave(what_idx, to_return)
 		break
 	case "structure_type":
 		print "struct {"
@@ -107,18 +124,18 @@
 		break
 	case "typedef":
 		type_idx = array_get(what_idx, "type")
-		return what_is(type_idx)
+		return leave(what_idx, what_is(type_idx))
 		break
 	case "member":
 		type_idx = array_get(what_idx, "type")
-		return what_is(type_idx)
+		return leave(what_idx, what_is(type_idx))
 		break
 	default:
 		type_idx = array_get(what_idx, "type")
 		what_is(type_idx)
 		break
 	}
-	return 0
+	return leave(what_idx, 0)
 }
 BEGIN {
 	print "#include <inttypes.h>"


Improved "Rearranged" message

Improved "Rearranged" message

--- getBritBoxProgramsFrom-webscraper.awk
+++ getBritBoxProgramsFrom-webscraper.awk
@@ -38,7 +38,7 @@

     # Titles starting with "The" should not sort based on "The"
     if (match (showTitle, /^The /)) {
-        print "==> Rearranging " showTitle >> ERROR_FILE
+        print "==> Rearranged: " showTitle >> ERROR_FILE
         showTitle = substr(showTitle, 5) ", The"
     }


Don't use path as variable name in colortbl.awk

Instead of using `argv[1]` to name the variable, we now always call it
`color_lib` in awk/colortbl.awk. The reason for this, is in some build
configurations, like the Visual Studio and CMake build, the full path to
the color_lib file is used. This resulted in the variable conaining
slashes, etc. Since the rest of the code already assumes this variable is
called `color_lib`, there is no problem with hard coding it in
colortbl.awk

--- awk/colortbl.awk
+++ awk/colortbl.awk
@@ -35,7 +35,7 @@
 	v = v * 255.0;
 }

-BEGIN	{ s = ARGV[1]; gsub("\\.","_",s); printf("static hsvrgbacolor_t %s[] = {\n",s); }
+BEGIN	{ gsub("\\.","_",s); printf("static hsvrgbacolor_t color_lib[] = {\n",s); }
 /^$/	{ next; }
 /^#/	{ next; }
 		{


awk: add seq and string?

awk: add seq and string?

Issue #166

--- awk/core.awk
+++ awk/core.awk
@@ -74,6 +74,14 @@
 		return "!\"Invalid argument length for builtin function 'false?'. Expects exactly 1 argument, supplied " (types_heap[idx]["len"] - 1) "."
 	}
 	return types_heap[idx][1] == "#false" ? "#true" : "#false"
+}
+
+function core_stringp(idx)
+{
+	if (types_heap[idx]["len"] != 2) {
+		return "!\"Invalid argument length for builtin function 'string?'. Expects exactly 1 argument, supplied " (types_heap[idx]["len"] - 1) "."
+	}
+	return types_heap[idx][1] ~ /^"/ ? "#true" : "#false"
 }

 function core_symbol(idx,    str)
@@ -821,6 +829,44 @@
 	return substr(lst, 1, 1) new_idx
 }

+function core_seq(idx,     obj, obj_idx, new_idx, i, len, chars)
+{
+	if (types_heap[idx]["len"] != 2) {
+		return "!\"Invalid argument length for builtin function 'seq'. Expects exactly 1 argument, supplied " (types_heap[idx]["len"] - 1) "."
+	}
+	obj = types_heap[idx][1]
+	if (obj ~ /^[(]/) {
+		if (types_heap[substr(obj, 2)]["len"] == 0) {
+			return "#nil"
+		}
+		return types_addref(obj)
+	} else if (obj ~ /^\[/) {
+		obj_idx = substr(obj, 2)
+		len = types_heap[obj_idx]["len"]
+		if (len == 0) { return "#nil" }
+		new_idx = types_allocate()
+		for (i = 0; i < len; ++i) {
+			types_addref(types_heap[new_idx][i] = types_heap[obj_idx][i])
+		}
+		types_heap[new_idx]["len"] = len
+		return "(" new_idx
+	} else if (obj ~ /^"/) {
+		obj_idx = substr(obj, 2)
+		len = length(obj_idx)
+		if (len == 0) { return "#nil" }
+		new_idx = types_allocate()
+		split(obj_idx, chars, "")
+		for (i = 0; i <= len; ++i) {
+			types_heap[new_idx][i] = "\"" chars[i+1]
+		}
+		types_heap[new_idx]["len"] = len
+		return "(" new_idx
+	} else if (obj == "#nil") {
+		return "#nil"
+	} else {
+		return "!\"seq: called on non-sequence"
+	}
+}

 function core_meta(idx,    obj, obj_idx)
@@ -977,6 +1023,7 @@
 	core_ns["'nil?"] = "&core_nilp"
 	core_ns["'true?"] = "&core_truep"
 	core_ns["'false?"] = "&core_falsep"
+	core_ns["'string?"] = "&core_stringp"
 	core_ns["'symbol"] = "&core_symbol"
 	core_ns["'symbol?"] = "&core_symbolp"
 	core_ns["'keyword"] = "&core_keyword"
@@ -1025,6 +1072,7 @@
 	core_ns["'map"] = "&core_map"

 	core_ns["'conj"] = "&core_conj"
+	core_ns["'seq"] = "&core_seq"

 	core_ns["'meta"] = "&core_meta"
 	core_ns["'with-meta"] = "&core_with_meta"


Malformed (Sm 1 Ep 1) should be (Sn 1 Ep 1)

--- getMHzFromSitemap.awk
+++ getMHzFromSitemap.awk
@@ -212,9 +212,11 @@
     # 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:]]*\)/))  {
-        sub (/[ ]*\(S[Nnm]*[ ]*[[:digit:]]{1,2}[ ]+[Ee][Pp]*[ ]*[[:digit:]]{1,3}[[:space:]]*\)/,\
-             "",episodeTitle)
-        # print "==> episodeTitle = " episodeTitle > "/dev/stderr"
+            if (episodeTitle ~ /\(Sm /)
+                printf ("==> Malformed Sn 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"
     }
     #
     # Default episodeType to "E"


Remove string from \/(in regex, / in plain text) from regex lines.

--- gfwlist2dnsmasq.awk
+++ gfwlist2dnsmasq.awk
@@ -35,9 +35,10 @@
 			extract_regex(expanded_line, original_line)
 		}
 	} else {
-		sub(/.*:\\\/\\\//, "", line)    # remove everything till :\/\/
+		sub(/.*:\\\/\\\//, "", line)    # remove everything till :\/\/ in regex, :// in plain text, such as http:// https://
 		gsub(/\([^\)]+\)\*?/, "", line) # remove (...)*? such as ([^\/]+\.)
 		gsub(/\[.*\]\+/, "", line)      # remove [...]
+		sub(/\\\/.*/, "", line)         # remove everything from \/ in regex, / in plaint text
 		gsub(/\\\./, ".", line)         # replace \. to .
 		extract(line, original_line)
 	}


Translate: unquote user-name for basic authentication (per #193)

--- include/Translate.awk
+++ include/Translate.awk
@@ -101,7 +101,7 @@
     if (HttpAuthUser && HttpAuthPass)
         # TODO: digest auth
         header = header "Proxy-Authorization: Basic "   \
-            base64(HttpAuthUser ":" HttpAuthPass) "\n"
+            base64(unquote(HttpAuthUser) ":" HttpAuthPass) "\n"

     content = NULLSTR; isBody = 0
     print header |& HttpService


update

update

--- proto_scripts/client/proto.awk
+++ proto_scripts/client/proto.awk
@@ -95,23 +95,23 @@

 		} else if (a[3] in READERS) {	## primitives

-			ret = ret "\tshort narr = reader.ReadU16();"
-			ret = ret "\tfor (int i = 0; i < narr; i++) {"
-			ret = ret "\t\tv := reader."READERS[a[3]]"();"
-			ret = ret "\t\ttbl."a[1]" = append(tbl."a[1]", v);"
-			ret = ret "\t}\n"
+			ret = ret "\tshort narr = reader.ReadU16();\n"
+			ret = ret "\t\tfor (int i = 0; i < narr; i++) {\n"
+			ret = ret "\t\t\ttbl."a[1]"[i] =reader."READERS[a[3]]"();\n"
+			#ret = ret "\t\t\ttbl."a[1]"[i] =  v;\n"
+			ret = ret "\t\t}"

 		} else {	## struct

-			ret = ret "\tshort narr = reader.ReadU16();"
-			ret = ret "\ttbl."a[1]" = new "a[3]"[narr];"
-			ret = ret "\tfor (int i = 0; i < narr; i++){"
-			ret = ret "\t\ttbl."a[1]"[i] = PKT_"a[3]"(reader);"
-			ret = ret "\t}\n"
+			ret = ret "\tshort narr = reader.ReadU16();\n"
+			ret = ret "\t\ttbl."a[1]" = new "a[3]"[narr];\n"
+			ret = ret "\t\tfor (int i = 0; i < narr; i++){\n"
+			ret = ret "\t\t\ttbl."a[1]"[i] = "a[3]".Unpack(reader);\n"
+			ret = ret "\t\t}"

 		}
 	} else if (!(a[2] in READERS)) {
-		ret = ret "\t\ttbl."a[1]"  = new "a[2]"(reader);"
+		ret = ret "\ttbl."a[1]"  = "a[2]".UnPack(reader);"
 	} else {
 		ret = ret "\ttbl."a[1]"  = reader." READERS[a[2]] "();"
 	}


tweak dump, idump

tweak dump, idump

--- library.awk
+++ library.awk
@@ -1201,9 +1201,21 @@

 ## debugging #########

-function dump(array,  prefix,   i) {
+function dump(array,  prefix,   i,j) {
     for (i in array) {
-        printf "%s[%s]=<%s>\n", prefix, i, array[i]
+        j = i
+        gsub(/\\/, "\\134", j)
+        gsub(/,/, "\\054", j)
+        gsub(/\t/, "\\t", j)
+        gsub(/\n/, "\\n", j)
+        gsub(/\r/, "\\r", j)
+        gsub(/\b/, "\\b", j)
+        gsub(/\f/, "\\f", j)
+#         gsub(/\a/, "\\a", j)
+#         gsub(/\v/, "\\v", j)
+        gsub(SUBSEP, ",", j)
+        gsub(/[\001-\037]/, "", j) # TODO: convert to octal?
+        printf "%s[%s]=<%s>\n", prefix, j, array[i]
     }
 }

@@ -1340,8 +1352,8 @@
     }
     for (m in options) {
         if (options[m] ~ /^[:+?*]/) {
-            if (k = index(options[m], SUBSEP))
-                options[m] = substr(options[m], k+1)
+            if (j = index(options[m], SUBSEP))
+                options[m] = substr(options[m], j+1)
             else
                 delete options[m]
         } else if (!(options[m]))


POSIX { and delete TODO: still not POSIX compatible due to "match()"

--- mkstructinfo.awk
+++ mkstructinfo.awk
@@ -2,7 +2,6 @@
 # vim:ts=4:sw=4
 BEGIN {
 	brace = 0;
-	delete buffer;
 	buffer_len = 0;
 }
 /^}.*;/ {
@@ -33,14 +32,16 @@
 		printf "define(`COUNTOF_%s', `%s')\n", instruct, i;
 		printf "define(`SIZEOF_%s', `(  %s  )')\n", instruct, elm;
 		print "\n";
-		delete buffer;
+		for (i in buffer) {
+			delete buffer[i];
+		}
 		buffer_len = 0;
 		instruct = 0;
 	}
 	next;
 }

-/.{/ {
+/.\{/ {
 	brace = brace + 1;
 }
 /.}/ {
@@ -75,13 +76,13 @@
 	typedefs[$3] = $4;
 	next;
 }
-/^typedef struct .*{/ {
+/^typedef struct .*\{/ {
 	brace = 1;
 	instruct = 1;
 	next;
 }

-/^struct .*{/ {
+/^struct .*\{/ {
 	instruct = $2;
 	brace = 1;
 	next;


aux/ematch.awk: add bug-compatibility with Busybox awk

The Busybox version of awk won't match backslash-escaped characters
in bracket expressions passed from variables, as awk should.

Ref.: https://bugs.busybox.net/show_bug.cgi?id=12531

To avoid breaking bug-compatibility with Solaris awk, we need a
conditional workaround, so add another test to detectclass() and
use the result if/when translating character classes to ASCII.

--- lib/modernish/aux/ematch.awk
+++ lib/modernish/aux/ematch.awk
@@ -63,6 +63,13 @@
 	# Ref.: https://github.com/onetrueawk/awk/issues/45
 	if (hasclass && match(mylocale(), /[Uu][Tt][Ff]-?8/))
 		hasclass = match("éïÑ", /^[[:alpha:]][[:alpha:]][[:alpha:]]$/);
+
+	# Detect bug with bracket expressions on Busybox awk: it doesn't match backslashed chars.
+	# Due to another bug, Solaris awk requires the backslash-escaping that Busybox awk won't
+	# match, so we need a conditional workaround when translating character classes.
+	# Ref.: https://bugs.busybox.net/show_bug.cgi?id=12531
+	if (!hasclass)
+		bug_brexpr = !match("\t", "^\\t$");
 }

 # The terms 'branch', 'piece', 'atom' and 'bound' are used as defined
@@ -134,24 +141,24 @@
 						} else if (j == ":alpha:") {
 							j = "A-Za-z";
 						} else if (j == ":blank:") {
-							j = " \\t";
+							if (bug_brexpr) j = " \t"; else j = " \\t";
 						} else if (j == ":cntrl:") {
-							j = "\\1-\\37\\177";
+							if (bug_brexpr) j = "\1-\37\177"; else j = "\\1-\\37\\177";
 						} else if (j == ":digit:") {
 							j = "0-9";
 						} else if (j == ":graph:") {
-							j = "\\41-\\176";
+							if (bug_brexpr) j = "\41-\176"; else j = "\\41-\\176";
 						} else if (j == ":lower:") {
 							j = "a-z";
 						} else if (j == ":print:") {
-							j = "\\40-\\176";
+							if (bug_brexpr) j = "\40-\176"; else j = "\\40-\\176";
 						} else if (j == ":punct:") {
 							havepunct++;
 							j = "";
 						} else if (j == ":space:") {
 							# onetrueawk does not support "\v", so use "\13".
 							# https://github.com/onetrueawk/awk/pull/44
-							j = " \\t\\r\\n\\13\\f";
+							if (bug_brexpr) j = " \t\r\n\13\f"; else j = " \\t\\r\\n\\13\\f";
 						} else if (j == ":upper:") {
 							j = "A-Z";
 						} else if (j == ":xdigit:") {


Add TOLOWER to lexicon.awk

Add TOLOWER to lexicon.awk

--- lexicon.awk
+++ lexicon.awk
@@ -4,6 +4,7 @@
 }
 {
     for (i = 1; i <= split($3, words, ", "); i++) {
+        if (TOLOWER) words[i] = tolower(words[i]);
         print words[i] | "sort --parallel=$(nproc) -S1G -us";
     }
 }


Commons: add append()

Commons: add append()

--- lib/Commons.awk
+++ lib/Commons.awk
@@ -1,4 +1,9 @@
 #!/usr/bin/gawk -f
+
+# Append an element into an array (zero-based).
+function append(array, element) {
+    array[length(array)] = element
+}

 # Return an element if it belongs to the array;
 # Otherwise, return a null string.


TestParser: test parseJson()

TestParser: test parseJson()

--- test/TestParser.awk
+++ test/TestParser.awk
@@ -71,6 +71,42 @@
         assertEqual(tokens, expected)
     }

+    T("parseJson()", 5)
+    {
+        delete tokens; delete ast; delete expected
+        tokenize(tokens, "0")
+        parseJson(ast, tokens)
+        expected[0] = "0"
+        assertEqual(ast, expected)
+
+        delete tokens; delete ast; delete expected
+        tokenize(tokens, "null")
+        parseJson(ast, tokens)
+        expected[0] = "null"
+        assertEqual(ast, expected)
+
+        delete tokens; delete ast; delete expected
+        tokenize(tokens, "[42]")
+        parseJson(ast, tokens)
+        expected[0 SUBSEP 0] = "42"
+        assertEqual(ast, expected)
+
+        delete tokens; delete ast; delete expected
+        tokenize(tokens, "[42, \"answer\", null]")
+        parseJson(ast, tokens)
+        expected[0 SUBSEP 0] = "42"
+        expected[0 SUBSEP 1] = "\"answer\""
+        expected[0 SUBSEP 2] = "null"
+        assertEqual(ast, expected)
+
+        delete tokens; delete ast; delete expected
+        tokenize(tokens, "{\"answer\": [42], \"Answer\": null}")
+        parseJson(ast, tokens)
+        expected[0 SUBSEP "answer" SUBSEP 0] = 42
+        expected[0 SUBSEP "Answer"] = "null"
+        assertEqual(ast, expected)
+    }
+
     T("parseList()", 1)
     {
         delete tokens; delete ast; delete expected


include param to reduce visual clutter when counts have no meaning

--- scripts/deltadot.awk
+++ scripts/deltadot.awk
@@ -1,12 +1,15 @@
 #! /usr/bin/awk -f
-#deltadot.awk <encumbant.gv> <candidate.gv>
+# deltadot.awk <encumbant.gv> <candidate.gv>
 # Use to illuminate the commonality and differences between dot files created
 # by 'ntriples2dot.awk' but might work for other dot files
 #
+# To ignore counts
+# deltadot.awk -v"NOCOUNTS=1" <encumbant.gv> <candidate.gv>
 #
-# expects two graphviz dot digraph files by convention "old"  then "new"
+# expects two graphviz dot digraph files;
+# by convention "old"  then "new"
 # for color to mean;  orange lost in "new" and blue gained in "new"
-# with simple node names ('C' variable naming conventions)
+# with simple node names ('C-lang' variable naming conventions)
 # edge's unadorned predicate label
 # concludes with a space then count in parens
 #
@@ -17,6 +20,11 @@
 # if an edge is common between the files
 # then change its "count" to the difference. (second minus first)
 # otherwise leave count as is
+# UNLESS there is a parameter NOCOUNTS not equal to 0
+# in which case set all counts the same
+# this is for use when the counts have no meaning
+# such as with random samples
+

 # associate the count with an edge
 function parse(str, arr){
@@ -29,6 +37,7 @@
 	split(pth, a, "/")
 	return substr(a[length(a)], 1, index(a[length(a)], ".")-1)
 }
+BEGIN { NOCOUNTS=0}

 # collect the edges
 NR==FNR && / -> / {
@@ -45,7 +54,10 @@
 		if(!(e in edge2)) edges[e "(" edge1[e] ")\", color=\"orange\"];"];
 		else {
 			# TODO flag losses?
-			diff =  edge2[e] - edge1[e];
+			if(NOCOUNTS)
+			    diff = ""
+			else
+			    diff = edge2[e] - edge1[e];
 			#if(diff < 0) diff = "<b>" diff "</b>";
 			edges[e "(" diff ")\", color=\"black\"];"]
 			delete edge2[e]


adding a newline at the end of the file, I'm getting an error otherwise

--- trunk/languagetool/tools/posi.awk
+++ trunk/languagetool/tools/posi.awk
@@ -29,4 +29,5 @@
 		     }
 				print out;
 			  bb[1] = "";
-			}+			}
+


Update dxfinfo.awk

Update dxfinfo.awk

--- english/data_processing/code/dxfinfo.awk
+++ english/data_processing/code/dxfinfo.awk
@@ -22,6 +22,6 @@
 END {	# print out result
 	for (i in dxf) {	# for each layer,entity pairs
 		split(i, w, SUBSEP);	# separate layer and entity in index into w array
-		print w[1], w[2], dxf[i];	# print layer, entity anc count
+		print w[1], w[2], dxf[i];	# print layer, entity and count
 	}
 }


Update year for gln testing.

Update year for gln testing.

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

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

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


Languages: update URLs for getDetails

Languages: update URLs for getDetails

--- include/Languages.awk
+++ include/Languages.awk
@@ -2026,10 +2026,10 @@
         sprintf("%-22s%s\n", "Writing system", ansi("bold", script))    \
         sprintf("%-22s%s\n", "Code", ansi("bold", getCode(code)))       \
         sprintf("%-22s%s\n", "ISO 639-3", ansi("bold", iso))            \
-        sprintf("%-22s%s\n", "SIL", ansi("bold", "http://www-01.sil.org/iso639-3/documentation.asp?id=" iso)) \
+        sprintf("%-22s%s\n", "SIL", ansi("bold", "https://iso639-3.sil.org/code/" iso)) \
         sprintf("%-22s%s\n", "Glottolog", getGlotto(code) ?
-                ansi("bold", "http://glottolog.org/resource/languoid/id/" getGlotto(code)) : "") \
-        sprintf("%-22s%s", "Wikipedia", ansi("bold", "http://en.wikipedia.org/wiki/" language))
+                ansi("bold", "https://glottolog.org/resource/languoid/id/" getGlotto(code)) : "") \
+        sprintf("%-22s%s", "Wikipedia", ansi("bold", "https://en.wikipedia.org/wiki/ISO_639:" iso))
 }

 # Add /slashes/ for IPA phonemic notations and (parentheses) for others.


Escape '(' and ')' in regexp.

Escape '(' and ')' in regexp.

--- LANGNAME.awk
+++ LANGNAME.awk
@@ -110,7 +110,7 @@
 		gsub(", autres langues$", "", name);
 		gsub(", autres$", "", name);
 		gsub(", langues$", "", name);
-		gsub(", langues (famille)$", "", name);
+		gsub(", langues \\(famille\\)$", "", name);
 		if (name ~ /\(.*[0-9].*\)$/)
 		    gsub(" \\([^)]*\\)$", "", name);
 		if (name ~ ", ") {


fixes #340

fixes #340

--- bin/util/header2params2.awk
+++ bin/util/header2params2.awk
@@ -212,6 +212,7 @@

 { # length(conversionID) {
    cellValue=$0;
+   gsub(/"/,"\\\"",cellValue)

    # If we know there is no header, we can give an example value.
    headerOrExample = (length(header) && header <= 0) ? "conversion:eg " : "ov:csvHeader  ";