remove confusing comments from the log massager

--- src/log-massage.awk
+++ src/log-massage.awk
@@ -42,17 +42,17 @@
 /^Merge:[ 	].*/ {
 	ismerge = 1
 	last = "merge"
-	next						# don't track merge history
+	next
 }

 /^[ 	]+.*/ {
 	last = "logmsg"
-	next						# don't track log message
+	next
 }

 /^-[ 	]+-[ 	]+.*/ {
 	last = "binary"
-	next						# don't track binary files
+	next
 }

 /^[0-9]+[ 	]+[0-9]+[ 	]+.*/ {


LanguageData: update section V

LanguageData: update section V

--- include/LanguageData.awk
+++ include/LanguageData.awk
@@ -2549,9 +2549,7 @@
     Locale["uz"]["spoken-in"]          = "Uzbekistan; Afghanistan; Pakistan"
     Locale["uz"]["supported-by"]       = "google; bing; yandex"

-
-
-    #102 Vietnamese
+    # Vietnamese
     Locale["vi"]["name"]               = "Vietnamese"
     Locale["vi"]["endonym"]            = "Tiếng Việt"
     Locale["vi"]["translations-of"]    = "Bản dịch của %s"
@@ -2560,9 +2558,14 @@
     Locale["vi"]["examples"]           = "Ví dụ"
     Locale["vi"]["see-also"]           = "Xem thêm"
     Locale["vi"]["family"]             = "Austroasiatic"
+    Locale["vi"]["branch"]             = "Vietic"
     Locale["vi"]["iso"]                = "vie"
     Locale["vi"]["glotto"]             = "viet1252"
     Locale["vi"]["script"]             = "Latn"
+    Locale["vi"]["spoken-in"]          = "Vietnam"
+    Locale["vi"]["supported-by"]       = "google; bing; yandex"
+
+

     #103 Welsh
     Locale["cy"]["name"]               = "Welsh"
@@ -2679,20 +2682,6 @@
     Locale["oc"]["iso"]                = "oci"
     Locale["oc"]["glotto"]             = "occi1239"
     Locale["oc"]["script"]             = "Latn"
-
-    #? Udmurt
-    Locale["udm"]["support"]           = "yandex-only"
-    Locale["udm"]["name"]              = "Udmurt"
-    Locale["udm"]["endonym"]           = "удмурт"
-    #Locale["udm"]["translations-of"]
-    #Locale["udm"]["definitions-of"]
-    #Locale["udm"]["synonyms"]
-    #Locale["udm"]["examples"]
-    #Locale["udm"]["see-also"]
-    Locale["udm"]["family"]            = "Uralic"
-    Locale["udm"]["iso"]               = "udm"
-    Locale["udm"]["glotto"]            = "udmu1245"
-    Locale["udm"]["script"]            = "Cyrl"

     #? Volapük
     Locale["vo"]["support"]            = "unstable"


Minor spacing change for readability

Minor spacing change for readability

--- verifyBBoxDownloadsFrom-webscraper.awk
+++ verifyBBoxDownloadsFrom-webscraper.awk
@@ -47,8 +47,7 @@
     episodeField = fields[nfields-2]
     if (seasonField == "") {
         print "==> " target " (blank Seasons field in " SEASONS_SORTED_FILE ")" > "/dev/stderr"
-        print "    " unquotedTarget " (blank Seasons field in " SEASONS_SORTED_FILE ")" \
-            >> TEMP_FILE
+        print "    " unquotedTarget " (blank Seasons field in " SEASONS_SORTED_FILE ")" >> TEMP_FILE
         continue
     }
     print "          " target " " seasonField " has " episodeField


Translate: add initHttpService()

Translate: add initHttpService()

--- lib/Translate.awk
+++ lib/Translate.awk
@@ -3,6 +3,14 @@
 @include "lib/Commons"
 @include "lib/PLTokenizer"
 @include "lib/PLParser"
+
+# Initialize `HttpService`.
+function initHttpService() {
+    HttpProtocol = "http://"
+    HttpHost = "translate.google.com"
+    HttpPort = 80
+    HttpService = "/inet/tcp/0/" HttpHost "/" HttpPort
+}

 # Pre-process string (URL-encode before send).
 function preprocess(text) {


Display list of directories which ran no tests

Testsuite directories should now display " => skipped" for each test,
rather than simply displaying nothing.

--- testsuite/makefiles/summarize.awk
+++ testsuite/makefiles/summarize.awk
@@ -32,6 +32,7 @@
 function record_skip() {
     check();
     RESULTS[key] = "s";
+    if (curdir in SKIPPED) SKIPPED[curdir] = 1;
     clear();
 }

@@ -58,7 +59,8 @@
     if (in_test) record_unexp();
     match($0, /Running tests from '[^']*'/);
     curdir = substr($0, RSTART+20, RLENGTH - 21);
-    SKIPPED[curdir] = 1;
+    # Use SKIPPED[curdir] as a sentintel to detect no output
+    SKIPPED[curdir] = 0;
     key = curdir;
     DIRS[key] = key;
     curfile = "";
@@ -117,6 +119,13 @@
         exit (3);
     }else{
         if (!retries){
+            for (key in SKIPPED){
+                if (!SKIPPED[key]){
+                    ++ empty;
+                    blanks[emptyidx++] = key;
+                    delete SKIPPED[key];
+                }
+            }
             for (key in RESULTS){
                 r = RESULTS[key];
                 if (r == "p"){
@@ -162,6 +171,10 @@
                 printf("\nList of skipped tests:\n");
                 for (i=0; i < skipidx; i++) printf("    %s\n", skips[i]);
             }
+            if (empty != 0){
+                printf("\nList of directories returning no results:\n");
+                for (i=0; i < empty; i++) printf("    %s\n", blanks[i]);
+            }
             printf("\n");
             if (failed || unexped){
                 printf("#### Something failed. Exiting with error status.\n\n");


r12427/sofa-dev : UPDATE filter-qmake-pro script to handle recent formatting changes

Former-commit-id: 1baa74b99206ec87a03ab0ccaf5c3fb35123ddac

--- scripts/filter-qmake-pro.awk
+++ scripts/filter-qmake-pro.awk
@@ -74,6 +74,14 @@
   next;
 }

+blk_filtered>0 && /^[ \t#]*contains\(DEFINES,[^)]*\)[ \t#]*{[ \t#]*usePlugin/ {
+  name=$0;
+  gsub(/.*\(/,"",name); gsub(/.*\(/,"",name); gsub(/,.*$/,"",name); gsub(/\).*$/,"",name); gsub(/ /,"",name); gsub(/\t/,"",name);
+  #print "#DEV PLUGIN <<<",name,">>>";
+  print plugins "/" name > "/dev/stderr";
+  next;
+}
+
 blk_filtered>0 {
     #print "# " $0
     # look for a filename


gen-vers.awk: fix typo in comment

gen-vers.awk: fix typo in comment

--- gen-vers.awk
+++ gen-vers.awk
@@ -15,7 +15,7 @@
 # the macros generated by this program.
 #
 # Note: if you change the format of .map.in files you probably need to
-# update gen-vers.awk too.
+# update gen-map.awk too.
 #
 # Note: we currently don't support compatibility symbols that need
 # a different definition from the default version.


- Add a ";' at the end of the style attribute
- Remove obsolete session-line
- Do not color the pkt numbers

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

--- awk-scripts/callflow.awk
+++ awk-scripts/callflow.awk
@@ -81,7 +81,7 @@

 func arrow(x,y,d,c) {

-  printf "<polygon points=\"%d,%d %d,%d %d,%d %d,%d\" class=\"arrowhead\" style=\"fill: %s; stroke: %s\"/>\n",
+  printf "<polygon points=\"%d,%d %d,%d %d,%d %d,%d\" class=\"arrowhead\" style=\"fill: %s; stroke: %s;\"/>\n",
   x,y,
   x+5*d, y-3,
   x+3*d, y,
@@ -108,7 +108,7 @@
     printf "    <area href=\"frames/Frame%d.html\" coords=\"%d,%d,%d,%d\" alt=\"frame %d\"/>\n", $1, x1, y-yLineSpace+2, x1+15, y+7+1, $1 >> "imagemap"

   } else if (x1<x2) {
-    printf "<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" class=\"traceline\" style=\"stroke: %s\"/>\n", x1, y, x2, y, color[c];
+    printf "<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" class=\"traceline\" style=\"stroke: %s;\"/>\n", x1, y, x2, y, color[c];
     arrow(x2,y,-1,c);

     xtext = x1 + 10;
@@ -116,7 +116,7 @@
     printf "    <area href=\"frames/Frame%d.html\" coords=\"%d,%d,%d,%d\" alt=\"frame %d\"/>\n", $1, x1, y-yLineSpace+2, x2, y+1, $1 >> "imagemap"

   } else {
-    printf "<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" class=\"traceline\" style=\"stroke: %s\"/>\n", x1, y, x2, y, color[c];
+    printf "<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" class=\"traceline\" style=\"stroke: %s;\"/>\n", x1, y, x2, y, color[c];
     arrow(x2,y,1,c);

     xtext = x2 + 10;
@@ -173,7 +173,6 @@
 		# If over 11 colors, choose black color as default...
 		# TODO: change color behavior
 		if (strtonum(c)>11) {c="0"}
-		# printf("<text x=\"%d\" y=\"%d\" class=\"session-text\" style=\"fill: %s;\">%s</text>\n", 25, y, color[c], $4);
 	 }
 	 l1 = sprintf("%s:%s", $2,$3);
 	 l2 = sprintf("%s:%s", $5,$6);
@@ -193,7 +192,7 @@
 	 x2 = x2 * xHostSpace + leftMargin;

 	 ORS = "";
-	 printf "<text x=\"%d\" y=\"%d\" class=\"pkt-text\" style=\"fill: %s;\">%d</text>\n", leftMargin/2, y, color[c], $1;
+	 printf "<text x=\"%d\" y=\"%d\" class=\"pkt-text\">%d</text>\n", leftMargin/2, y, $1;

 	 output = "";
 	 for(i=7;i<=NF;i++) output = output " " $i;


Compose titles

Compose titles

Include show name, season info, title

--- getBBoxCatalogFrom-sitemap.awk
+++ getBBoxCatalogFrom-sitemap.awk
@@ -286,6 +286,7 @@
         }
         # print "sortkey = " sortkey > "/dev/stderr"
         # Compose title
+        title = sprintf ("%s, S%02d, %s", showTitle, seasonNumber, title)
     }

     if (contentType == "tv_episode") {
@@ -309,6 +310,7 @@
         }
         # print "sortkey = " sortkey > "/dev/stderr"
         # Compose title
+        title = sprintf ("%s, S%02dE%03d, %s", showTitle, seasonNumber, episodeNumber, title)
     }

     # Generate a link that will lead to the show on Britbox
@@ -327,6 +329,7 @@
     sub ("tv_","",showType)
     URL = "https://www.britbox.com/us/" showType EntityId
     fullTitle = "=HYPERLINK(\"" URL "\";\"" title "\")"
+    # print "fullTitle = " fullTitle > "/dev/stderr"

     # Copied from above to make it easier to coordinate printing fields
     # printf ("Sortkey\tTitle\tSeasons\tEpisodes\tDuration\tYear\tRating\tDescription\t")


Constant generation needs to handle multiline comments. (dm)

--- Programs/brl_cmds.awk
+++ Programs/brl_cmds.awk
@@ -124,15 +124,33 @@
   print statement
 }

-function getComment(line) {
-  if (!match(line, "/\\*.*\\*/")) return ""
-  line = substr(line, RSTART+2, RLENGTH-4)
+function getComment(line,     comment, last) {
+  comment = ""

-  match(line, "^\\**<? *")
-  line = substr(line, RLENGTH+1)
+  if (match(line, "/\\*")) {
+    line = substr(line, RSTART+2)
+    gsub("^\\**<? *", "", line)

-  match(line, " *$")
-  return substr(line, 1, RSTART-1)
+    while (1) {
+      last = gsub("\\*/.*$", "", line)
+      gsub(" *$", "", line)
+
+      if (length(comment) > 0) comment = comment " "
+      comment = comment line
+      if (last) break
+
+      getline line
+      gsub("^\\s*\\**\\s*", "", line)
+    }
+  } else if (match(line, "//")) {
+    comment = substr(line, RSTART+2);
+    gsub("^ *", "", comment)
+
+    gsub("\\*/.*$", "", comment)
+    gsub(" *$", "", comment)
+  }
+
+  return comment
 }

 function getDefineValue() {


Update getAcornFrom-episodePages.awk

Update getAcornFrom-episodePages.awk

Fix site change from "container footer" to "footer"

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

 # When we get to the bottom of the episode
-/ EPISODE_DESCRIPTION_FILE
     #
     # Grab the URL from the EPISODE_CURL_FILE - you can't dig it out from here


fixed https://github.com/timrdf/csv2rdf4lod-automation/issues/112

--- bin/util/e-params-increment.awk
+++ bin/util/e-params-increment.awk
@@ -10,6 +10,9 @@
       # @prefix :           <http://logd.tw.rpi.edu/source/nitrd-gov/dataset/fed_RD_IT/version/2011-Jan-27/conversion/enhancement/2> .
       sub(/enhancement\/[^\/]*\//,"enhancement/"eID);
       print $0
+   }else if(/^</ && /source\// && /dataset\// && /version\// && /conversion\// && /enhancement\/[^\/]*>/){
+      sub(/enhancement\/[^\/]*>/,"enhancement/"eID">");
+      print $0
    }else if( $0~"conversion:enhancement_identifier" ) {
       printf("      conversion:enhancement_identifier \"%s\";\n",eID)}
    else {


Use \r instead of \x0d in awk pattern for portability

Hex escapes in the regexps are not supported in Solaris nawk, for
instance. \r should match a CR in all cases as far as I know.


handling #conversion:label

handling #conversion:label

--- bin/util/cell-ify-eparams.awk
+++ bin/util/cell-ify-eparams.awk
@@ -113,7 +113,7 @@
    line=$0;

    if( length(label_up) > 0 && $1 == "conversion:label" || $1 == "#conversion:label" ) {
-      print annotate("         %s  \""label_up"\";",$1,PADDING,"was "$2);
+      print annotate("         conversion:label  \""label_up"\";",PADDING,"was "$2);
    }else if( length(out_range) > 0 && $1 == "conversion:range" ) {
       print annotate("         conversion:range  "out_range";",PADDING,"was "$2);
    }else if( $1 == "];" ) {


Languages: add Turkmen language

Languages: add Turkmen language

--- include/Languages.awk
+++ include/Languages.awk
@@ -340,6 +340,19 @@
     Locale["bo"]["iso"]                = "bod"
     Locale["bo"]["glotto"]             = "tibe1272"
     Locale["bo"]["script"]             = "Tibt"
+
+    #? Turkmen
+    Locale["tk"]["name"]               = "Turkmen"
+    Locale["tk"]["endonym"]            = "Türkmen"
+    #Locale["tk"]["translations-of"]
+    #Locale["tk"]["definitions-of"]
+    #Locale["tk"]["synonyms"]
+    #Locale["tk"]["examples"]
+    #Locale["tk"]["see-also"]
+    Locale["tk"]["family"]             = "Turkic"
+    Locale["tk"]["iso"]                = "tuk"
+    Locale["tk"]["glotto"]             = "turk1304"
+    Locale["tk"]["script"]             = "Latn"

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


Languages: mark as stable: West Frisian

Languages: mark as stable: West Frisian

--- include/Languages.awk
+++ include/Languages.awk
@@ -435,15 +435,14 @@
     Locale["wo"]["glotto"]             = "wolo1247"
     Locale["wo"]["script"]             = "Latn"

-    #? Western Frisian
-    Locale["fy"]["support"]            = "unstable"
-    Locale["fy"]["name"]               = "Western Frisian"
+    # West Frisian
+    Locale["fy"]["name"]               = "Frisian"
     Locale["fy"]["endonym"]            = "Frysk"
-    #Locale["fy"]["translations-of"]
-    #Locale["fy"]["definitions-of"]
-    #Locale["fy"]["synonyms"]
-    #Locale["fy"]["examples"]
-    #Locale["fy"]["see-also"]
+    Locale["fy"]["translations-of"]    = "Oersettings fan %s"
+    Locale["fy"]["definitions-of"]     = "Definysjes fan %s"
+    Locale["fy"]["synonyms"]           = "Synonimen"
+    Locale["fy"]["examples"]           = "Foarbylden"
+    Locale["fy"]["see-also"]           = "Sjoch ek"
     Locale["fy"]["family"]             = "Indo-European"
     Locale["fy"]["iso"]                = "fry"
     Locale["fy"]["glotto"]             = "west2354"


Translate: close the pipe after printing to terminal pager (fix #266, see also #245)

--- include/Translate.awk
+++ include/Translate.awk
@@ -185,9 +185,10 @@

 # Print a string (to output file or terminal pager).
 function p(string) {
-    if (Option["view"])
+    if (Option["view"]) {
         print string | Option["pager"]
-    else
+        close(Option["pager"])
+    } else
         print string > Option["output"]
 }


Fixes to brlapi.awk for BrlAPI parameter constants. (dm)

--- Programs/brlapi.awk
+++ Programs/brlapi.awk
@@ -18,7 +18,7 @@

 BEGIN {
   apiRangeTypeCount = 0
-  paramCount = 0
+  apiParameterCount = 0
 }

 /#define[ \t]*BRLAPI_(CURSOR|DISPLAY|ERROR|TTY)_/ {
@@ -57,15 +57,15 @@
   next
 }

-/^ *BRLAPI_PARAM_[^ ]+ = [0-9x]+,/ {
+/^ *BRLAPI_PARAM_[^ ]+ += +[0-9]+,?/ {
   gsub(",", "", $3)
-  paramCount = strtonum($3);
-  apiConstant(substr($1, 8), $1, paramCount++, "")
+  apiParameterCount = strtonum($3)
+  apiConstant(substr($1, 8), $1, apiParameterCount++, "")
   next
 }

-/^ *BRLAPI_PARAM_[^ ,]+,/ {
+/^ *BRLAPI_PARAM_[^ ,]+,?/ {
   gsub(",", "", $1)
-  apiConstant(substr($1, 8), $1, paramCount++, "")
+  apiConstant(substr($1, 8), $1, apiParameterCount++, "")
   next
 }


changing email address

changing email address

--- SLURM/scripts/split_rmdups.awk
+++ SLURM/scripts/split_rmdups.awk
@@ -92,7 +92,7 @@
     close(sscriptname);

     sscriptname = sprintf("%s/.%s_mail.slurm", debugdir, groupname);
-    printf("#!/bin/bash -l\n#SBATCH -o %s/dup-mail.out\n#SBATCH -e %s/dup-mail.err\n#SBATCH -p %s\n#SBATCH -J %s_msplit0\n#SBATCH -d singleton\n#SBATCH -t 1440\n#SBATCH -c 1\n#SBATCH --ntasks=1\ndate;\necho %s %s %s %s | mail -r Juicer@rice.edu -s \"Juicer pipeline finished successfully @ Rice\" -t %s@rice.edu;\ndate\n", debugdir, debugdir, queue, groupname, topDir, site, genomeID, genomePath, user) > sscriptname;
+    printf("#!/bin/bash -l\n#SBATCH -o %s/dup-mail.out\n#SBATCH -e %s/dup-mail.err\n#SBATCH -p %s\n#SBATCH -J %s_msplit0\n#SBATCH -d singleton\n#SBATCH -t 1440\n#SBATCH -c 1\n#SBATCH --ntasks=1\ndate;\necho %s %s %s %s | mail -r aidenlab@bcm.edu -s \"Juicer pipeline finished successfully @ Voltron\" -t %s@hi-c.io;\ndate\n", debugdir, debugdir, queue, groupname, topDir, site, genomeID, genomePath, user) > sscriptname;
     sysstring = sprintf("sbatch %s", sscriptname);
     system(sysstring);
     close(sscriptname);


print changed to printf

print changed to printf

--- english/gawk/code/reverse.awk
+++ english/gawk/code/reverse.awk
@@ -1,3 +1,3 @@
 { for (i = NF; i > 0; i--) { printf "%s:", $i; }
-	print "\n";
+	printf "\n";
 }


Awk REs are not POSIX compliant

Awk REs are not POSIX compliant

--- calculateBBoxShowDurations.awk
+++ calculateBBoxShowDurations.awk
@@ -30,14 +30,14 @@
 # this includes all movies and all episodes
 $5 != "" {
     # Check all durations for strict HH:MM:SS format
-    if ($5 !~ /^[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}$/) {
+    if ($5 !~ /^[0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/) {
         print "==> Bad duration " $5 " in " $0 >> ERRORS
         print
         next
     } else {
         split ($5, tm, ":")
         totalTime[3] += tm[3]
-        totalTime[2] += tm[2] + int(totalTime[3] / 60)
+        totalTime[2] += tm[2] + int(totalTime[3] / 60)
         totalTime[1] += tm[1] + int(totalTime[2] / 60)
         totalTime[3] %= 60; totalTime[2] %= 60
     }


Languages: add Eastern Mari language (yandex only)

--- include/Languages.awk
+++ include/Languages.awk
@@ -1534,6 +1534,20 @@
     Locale["dz"]["iso"]                = "dzo"
     Locale["dz"]["glotto"]             = "nucl1307"
     Locale["dz"]["script"]             = "Tibt"
+
+    #? Eastern Mari
+    Locale["mhr"]["support"]           = "yandex-only"
+    Locale["mhr"]["name"]              = "Eastern Mari"
+    Locale["mhr"]["endonym"]           = "Олык марий"
+    #Locale["mhr"]["translations-of"]
+    #Locale["mhr"]["definitions-of"]
+    #Locale["mhr"]["synonyms"]
+    #Locale["mhr"]["examples"]
+    #Locale["mhr"]["see-also"]
+    Locale["mhr"]["family"]            = "Uralic"
+    Locale["mhr"]["iso"]               = "mhr"
+    Locale["mhr"]["glotto"]            = "east2328"
+    Locale["mhr"]["script"]            = "Cyrl"

     #? Faroese
     Locale["fo"]["support"]            = "unstable"


--- getBritBoxEpisodesFrom-webscraper.awk
+++ getBritBoxEpisodesFrom-webscraper.awk
@@ -37,9 +37,12 @@
         sortkey = sprintf ("E%05d", fld[nflds])
     }

-    sub( / min/,"",Duration)
+    # Get rid of redundant "Series #" or "Series #" from episodeTitle
+    if (match (episodeTitle, /^Season [[:digit:]]*, |^Series [[:digit:]]*, /))
+        episodeTitle = substr(episodeTitle,RLENGTH+1)

     # Convert duration from minutes to HMS
+    sub( / min/,"",Duration)
     secs = 0
     mins = Duration % 60
     hrs = int(Duration / 60)
@@ -52,7 +55,7 @@
         showTitle = substr(showTitle, 5) ", The"

     savedLine = sprintf \
-        ("%s (2) %s %s\t=HYPERLINK(\"https://www.britbox.com%s\";\"%s, %s,  %s\"\)\t\t\t%s\t%s\t%s\t%s",\
+        ("%s (2) %s %s\t=HYPERLINK(\"https://www.britbox.com%s\";\"%s, %s, %s\"\)\t\t\t%s\t%s\t%s\t%s",\
          showTitle, Years, sortkey, URL, showTitle, sortkey, episodeTitle, HMS, Years, \
          Rating, Description)


Whoops

Whoops

--- src/amdtbl.awk
+++ src/amdtbl.awk
@@ -11,7 +11,7 @@
     intable=1
     print "<tr>"

-    $0 = substr($0, 2, length($0)-2)
+    $0 = substr($0, 3, length($0)-4)
     split($0, a)
     for(i in a) {
         align="center"


Main: support 4-letter script code (besides 2-letter region code)


skip debuggin symbols

skip debuggin symbols

--- scripts/modpost.awk
+++ scripts/modpost.awk
@@ -586,7 +586,6 @@
 }
 function set_symbol(sym, mod, crc, expt, set, pos, own, src, use, from)
 {
-    if (sym ~ /^(gpl|strings)$/) { return }
     if (!(sym in syms)) {
 	syms[sym] = 1
 	cache_dirty = 1
@@ -801,6 +800,9 @@
 		    continue
 		val = "" $1; sec = $(NF-2); offset = $(NF-1); sym = $NF
 		flags = substr($0, length(val)+2, 7)
+		# skip debugging symbols
+		if (substr(flags,6,1) == "d")
+		    continue
 		if (substr(flags,1,1) == "l") {
 		    if (substr(flags,7,1) == "O" || !values["modversions"]) {
 			if (sec == ".modinfo") {


- get rid of undefined variable error

- get rid of undefined variable error

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


Removed CVS changelog generator

Removed CVS changelog generator

--- make/log_to_changelog.awk
+++ make/log_to_changelog.awk
@@ -1,169 +0,0 @@
-BEGIN{
-	revision_key=0
-}
-
-function gline()
-{
-	if(!getline)
-		error("Unexpected EOF")
-	return 1
-}
-
-function error(s)
-{
-	print s > "/dev/stderr"
-	exit(1)
-}
-
-/^?/{next}
-
-#Process a file entry
-/^Working file:/{
-
-	#Get the filename
-	filename=$3
-
-	#Find the tags
-	while(gline() && !/^symbolic names:/);
-
-	#Extract tags
-	delete revision_to_tag
-	while(gline() && ! /^keyword substitution:/)
-	{
-		tagname=substr($1, 1, length($1)-1)
-		revision_to_tag[$2]=tagname
-	}
-
-	#Skip over the rest until the revisions
-	while(gline() && !/^----------------/);
-
-	#There is always at least one revision
-	do
-	{
-		#The revision number
-		gline()
-		revision=$2
-
-		#The commit line
-		gline()
-		author=substr($6, 1, length($6)-1)
-
-		#Remove the variable line count.
-		if($9 == "lines:")
-		{
-			$10 = ""
-			$11 = ""
-		}
-		$0=$0
-		commit_line=$0
-
-		#Store the date* 10 for extra precision
-		date = $2" "$3
-		gsub(/[^0-9]+/, " ", date)
-		date=mktime(date)*10
-
-		#The commit message
-		message=""
-		while(gline() && !/^[-=]+$/)
-			message = message $0 "\n"
-
-		#The commit line is the primary key.
-
-		#Keep track of commits
-		date_to_line[date]=commit_line
-		line_to_message[commit_line]=message
-		line_to_author[commit_line]=author
-		line_to_files[commit_line]=line_to_files[commit_line] " " filename
-		line_to_revision[commit_line]=line_to_revision[commit_line] " " revision
-
-		#The last file commit which has a certain tag
-		#happens just before the tag.
-		if(tag_to_date[revision_to_tag[revision]] < date)
-			tag_to_date[revision_to_tag[revision]] = date
-	}
-	while(!/^=+$/)
-}
-
-
-END{
-	#Delete the null tag for untagged revisions
-	delete tag_to_date[""]
-
-	#The last
-	for(i in tag_to_date)
-	{
-		#Put the tag in just after the last commit
-		date = tag_to_date[i] + 1
-		date_to_line[date]="hello"
-		date_to_tag[date]=i
-	}
-
-
-	#Sort commits by date
-	num_dates=asorti(date_to_line, sorted_dates)
-
-	#Iterate through all commits, newest first
-	for(i=num_dates; i > 0; i--)
-	{
-		date = sorted_dates[i]
-
-		if(date in date_to_tag)
-		{
-			print "=========================================="
-			print "Repository tagged as " date_to_tag[date]
-			print "=========================================="
-		}
-		else
-		{
-			line = date_to_line[date]
-
-			author=line_to_author[line]
-			message=line_to_message[line]
-
-			file_list=line_to_files[line]
-			rev_list=line_to_revision[line]
-
-			print ""
-			#Long commits can get spread over several seconds.
-			#Try to concatenate entries which differ by a few
-			#seconds, but have the same commit messsage and
-			#author
-			#We allow 20 seconds
-			concatenation=""
-			num_concat=0
-			for(j=i-1; j>0 &&
-					   author==line_to_author[date_to_line[sorted_dates[j]]] &&
-					   message==line_to_message[date_to_line[sorted_dates[j]]] &&
-					   date - sorted_dates[j] < 1000; j--)
-			{
-				#Reset i, so that the fragment appears once only.
-				i=j
-
-				#Append to the file and revision list
-				file_list=file_list " " line_to_files[date_to_line[sorted_dates[j]]];
-				rev_list=rev_list " " line_to_revision[date_to_line[sorted_dates[j]]];
-
-				#Make a note of teh concatenations
-				concatenation=concatenation ", " (date - sorted_dates[j])/10 "s"
-				num_concat++
-			}
-
-			#Create a message based on concatenation
-			if(num_concat)
-				concatenation = " (Concatenated " num_concat+1 " entries at " substr(concatenation, 3) ")"
-
-			#Leader line
-			print strftime("%a %e %b, %Y %H:%M:%S", date/10) " author: " author concatenation
-
-			#List files commit happened on
-			numfiles=split(file_list, files);
-			split(rev_list, revisions);
-
-			for(j=1; j <= numfiles; j++)
-				print "    File: " files[j] " (Rev. " revisions[j] ")"
-
-			#Print the commit message
-			print "\n" message "\n--------------"
-		}
-	}
-}


Commons: add replicate()

Commons: add replicate()

--- lib/Commons.awk
+++ lib/Commons.awk
@@ -46,6 +46,16 @@
         }
     }
     return string
+}
+
+# Replicate a string.
+function replicate(string, len,
+                   ####
+                   i, temp) {
+    temp = ""
+    for (i = 0; i < len; i++)
+        temp = temp string
+    return temp
 }

 # Return 1 if the array contains anything; otherwise return 0.


Use named constants, not magic numbers

Use named constants, not magic numbers

--- RPi_system/get_asic_stats.awk
+++ RPi_system/get_asic_stats.awk
@@ -30,7 +30,7 @@
 }

 END {
-  for (asic = 0; asic < 6; asic++) {
+  for (asic = 0; asic < NUM_ASIC; ++asic) {
     num = asic + 1;
     temp = "---";
     if ("" != asic_temp[asic])
@@ -38,7 +38,7 @@
     if (temp <= 0)
       temp = "---";
     freq = 0.0;
-    for (die = 0; die < 4; die++) {
+    for (die = 0; die < NUM_DIE; ++die) {
       freq += asic_freq[asic, die];
     }
     freq /= 4.0;
@@ -46,7 +46,7 @@
       freq = "---";
     dcdctemp = 0;
     dcdcnum = 0;
-    for (dcdc = 0; dcdc < 8; dcdc++) {
+    for (dcdc = 0; dcdc < NUM_DCDC; ++dcdc) {
       if ("" == asic_dcdctemp[asic, dcdc])
         continue;
       dcdctemp += asic_dcdctemp[asic, dcdc];


refactor a bit and close quotation before starting code

--- tools/wiki2latex.awk
+++ tools/wiki2latex.awk
@@ -28,6 +28,13 @@
 / *}}}/ { sub(/ */, "") }

 !coding && /^{{{/ {
+
+  if (quoting) {
+    print "\\end{quotation}";
+    print ""
+    quoting = 0;
+  }
+
   print "\\begin{verbatim}";
   coding = 1;
   next;
@@ -66,7 +73,7 @@
   ## print " ########## ITEM"
 }

-itemizing && !/^   *\*/ {
+itemizing && !inItem {
   print "\\end{itemize}";
   itemizing = 0;
 }
@@ -115,12 +122,12 @@
   next;
 }

-!itemizing && /^   *\*/ {
+!itemizing && inItem {
   print "\\begin{itemize}";
   itemizing = 1;
 }

-itemizing && /^   *\*/ {
+itemizing && inItem {
   sub(/^   *\*/, "\\item");
   print;
   print "";


Add year differentation into monthly report

--- debts.awk
+++ debts.awk
@@ -4,8 +4,8 @@

 $1 == "pld" { p += $2 }
 $1 == "val" { v += $2 }
-{ "date -d "$3" +%B" | getline month
-  monthly[month][$1] += $2
+{ "date -d "$3" '+%B %Y'" | getline month_and_year
+  monthly[month_and_year][$1] += $2
   categorically[$1][$4] += $2 }

 END { print "Val spent "v"€"
@@ -23,11 +23,15 @@
         print "Here's the detail:"

         print "  Spendings per month:"
-        for ( month in monthly ) {
-          print "    In "month":"
-          for ( who in monthly[month] ) {
-            print "      "who" spent "monthly[month][who]"€."
+        for ( month_and_year in monthly ) {
+          print "    In "month_and_year":"
+          total_for_month = 0
+          for ( who in monthly[month_and_year] ) {
+            spent = monthly[month_and_year][who]
+            print "      "who" spent "spent"€."
+            total_for_month += spent
           }
+          print "      Total: "total_for_month"€."
         }

         print "  Spendings by category:"


debts.awk: Fix getline call

debts.awk: Fix getline call

Using awk's getline directly on a string seems buggy, and we should call
close() after a getline call. Not following these guidelines led to have
the date command not always returning the correct month and year.

This is now fixed.

--- debts.awk
+++ debts.awk
@@ -4,7 +4,9 @@

 $1 == "pld" { p += $2 }
 $1 == "val" { v += $2 }
-{ "date -d "$3" '+%B %Y'" | getline month_and_year
+{ date = "date -d "$3" '+%B %Y'"
+  date | getline month_and_year
+  close(date)
   monthly[month_and_year][$1] += $2
   categorically[$1][$4] += $2 }


prevent variables from spilling out into global scope

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

-function bind_data(txt,   tag, key) {
+function bind_data(txt,   tag, key, partial_txt) {
   if (match(txt, /{{> ([^}]*)}}/)) {
     tag = substr(txt, RSTART, RLENGTH)
     match(tag, /([[:alnum:]_]|[?]).*[^}]/)
@@ -102,7 +102,7 @@
 # line.
 #
 # Nothing is returned if the file doesn't exist.
-function load_partial(key,     partial, partial_file, line) {
+function load_partial(key,     partial, pwd, partial_file, partial_txt, line) {
   partial = partials[key]
   if (partial) {
     return partial
@@ -128,7 +128,7 @@
 }

 # Check if a file exists
-function is_file(file) {
+function is_file(file,    check, response) {
   check = "[ -f " file " ] && echo yes"
   check | getline response
   close(check)


Use a better URN

Use a better URN

--- misc/rdf-n3.awk
+++ misc/rdf-n3.awk
@@ -1,6 +1,8 @@
 #!/usr/bin/awk -f
 BEGIN {
     FS = "\t";
+
+    URN           = "urn:swn:";

     LABEL         = "<http://www.w3.org/2000/01/rdf-schema#label>";
     TYPE          = "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>";
@@ -25,8 +27,8 @@

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

-    print "<urn:linked:c" $1 ">", TYPE,  CONCEPT,           ".";
-    print "<urn:linked:c" $1 ">", LABEL, "\"synset" $1 "\"", ".";
+    print "<" URN "c" $1 ">", TYPE,  CONCEPT,            ".";
+    print "<" URN "c" $1 ">", LABEL, "\"synset" $1 "\"", ".";

     for (sense_id in senses) {
         sense = senses[sense_id];
@@ -43,20 +45,20 @@
             if (!(word in windex)) {
                 windex[word] = wcount++;

-                print "<urn:linked:w" windex[word] ">", TYPE,          WORD,                             ".";
-                print "<urn:linked:w" windex[word] ">", LABEL,         "\"" word "\"",                   ".";
-                print "<urn:linked:f" windex[word] ">", TYPE,          FORM,                             ".";
-                print "<urn:linked:f" windex[word] ">", LABEL,         "\"" word "\"",                   ".";
-                print "<urn:linked:f" windex[word] ">", WRITTENREP,    "\"" word "\"",                   ".";
-                print "<urn:linked:w" windex[word] ">", CANONICALFORM, "<urn:linked:f" windex[word] ">", ".";
+                print "<" URN "w" windex[word] ">", TYPE,          WORD,                             ".";
+                print "<" URN "w" windex[word] ">", LABEL,         "\"" word "\"",                   ".";
+                print "<" URN "f" windex[word] ">", TYPE,          FORM,                             ".";
+                print "<" URN "f" windex[word] ">", LABEL,         "\"" word "\"",                   ".";
+                print "<" URN "f" windex[word] ">", WRITTENREP,    "\"" word "\"",                   ".";
+                print "<" URN "w" windex[word] ">", CANONICALFORM, "<" URN "f" windex[word] ">",     ".";
             }

-            print "<urn:linked:s" sindex[sense] ">", TYPE,          LEXICALSENSE,       ".";
-            print "<urn:linked:s" sindex[sense] ">", LABEL,         "\"" sense "\"",    ".";
-            print "<urn:linked:s" sindex[sense] ">", ISSENSEOF,     "<urn:linked:w" windex[word] ">",  ".";
-            print "<urn:linked:w" windex[word] ">",  SENSE,         "<urn:linked:s" sindex[sense] ">", ".";
-            print "<urn:linked:s" sindex[sense] ">", REFERENCE,     "<urn:linked:c" $1 ">",            ".";
-            print "<urn:linked:c" $1 ">",            ISREFERENCEOF, "<urn:linked:s" sindex[sense] ">", ".";
+            print "<" URN "s" sindex[sense] ">", TYPE,          LEXICALSENSE,                  ".";
+            print "<" URN "s" sindex[sense] ">", LABEL,         "\"" sense "\"",               ".";
+            print "<" URN "s" sindex[sense] ">", ISSENSEOF,     "<" URN "w" windex[word] ">",  ".";
+            print "<" URN "w" windex[word]  ">", SENSE,         "<" URN "s" sindex[sense] ">", ".";
+            print "<" URN "s" sindex[sense] ">", REFERENCE,     "<" URN "c" $1 ">",            ".";
+            print "<" URN "c" $1 ">",            ISREFERENCEOF, "<" URN "s" sindex[sense] ">", ".";
         }

         for (isa_id in isas) {
@@ -74,22 +76,22 @@
                 if (!(word in windex)) {
                     windex[word] = wcount++;

-                    print "<urn:linked:w" windex[word] ">", TYPE,          WORD,              ".";
-                    print "<urn:linked:w" windex[word] ">", LABEL,         "\"" word "\"",    ".";
-                    print "<urn:linked:f" windex[word] ">", TYPE,          FORM,              ".";
-                    print "<urn:linked:f" windex[word] ">", LABEL,         "\"" word "\"",    ".";
-                    print "<urn:linked:f" windex[word] ">", WRITTENREP,    "\"" word "\"",    ".";
-                    print "<urn:linked:w" windex[word] ">", CANONICALFORM, "<urn:linked:f" windex[word] ">", ".";
+                    print "<" URN "w" windex[word] ">", TYPE,          WORD,                         ".";
+                    print "<" URN "w" windex[word] ">", LABEL,         "\"" word "\"",               ".";
+                    print "<" URN "f" windex[word] ">", TYPE,          FORM,                         ".";
+                    print "<" URN "f" windex[word] ">", LABEL,         "\"" word "\"",               ".";
+                    print "<" URN "f" windex[word] ">", WRITTENREP,    "\"" word "\"",               ".";
+                    print "<" URN "w" windex[word] ">", CANONICALFORM, "<" URN "f" windex[word] ">", ".";
                 }

-                print "<urn:linked:s" sindex[isa] ">",  TYPE,      LEXICALSENSE,      ".";
-                print "<urn:linked:s" sindex[isa] ">",  LABEL,     "\"" isa "\"",     ".";
-                print "<urn:linked:s" sindex[isa] ">",  ISSENSEOF, "<urn:linked:w" windex[word] ">", ".";
-                print "<urn:linked:w" windex[word] ">", SENSE,     "<urn:linked:s" sindex[isa] ">",  ".";
+                print "<" URN "s" sindex[isa] ">",  TYPE,      LEXICALSENSE,                 ".";
+                print "<" URN "s" sindex[isa] ">",  LABEL,     "\"" isa "\"",                ".";
+                print "<" URN "s" sindex[isa] ">",  ISSENSEOF, "<" URN "w" windex[word] ">", ".";
+                print "<" URN "w" windex[word] ">", SENSE,     "<" URN "s" sindex[isa] ">",  ".";
             }

-            print "<urn:linked:s" sindex[sense] ">", BROADER,  "<urn:linked:s" sindex[isa] ">",   ".";
-            print "<urn:linked:s" sindex[isa] ">",   NARROWER, "<urn:linked:s" sindex[sense] ">", ".";
+            print "<" URN "s" sindex[sense] ">", BROADER,  "<" URN "s" sindex[isa] ">",   ".";
+            print "<" URN "s" sindex[isa] ">",   NARROWER, "<" URN "s" sindex[sense] ">", ".";
         }
     }
 }


Use a better URN

Use a better URN


Make vnode_if.awk parse vnode operations with underscores, like VOP_FOO_BAR.

Reviewed by:	kib
MFC after:	1 week


Fix typo.

Fix typo.

--- gfwlist2domainlist.awk
+++ gfwlist2domainlist.awk
@@ -80,7 +80,7 @@
 		# Remove [...]
 		gsub(/\[.*\]\+/, "", line)

-		# Remove everything from \/ in regex(/ in plaint text)
+		# Remove everything from \/ in regex(/ in plain text)
 		sub(/\\\/.*/, "", line)

 		# Replace \. to .


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

--- scripts/deltadot.awk
+++ scripts/deltadot.awk
@@ -30,11 +30,10 @@

 # associate the count with an edge
 function parse(str, arr){
-    # split(str, a, "(")  # can't count on label being paren-free anymore
-    # arr[a[1]] = substr(a[2], 1, index(a[2], ")")-1)
-    n = index($0, / [(][[:digit:]]*[)]>];$/)
+    # can't count on label being paren-free anymore
+    n = match($0, / [(][[:digit:]]*[)]>];$/)
     if(n>0)
-        arr[substr($0,1,n)] = substr($0, n+2, length($0)-4)
+        arr[substr($0,1,n)] = substr($0, n+2, length($0)-n-5)
 }

 # strip metadata from filename
@@ -46,11 +45,11 @@
 BEGIN { NOCOUNTS=0}

 # collect the edges from both files
-NR==FNR && / -> / {
+NR==FNR && /^[^ ]+ -> [^ ]+ / {
 	label1 = FILENAME;
 	parse($0, edge1)
 }
-NR!=FNR && / -> / {
+NR!=FNR && /^[^ ]+ -> [^ ]+ / {
 	label2 = FILENAME;
 	parse($0, edge2)
 }
@@ -71,7 +70,9 @@
 			delete edge2[e]
 		}
 	}
-	for(e in edge2) edges[e "(" edge2[e] ")\", color=\"blue\"];"];
+	# only edges not in first file
+	for(e in edge2)
+		edges[e "(" edge2[e] ")>, color=\"blue\"];"];

 	print "digraph {"
 	print "rankdir=LR;"


Help: fix reference table

Help: fix reference table

--- include/Help.awk
+++ include/Help.awk
@@ -213,7 +213,7 @@
     for (code in Locale)
         if (Locale[code]["support"] != "unstable")
             num++
-    rows = int(num / 3) + 1
+    rows = int(num / 3) + (num % 3 ? 1 : 0)
     cols[0][0] = cols[1][0] = cols[2][0] = NULLSTR
     i = 0
     saveSortedIn = PROCINFO["sorted_in"]


Shorten length of dateType string

Shorten length of dateType string

--- getBBoxCatalogFrom-sitemap.awk
+++ getBBoxCatalogFrom-sitemap.awk
@@ -108,9 +108,12 @@

 # Grab originalDate
 # <originalAirDate>1978-03-25</originalAirDate>
+# <originalPremiereDate>1978-01-08</originalPremiereDate>
+# <originalReleaseDate>2017-12-25</originalReleaseDate>
 /<original.*Date>/ {
     split ($0,fld,"[<>]")
     dateType = fld[2]
+    sub (/original/,"",dateType)
     originalDate = fld[3]
     # print "dateType = " dateType
     # print "originalDate = " originalDate


update ext/mwg_pp.awk

update ext/mwg_pp.awk

--- ext/mwg_pp.awk
+++ ext/mwg_pp.awk
@@ -2,88 +2,88 @@

 # 20120726 行番号出力機能 (例: '#line 12 a.cpp')

-function awk_getfiledir(_ret){
-  _ret=m_lineno_cfile;
-  sub(/[^\/\\]+$/,"",_ret);
-  if(_ret=="/")return "/";
-  sub(/[\/\\]$/,"",_ret);
-  return _ret
-}
-
-function print_error(title,msg){
+function awk_getfiledir(_ret) {
+  _ret = m_lineno_cfile;
+  sub(/[^\/\\]+$/, "", _ret);
+  if (_ret == "/") return "/";
+  sub(/[\/\\]$/, "", _ret);
+  return _ret;
+}
+
+function print_error(title, msg) {
   global_errorCount++;
-  print "\33[1;31m" title "!\33[m " msg > "/dev/stderr"
-}
-
-function trim(text){
-  #gsub(/^[ \t]+|[ \t]+$/,"",text);
-  gsub(/^[[:space:]]+|[[:space:]]+$/,"",text);
-  return text
-}
-
-function slice(text,start,end, _l){
-  _l=length(text);
-  if(start<0)start+=_l;
-  end=end==null?_l: end<0?end+_l: end;
-
-  return substr(text,start+1,end-start);
-}
-
-#function head_token(text,ret,  _i,_l){
-#  _i=match(text,/[^-a-zA-Z\:0-9_]/);
-#  _l=_i?_i-1:length(text);
-#  ret[0]=trim(substr(text,1,_l));
-#  ret[1]=trim(substr(text,_l+1));
+  print "\33[1;31m" title "!\33[m " msg > "/dev/stderr";
+}
+
+function trim(text) {
+  #gsub(/^[ \t]+|[ \t]+$/, "", text);
+  gsub(/^[[:space:]]+|[[:space:]]+$/, "", text);
+  return text;
+}
+
+function slice(text, start, end, _l) {
+  _l = length(text);
+  if (start < 0) start += _l;
+  end = end == null ? _l : end < 0 ? end + _l : end;
+
+  return substr(text, start + 1, end - start);
+}
+
+#function head_token(text, ret, _, _i, _l) {
+#  _i = match(text, /[^-a-zA-Z:0-9_]/);
+#  _l = _i ? _i - 1 : length(text);
+#  ret[0] = trim(substr(text, 1, _l));
+#  ret[1] = trim(substr(text, _l + 1));
 #}

 #-------------------------------------------------------------------------------
-function unescape(text, _ret,_capt){
-  _ret="";
-  while(match(text,/\\(.)/,_capt)>0){
-    _ret=_ret substr(text,1,RSTART-1) _capt[1];
-    text=substr(text,RSTART+RLENGTH);
+function unescape(text, _, _ret, _capt) {
+  _ret = "";
+  while (match(text, /\\(.)/, _capt) > 0) {
+    _ret = _ret substr(text, 1, RSTART - 1) _capt[1];
+    text = substr(text, RSTART + RLENGTH);
   }
   return _ret text;
 }

 #-------------------------------------------------------------------------------
 # replace
-function replace(text,before,after, _is_tmpl,_is_head,_captures,_rep,_ltext,_rtext){
-  _is_tmpl=(match(after,/\$[0-9]+/)>0);
-  _is_head=(substr(before,1,1)=="^");
-
-  _ret="";
-  while(match(text,before,_captures)>0){
-    _ltext=substr(text,1,RSTART-1);
-    _rtext=substr(text,RSTART+RLENGTH);
-
-    _rep=_is_tmpl?rep_instantiate_tmpl(after,_captures):after;
-
-    _ret=_ret _ltext _rep;
-    text=_rtext;
-
-    if(_is_head)break;
-    if(RLENGTH==0){
-      _ret=_ret substr(text,1,1);
-      text=substr(text,2);
-      if(length(text)==0)break;
+function replace(text, before, after, _is_tmpl, _is_head, _captures, _rep, _ltext, _rtext) {
+  _is_tmpl = (match(after, /\$[0-9]+/) > 0);
+  _is_head = (substr(before, 1, 1) == "^");
+
+  _ret = "";
+  while (match(text, before, _captures) > 0) {
+    _ltext = substr(text, 1, RSTART - 1);
+    _rtext = substr(text, RSTART + RLENGTH);
+
+    _rep = _is_tmpl ? rep_instantiate_tmpl(after, _captures) : after;
+
+    _ret = _ret _ltext _rep;
+    text = _rtext;
+
+    if (_is_head) break;
+    if (RLENGTH == 0) {
+      _ret = _ret substr(text, 1, 1);
+      text = substr(text, 2);
+      if (length(text) == 0) break;
     }
   }
   return _ret text;
 }
-function rep_instantiate_tmpl(text,captures,  _ret,_num,_insert){
-  _ret="";
-  while(match(text,/\\(.)|\$([0-9]+)/,_num)){
-    #print "dbg: $ captured: RSTART=" RSTART "; num=" _num[1] "; captures[num]=" captures[_num[1]] > "/dev/stderr"
-    if(_num[2]!=""){
-      _insert=captures[_num[2]];
-    }else if(_num[1]~/^[$\\]$/){
-      _insert=_num[1];
-    }else{
-      _insert=_num[0];
-    }
-    _ret=_ret substr(text,1,RSTART-1) _insert;
-    text=substr(text,RSTART+RLENGTH);
+function rep_instantiate_tmpl(text, captures, _, _ret, _num, _insert) {
+  _ret = "";
+  while (match(text, /\\(.)|\$([0-9]+)/, _num)) {
+    #print "dbg: $ captured: RSTART = " RSTART "; num = " _num[1] "; captures[num] = " captures[_num[1]] > "/dev/stderr"
+    if (_num[2] != "") {
+      _insert = captures[_num[2]];
+    } else if (_num[1] ~ /^[$\\]$/) {
+      _insert = _num[1];
+    } else {
+      _insert = _num[0];
+    }
+    _ret = _ret substr(text, 1, RSTART - 1) _insert;
+    text = substr(text, RSTART + RLENGTH);
   }
   return _ret text;
 }
@@ -874,250 +874,250 @@
 #===============================================================================
 #  Parameter Expansion
 #-------------------------------------------------------------------------------
-function inline_expand(text, _ret,_ltext,_rtext,_mtext,_name,_r,_s,_a,_caps){
-  _ret="";
-  while(match(text,/\${([^{}]|\\.)+}|\$"([^"]|\\.)+"/)>0){
-    _ltext=substr(text,1,RSTART-1);
-    _mtext=substr(text,RSTART,RLENGTH);
-    _rtext=substr(text,RSTART+RLENGTH);
-    _name=unescape(slice(_mtext,2,-1));
-    if(match(_name,/^[-a-zA-Z0-9_]+$/)>0){                     # ${key}
-      _r="" d_data[_name];
-    }else if(match(_name,/^[-a-zA-Z0-9_]+\:-/)>0){             # ${key:-alter}
-      _s["key"]=slice(_name,0,RLENGTH-2);
-      _s["alter"]=slice(_name,RLENGTH);
-      _r="" d_data[_s["key"]];
-      if(_r=="")_r=_s["alter"];
-    }else if(match(_name,/^[-a-zA-Z0-9_]+\:\+/)>0){            # ${key:+value}
-      _s["key"]=slice(_name,0,RLENGTH-2);
-      _s["value"]=slice(_name,RLENGTH);
-      _r="" d_data[_s["key"]];
-      _r=_r==""?"":_s["value"];
-    }else if(match(_name,/^[-a-zA-Z0-9_]+\:\?/)>0){            # ${key:?warn}
-      _s["key"]=slice(_name,0,RLENGTH-2);
-      _s["warn"]=slice(_name,RLENGTH);
-      _r="" d_data[_s["key"]];
-      if(_r==""){
+function inline_expand(text, _, _ret, _ltext, _rtext, _mtext, _name, _r, _s, _a, _caps) {
+  _ret = "";
+  while (match(text, /\${([^{}]|\\.)+}|\$"([^"]|\\.)+"/) > 0) {
+    _ltext = substr(text, 1, RSTART - 1);
+    _mtext = substr(text, RSTART, RLENGTH);
+    _rtext = substr(text, RSTART + RLENGTH);
+    _name = unescape(slice(_mtext, 2, -1));
+    if (match(_name, /^[-a-zA-Z0-9_]+$/) > 0) {                     # ${key}
+      _r = "" d_data[_name];
+    } else if (match(_name, /^[-a-zA-Z0-9_]+:-/) > 0) {             # ${key:-alter}
+      _s["key"] = slice(_name, 0, RLENGTH - 2);
+      _s["alter"] = slice(_name, RLENGTH);
+      _r = "" d_data[_s["key"]];
+      if (_r == "") _r = _s["alter"];
+    } else if (match(_name, /^[-a-zA-Z0-9_]+:\+/) > 0) {            # ${key:+value}
+      _s["key"] = slice(_name, 0, RLENGTH - 2);
+      _s["value"] = slice(_name, RLENGTH);
+      _r = "" d_data[_s["key"]];
+      _r = _r == "" ? "" : _s["value"];
+    } else if (match(_name, /^[-a-zA-Z0-9_]+:\?/) > 0) {            # ${key:?warn}
+      _s["key"] = slice(_name, 0, RLENGTH - 2);
+      _s["warn"] = slice(_name, RLENGTH);
+      _r = "" d_data[_s["key"]];
+      if (_r == "") {
         print "(parameter expansion:" _mtext ")! " _s["warn"] > "/dev/stderr"
-        _ltext=_ltext _mtext;
-        _r="";
-      }
-    }else if(match(_name,/^([-a-zA-Z0-9_]+)\:([0-9]+)\:([0-9]+)$/,_caps)>0){ # ${key:start:length}
-      _r=substr(d_data[_caps[1]],_caps[2]+1,_caps[3]);
-    }else if(match(_name,/^([-a-zA-Z0-9_]+)(\/\/?)(([^/]|\\.)+)\/(.*)$/,_caps)>0){ # ${key/before/after}
-      _r=d_data[_caps[1]];
-      if(_caps[3]=="/")
-        sub(_caps[3],_caps[5],_r);
+        _ltext = _ltext _mtext;
+        _r = "";
+      }
+    } else if (match(_name, /^([-a-zA-Z0-9_]+):([0-9]+):([0-9]+)$/, _caps) > 0) { # ${key:start:length}
+      _r = substr(d_data[_caps[1]], _caps[2] + 1, _caps[3]);
+    } else if (match(_name, /^([-a-zA-Z0-9_]+)(\/\/?)(([^/]|\\.)+)\/(.*)$/, _caps) > 0) { # ${key/before/after}
+      _r = d_data[_caps[1]];
+      if (_caps[3] == "/")
+        sub(_caps[3], _caps[5], _r);
       else
-        gsub(_caps[3],_caps[5],_r);
-    }else if(match(_name,/^([-a-zA-Z0-9_]+)(##?|%%?)(.+)$/,_caps)>0){ # ${key#head} ${key%tail}
-      if(length(_caps[2])==2){
+        gsub(_caps[3], _caps[5], _r);
+    } else if (match(_name, /^([-a-zA-Z0-9_]+)(##?|%%?)(.+)$/, _caps) > 0) { # ${key#head} ${key%tail}
+      if (length(_caps[2]) == 2) {
         # TODO
-        gsub(/\./,/\./,_caps[3]);
-        gsub(/\*/,/.+/,_caps[3]);
-        gsub(/\?/,/./,_caps[3]);
-      }
-      if(_caps[2]=="#"||_caps[2]=="##"){
-        _caps[3]="^" _caps[3];
-      }else{
-        _caps[3]=_caps[3] "$";
-      }
-
-      _r=d_data[_caps[1]];
-      sub(_caps[3],"",_r);
-    }else if(match(_name,/^\#[-a-zA-Z0-9_]+$/)>0){             # ${#key}
-      _r=length("" d_data[substr(_name,2)]);
-    }else if(match(_name,/^([-a-zA-Z0-9_]+)(\..+)$/,_caps)>0){ # ${key.modifiers}
-      _r=modify_text(d_data[_caps[1]],_caps[2]);
-    }else if(match(_name,/^\.[-a-zA-Z0-9_]+./)>0){             # ${.function:args...}
-      match(_name,/^\.[-a-zA-Z0-9_]+./);
-      _s["i"]=RLENGTH;
-      _s["func"]=substr(_name,2,_s["i"]-2);
-      _s["sep"] =substr(_name,_s["i"],1);
-      _s["args"]=substr(_name,_s["i"]+1);
-      _s["argc"]=split(_s["args"],_a,_s["sep"]);
-      if(_s["func"]=="for"&&_s["argc"]==5){
-        _r=inline_function_for(_a);
-      }else if(_s["func"]=="sep_for"&&_s["argc"]==5){
-        _r=inline_function_sepfor(_a);
-      }else if(_s["func"]=="for_sep"&&_s["argc"]==5){
-        _r=inline_function_forsep(_a);
-      }else if(_s["func"]=="eval"&&_s["argc"]==1){
-        _r=inline_function_eval(_a);
-      }else{
-        print "(parameter function:" _s["func"] ")! unrecognized function." > "/dev/stderr"
-        _r=_mtext;
-      }
-    }else{
-      print "(parameter expansion:" _mtext ")! unrecognized expansion." > "/dev/stderr"
-      _r=_mtext;
-    }
-
-    if(_mtext ~ /^\${/){
+        gsub(/\./, /\./, _caps[3]);
+        gsub(/\*/, /.+/, _caps[3]);
+        gsub(/\?/, /./, _caps[3]);
+      }
+      if (_caps[2] == "#" || _caps[2] == "##") {
+        _caps[3] = "^" _caps[3];
+      } else {
+        _caps[3] = _caps[3] "$";
+      }
+
+      _r = d_data[_caps[1]];
+      sub(_caps[3], "", _r);
+    } else if (match(_name, /^#[-a-zA-Z0-9_]+$/) > 0) {             # ${#key}
+      _r = length("" d_data[substr(_name, 2)]);
+    } else if (match(_name, /^([-a-zA-Z0-9_]+)(\..+)$/, _caps) > 0) { # ${key.modifiers}
+      _r = modify_text(d_data[_caps[1]], _caps[2]);
+    } else if (match(_name, /^\.[-a-zA-Z0-9_]+./) > 0) {             # ${.function:args...}
+      match(_name, /^\.[-a-zA-Z0-9_]+./);
+      _s["i"] = RLENGTH;
+      _s["func"] = substr(_name, 2, _s["i"] - 2);
+      _s["sep"] =substr(_name, _s["i"], 1);
+      _s["args"] = substr(_name, _s["i"] + 1);
+      _s["argc"] = split(_s["args"], _a, _s["sep"]);
+      if (_s["func"] == "for" && _s["argc"] == 5) {
+        _r = inline_function_for(_a);
+      } else if (_s["func"] == "sep_for" && _s["argc"] == 5) {
+        _r = inline_function_sepfor(_a);
+      } else if (_s["func"] == "for_sep" && _s["argc"] == 5) {
+        _r = inline_function_forsep(_a);
+      } else if (_s["func"] == "eval" && _s["argc"] == 1) {
+        _r = inline_function_eval(_a);
+      } else {
+        print "(parameter function:" _s["func"] ")! unrecognized function." > "/dev/stderr";
+        _r = _mtext;
+      }
+    } else {
+      print "(parameter expansion:" _mtext ")! unrecognized expansion." > "/dev/stderr";
+      _r = _mtext;
+    }
+
+    if (_mtext ~ /^\${/) {
       # enable re-expansion ${}
-      _ret=_ret _ltext;
-      text=_r _rtext;
-    }else{
+      _ret = _ret _ltext;
+      text = _r _rtext;
+    } else {
       # disable re-expansion $""
-      _ret=_ret _ltext _r;
-      text=_rtext;
+      _ret = _ret _ltext _r;
+      text = _rtext;
     }
   }
   return _ret text;
 }

-function inline_function_forsep(args,  _r,_sep){
-  _sep=args[5];
-  _r=inline_function_for(args);
-  return _r==""?"":_r _sep;
-}
-function inline_function_sepfor(args,  _r,_sep){
-  _sep=args[5];
-  _r=inline_function_for(args);
-  return _r==""?"":_sep _r;
-}
-function inline_function_for(args, _rex_i,_i0,_iM,_field,_sep,_i,_r,_t){
+function inline_function_forsep(args, _, _r, _sep) {
+  _sep = args[5];
+  _r = inline_function_for(args);
+  return _r == "" ? "" : _r _sep;
+}
+function inline_function_sepfor(args, _, _r, _sep) {
+  _sep = args[5];
+  _r = inline_function_for(args);
+  return _r == "" ? "" : _sep _r;
+}
+function inline_function_for(args, _, _rex_i, _i0, _iM, _field, _sep, _i, _r, _t) {
   # ${for:%i%:1:9:typename A%i%:,}
-  _rex_i=args[1];
-  _i0=int(eval_expr(args[2]));
-  _iM=int(eval_expr(args[3]));
-  _field=args[4];
-  _sep=args[5];
-
-  _r="";
-  for(_i=_i0;_i<_iM;_i++){
-    _t=_field;
-    gsub(_rex_i,_i,_t);
-    _r=_i==_i0?_t:_r _sep _t;
+  _rex_i = args[1];
+  _i0 = int(eval_expr(args[2]));
+  _iM = int(eval_expr(args[3]));
+  _field = args[4];
+  _sep = args[5];
+
+  _r = "";
+  for (_i = _i0; _i < _iM; _i++) {
+    _t = _field;
+    gsub(_rex_i, _i, _t);
+    _r = _i == _i0?_t:_r _sep _t;
   }
   return _r;
 }
-function inline_function_eval(args){
+function inline_function_eval(args) {
   return eval_expr(args[1]);
 }

 #===============================================================================
 #   mwg.pp text modification
 #-------------------------------------------------------------------------------
-function modify_text__replace0(text,before,after,flags){
-  if(index(flags,"R")){
-    return replace(text,before,after);
-  }else{
-    gsub(before,after,text);
+function modify_text__replace0(text, before, after, flags) {
+  if (index(flags, "R")) {
+    return replace(text, before, after);
+  } else {
+    gsub(before, after, text);
     return text;
   }
 }

-function modify_text__replace(content,before,after,flags){
-  if(index(flags,"m")){
-    _jlen=split(content,_lines,"\n");
-    content=modify_text__replace0(_lines[1],before,after,flags);
-    #print_error("mwg_pp(modify_text)","replace('" _lines[1] "','" before "','" after "') = '" content "'");
-    for(_j=1;_j<_jlen;_j++)
-      content=content "\n" modify_text__replace0(_lines[_j+1],before,after,flags);
-  }else{
-    content=modify_text__replace0(content,before,after,flags);
+function modify_text__replace(content, before, after, flags) {
+  if (index(flags, "m")) {
+    _jlen = split(content, _lines, "\n");
+    content = modify_text__replace0(_lines[1], before, after, flags);
+    #print_error("mwg_pp(modify_text)", "replace('" _lines[1] "','" before "','" after "') = '" content "'");
+    for (_j = 1; _j < _jlen; _j++)
+      content = content "\n" modify_text__replace0(_lines[_j + 1], before, after, flags);
+  } else {
+    content = modify_text__replace0(content, before, after, flags);
   }
   return content;
 }

-function modify_text(content,args, _len,_i,_m,_s,_c, _j,_jlen,_lines){
+function modify_text(content, args, _len, _i, _m, _s, _c, _j, _jlen, _lines) {
   # _len: length of args
   # _i: index in args
   # _c: current character in args
   # _m: current context mode in args
   # _s: data store

-  _m="";
-  _len=length(args);
-  for(_i=0;_i<_len;_i++){
-    _c=substr(args,_i+1,1);
+  _m = "";
+  _len = length(args);
+  for (_i = 0; _i < _len; _i++) {
+    _c = substr(args, _i + 1, 1);
     #-------------------------------------------------
-    if(_m=="c"){
-      if(_c=="r"||_c=="R"){
-        _m="r0";
-        _s["flags"]=_c=="R"?_c:"";
-        _s["sep"]="";
-        _s["rep_before"]="";
-        _s["rep_after"]="";
-      }else if(_c=="f"){
-        _m="f0";
-        _s["sep"]="";
-        _s["for_var"]="";
-        _s["for_begin"]="";
-        _s["for_end"]="";
-      }else if(_c=="i"){
-        content=inline_expand(content);
-        _m="";
-      }else{
+    if (_m == "c") {
+      if (_c == "r" || _c == "R") {
+        _m = "r0";
+        _s["flags"] = _c == "R"?_c:"";
+        _s["sep"] = "";
+        _s["rep_before"] = "";
+        _s["rep_after"] = "";
+      } else if (_c == "f") {
+        _m = "f0";
+        _s["sep"] = "";
+        _s["for_var"] = "";
+        _s["for_begin"] = "";
+        _s["for_end"] = "";
+      } else if (_c == "i") {
+        content = inline_expand(content);
+        _m = "";
+      } else {
         print "unrecognized expand fun '" _c "'" > "/dev/stderr"
       }
     #-------------------------------------------------
     # r, R: replace
-    }else if(_m=="r0"){
-      _s["sep"]=_c;
-      _m="r1";
-    }else if(_m=="r1"){
-      if(_c==_s["sep"]){
-        _m="r2";
-      }else{
-        _s["rep_before"]=_s["rep_before"] _c;
-      }
-    }else if(_m=="r2"){
-      if(_c==_s["sep"]){
+    } else if (_m == "r0") {
+      _s["sep"] = _c;
+      _m = "r1";
+    } else if (_m == "r1") {
+      if (_c == _s["sep"]) {
+        _m = "r2";
+      } else {
+        _s["rep_before"] = _s["rep_before"] _c;
+      }
+    } else if (_m == "r2") {
+      if (_c == _s["sep"]) {

         # check flag m
-        _c=substr(args,_i+2,1);
-        if(_c=="m"){
-          _s["flags"]=_s["flags"] "m";
+        _c = substr(args, _i + 2, 1);
+        if (_c == "m") {
+          _s["flags"] = _s["flags"] "m";
           _i++;
         }

-        content=modify_text__replace(content,_s["rep_before"],_s["rep_after"],_s["flags"]);
-        _m="";
-      }else{
-        _s["rep_after"]=_s["rep_after"] _c;
+        content = modify_text__replace(content, _s["rep_before"], _s["rep_after"], _s["flags"]);
+        _m = "";
+      } else {
+        _s["rep_after"] = _s["rep_after"] _c;
       }
     #-------------------------------------------------
     # f: for
-    }else if(_m=="f0"){
-      _s["sep"]=_c;
-      _m="f1";
-    }else if(_m=="f1"){
-      if(_c!=_s["sep"]){
-        _s["for_var"]=_s["for_var"] _c;
-      }else{
-        _m="f2";
-      }
-    }else if(_m=="f2"){
-      if(_c!=_s["sep"]){
-        _s["for_begin"]=_s["for_begin"] _c;
-      }else{
-        _s["for_begin"]=int(eval_expr(_s["for_begin"]));
-        _m="f3";
-      }
-    }else if(_m=="f3"){
-      if(_c!=_s["sep"]){
-        _s["for_end"]=_s["for_end"] _c;
-      }else{
-        _s["for_end"]=int(eval_expr(_s["for_end"]));
-        _m="";
-
-        _s["content"]=content;
-        content="";
-        for(_s["i"]=_s["for_begin"];_s["i"]<_s["for_end"];_s["i"]++){
-          _c=_s["content"];
-          gsub(_s["for_var"],_s["i"],_c);
-          content=content _c;
+    } else if (_m == "f0") {
+      _s["sep"] = _c;
+      _m = "f1";
+    } else if (_m == "f1") {
+      if (_c != _s["sep"]) {
+        _s["for_var"] = _s["for_var"] _c;
+      } else {
+        _m = "f2";
+      }
+    } else if (_m == "f2") {
+      if (_c != _s["sep"]) {
+        _s["for_begin"] = _s["for_begin"] _c;
+      } else {
+        _s["for_begin"] = int(eval_expr(_s["for_begin"]));
+        _m = "f3";
+      }
+    } else if (_m == "f3") {
+      if (_c != _s["sep"]) {
+        _s["for_end"] = _s["for_end"] _c;
+      } else {
+        _s["for_end"] = int(eval_expr(_s["for_end"]));
+        _m = "";
+
+        _s["content"] = content;
+        content = "";
+        for (_s["i"] = _s["for_begin"]; _s["i"] < _s["for_end"]; _s["i"]++) {
+          _c = _s["content"];
+          gsub(_s["for_var"], _s["i"], _c);
+          content = content _c;
         }
       }
     #-------------------------------------------------
-    }else{
-      if(_c=="."){
-        _m="c";
-      }else if(_c ~ /[/#]/){
+    } else {
+      if (_c == ".") {
+        _m = "c";
+      } else if (_c ~ /[/#]/) {
         break;
-      }else if(_c !~ /[ \t\r\n]/){
+      } else if (_c !~ /[ \t\r\n]/) {
         print "unrecognized expand cmd '" _c  "'" > "/dev/stderr"
       }
     }
@@ -1128,73 +1128,73 @@
 #===============================================================================
 #   mwg.pp commands
 #-------------------------------------------------------------------------------
-function range_begin(cmd,arg){
+function range_begin(cmd, arg) {
   d_level++;
-  d_rstack[d_level,"c"]=cmd;
-  d_rstack[d_level,"a"]=arg;
-  d_content[d_level]="";
-  d_content[d_level,"L"]="";
-  d_content[d_level,"F"]="";
-}
-function range_end(args, _cmd,_arg,_txt,_clines,_cfiles){
-  if(d_level==0){
+  d_rstack[d_level, "c"] = cmd;
+  d_rstack[d_level, "a"] = arg;
+  d_content[d_level] = "";
+  d_content[d_level, "L"] = "";
+  d_content[d_level, "F"] = "";
+}
+function range_end(args, _cmd, _arg, _txt, _clines, _cfiles) {
+  if (d_level == 0) {
     print "mwg_pp.awk:#%}: no matching range beginning" > "/dev/stderr"
     return;
   }

   # pop data
-  _cmd=d_rstack[d_level,"c"];
-  _arg=d_rstack[d_level,"a"];
-  _txt=d_content[d_level];
-  if(m_lineno){ # 20120726
-    _clines=d_content[d_level,"L"];
-    _cfiles=d_content[d_level,"F"];
+  _cmd = d_rstack[d_level, "c"];
+  _arg = d_rstack[d_level, "a"];
+  _txt = d_content[d_level];
+  if (m_lineno) { # 20120726
+    _clines = d_content[d_level, "L"];
+    _cfiles = d_content[d_level, "F"];
   }
   d_level--;

-  if(args!="")
-    _txt=modify_text(_txt,args);
+  if (args != "")
+    _txt = modify_text(_txt, args);

   # process
-  if(_cmd=="define"){
-    d_data[_arg]=_txt;
-    if(m_lineno){ # 20120726
-      d_data[_arg,"L"]=_clines;
-      d_data[_arg,"F"]=_cfiles;
-    }
-  }else if(_cmd=="expand"||_cmd=="IF1"||_cmd=="IF4"){
-    process_multiline(_txt,_clines,_cfiles); # 20120726
-  }else if(_cmd=="none"||_cmd ~ /IF[023]/){
+  if (_cmd == "define") {
+    d_data[_arg] = _txt;
+    if (m_lineno) { # 20120726
+      d_data[_arg, "L"] = _clines;
+      d_data[_arg, "F"] = _cfiles;
+    }
+  } else if (_cmd == "expand" || _cmd == "IF1" || _cmd == "IF4") {
+    process_multiline(_txt, _clines, _cfiles); # 20120726
+  } else if (_cmd == "none" || _cmd ~ /IF[023]/) {
     # do nothing
-  }else{
+  } else {
     print "mwg_pp.awk:#%}: unknown range beginning '" _cmd " ( " _arg " )'" > "/dev/stderr"
   }
 }

-function dctv_define(args,  _cap,_name,_name2){
-  if(match(args,/^([-A-Za-z0-9_\:]+)[[:space:]]*(\([[:space:]]*)?$/,_cap)>0){
+function dctv_define(args, _, _cap, _name, _name2) {
+  if (match(args, /^([-A-Za-z0-9_:]+)[[:space:]]*(\([[:space:]]*)?$/, _cap) > 0) {
     # dctv: #%define hoge
     # dctv: #%define hoge (
-    _name=_cap[1];
-    if(_name=="end")
+    _name = _cap[1];
+    if (_name == "end")
       range_end("");
     else
-      range_begin("define",_name);
-  }else if(match(args,/^([-_\:[:alnum:]]+)[[:space:]]+([-_\:[:alnum:]]+)(.*)$/,_cap)>0){
+      range_begin("define", _name);
+  } else if (match(args, /^([-_:[:alnum:]]+)[[:space:]]+([-_:[:alnum:]]+)(.*)$/, _cap) > 0) {
     # dctv: #%define a b.mods
-    _name=_cap[1];
-    _name2=_cap[2];
-    _args=trim(_cap[3]);
-    if(_args!="")
-      d_data[_name]=modify_text(d_data[_name2],_args);
+    _name = _cap[1];
+    _name2 = _cap[2];
+    _args = trim(_cap[3]);
+    if (_args != "")
+      d_data[_name] = modify_text(d_data[_name2], _args);
     else
-      d_data[_name]=d_data[_name2];
-
-    if(m_lineno){
-      d_data[_name,"L"]=d_data[_name2,"L"];
-      d_data[_name,"F"]=d_data[_name2,"F"];
-    }
-  }else{
+      d_data[_name] = d_data[_name2];
+
+    if (m_lineno) {
+      d_data[_name, "L"] = d_data[_name2, "L"];
+      d_data[_name, "F"] = d_data[_name2, "F"];
+    }
+  } else {
     print "mwg_pp.awk:#%define: missing data name" > "/dev/stderr"
     return;
   }
@@ -1208,213 +1208,213 @@
 # IF3 出力せず !IF3  !IF3  !IF3 (else unmatched) 旧 "el0"
 # IF4 出力する !IF3  !IF3  !IF3 (else matched)   旧 "el1"

-function dctv_if(cond,  _cap){
-  gsub(/^[ \t]+|[ \t]*(\([ \t]*)?$/,"",cond);
-  if(cond!=""){
+function dctv_if(cond, _, _cap) {
+  gsub(/^[ \t]+|[ \t]*(\([ \t]*)?$/, "", cond);
+  if (cond != "") {
     #print "dbg: if( "cond " ) -> " eval_expr(cond) > "/dev/stderr"
-    if(cond=="end")
+    if (cond == "end") {
       range_end("");
-    else if(eval_expr(cond)){
+    } else if (eval_expr(cond)) {
       range_begin("IF1");
-    }else{
+    } else {
       range_begin("IF0");
     }
-  }else{
+  } else {
     print "mwg_pp.awk:#%define: missing data name" > "/dev/stderr"
     return;
   }
 }
-function dctv_elif(cond, _cmd){
-  if(d_level==0){
+function dctv_elif(cond, _cmd) {
+  if (d_level == 0) {
     print "mwg_pp.awk:#%elif: no matching if directive" > "/dev/stderr"
     return;
   }

-  _cmd=d_rstack[d_level,"c"];
-  if(_cmd ~ /IF[0-4]/){
+  _cmd = d_rstack[d_level, "c"];
+  if (_cmd ~ /IF[0-4]/) {
     range_end("");
-    if(_cmd=="IF0"){
-      if(eval_expr(cond)){
+    if (_cmd == "IF0") {
+      if (eval_expr(cond)) {
         range_begin("IF1");
-      }else{
+      } else {
         range_begin("IF0");
       }
-    }else if(_cmd ~ /IF[12]/){
+    } else if (_cmd ~ /IF[12]/) {
       range_begin("IF2");
-    }else{
+    } else {
       range_begin("IF3");
-      if(_cmd ~ /IF[34]/)
-        print_error("mwgpp:#%else","if clause have already ended!");
-    }
-  }else{
-    print_error("mwgpp:#%else","no matching if directive");
-  }
-}
-function dctv_else(  _cap,_cmd){
-  if(d_level==0){
-    print_error("mwgpp:#%else","no matching if directive");
+      if (_cmd ~ /IF[34]/)
+        print_error("mwgpp:#%else", "if clause have already ended!");
+    }
+  } else {
+    print_error("mwgpp:#%else", "no matching if directive");
+  }
+}
+function dctv_else(_, _cap, _cmd) {
+  if (d_level == 0) {
+    print_error("mwgpp:#%else", "no matching if directive");
     return;
   }

-  _cmd=d_rstack[d_level,"c"];
-  if(_cmd ~ /IF[0-4]/){
+  _cmd = d_rstack[d_level, "c"];
+  if (_cmd ~ /IF[0-4]/) {
     range_end("");
-    if(_cmd=="IF0"){
+    if (_cmd == "IF0") {
       range_begin("IF4");
-    }else{
+    } else {
       range_begin("IF3");
-      if(_cmd ~ /IF[34]/)
-        print_error("mwgpp:#%else","if clause have already ended!");
-    }
-  }else{
-    print_error("mwgpp:#%else","no matching if directive");
-  }
-}
-
-function dctv_expand(args,  _cap,_txt,_type){
-  if(match(args,/^([-a-zA-Z\:0-9_]+|[\(])(.*)$/,_cap)>0){
-    if(_cap[1]=="("){
-      _type=1;
-    }else{
-      _txt=d_data[_cap[1]];
-      _txt=modify_text(_txt,_cap[2]);
-      process_multiline(_txt,d_data[_cap[1],"L"],d_data[_cap[1],"F"]);
-    }
-  }else if(match(args,/^[[:space:]]*$/)>0){
-    _type=1;
-  }else{
+      if (_cmd ~ /IF[34]/)
+        print_error("mwgpp:#%else", "if clause have already ended!");
+    }
+  } else {
+    print_error("mwgpp:#%else", "no matching if directive");
+  }
+}
+
+function dctv_expand(args, _, _cap, _txt, _type) {
+  if (match(args, /^([-a-zA-Z:0-9_]+|[\(])(.*)$/, _cap) > 0) {
+    if (_cap[1] == "(") {
+      _type = 1;
+    } else {
+      _txt = d_data[_cap[1]];
+      _txt = modify_text(_txt, _cap[2]);
+      process_multiline(_txt, d_data[_cap[1], "L"], d_data[_cap[1], "F"]);
+    }
+  } else if (match(args, /^[[:space:]]*$/) > 0) {
+    _type = 1;
+  } else {
     print "mwg_pp.awk:#%expand: missing data name" > "/dev/stderr"
     return;
   }

-  if(_type==1){
+  if (_type == 1) {
     # begin expand
-    range_begin("expand",_cap[2]); # _cap[2] not used
-  }
-}
-
-function dctv_modify(args,  _i,_len,_name,_content){
-  _i=match(args,/[^-a-zA-Z\:0-9_]/);
-  _len=_i?_i-1:length(args);
-  _name=substr(args,1,_len);
-  args=trim(substr(args,_len+1));
-
-  d_data[_name]=modify_text(d_data[_name],args);
-}
-
-function include_file(file, _line,_lines,_i,_n,_dir,_originalFile,_originalLine){
-  if(file ~ /^<.+>$/){
-    gsub(/^<|>$/,"",file);
-    file=INCLUDE_DIRECTORY "/" file;
-  }else{
-    gsub(/^"|"$/,"",file);
-    if(file !~ /^\//){
-      _dir=awk_getfiledir();
-      if(_dir!="")file=_dir "/" file;
-    }
-  }
-
-  _n=0;
-  while((_r = getline _line < file) >0)
-    _lines[_n++]=_line;
-  if(_r<0)
+    range_begin("expand", _cap[2]); # _cap[2] not used
+  }
+}
+
+function dctv_modify(args, _, _i, _len, _name, _content) {
+  _i = match(args, /[^-a-zA-Z:0-9_]/);
+  _len = _i?_i - 1:length(args);
+  _name = substr(args, 1, _len);
+  args = trim(substr(args, _len + 1));
+
+  d_data[_name] = modify_text(d_data[_name], args);
+}
+
+function include_file(file, _line, _lines, _i, _n, _dir, _originalFile, _originalLine) {
+  if (file ~ /^<.+>$/) {
+    gsub(/^<|>$/, "", file);
+    file = INCLUDE_DIRECTORY "/" file;
+  } else {
+    gsub(/^"|"$/, "", file);
+    if (file !~ /^\//) {
+      _dir = awk_getfiledir();
+      if (_dir != "") file = _dir "/" file;
+    }
+  }
+
+  _n = 0;
+  while ((_r = getline _line < file) >0)
+    _lines[_n++] = _line;
+  if (_r < 0)
     print_error("could not open the include file '" file "'");
   close(file);

   dependency_add(file);

-  _originalFile=m_lineno_cfile;
-  _originalLine=m_lineno_cline;
-  for(_i=0;_i<_n;_i++){
-    m_lineno_cfile=file; # 20120726
-    m_lineno_cline=_i+1; # 20120726
+  _originalFile = m_lineno_cfile;
+  _originalLine = m_lineno_cline;
+  for (_i = 0; _i < _n; _i++) {
+    m_lineno_cfile = file; # 20120726
+    m_lineno_cline = _i + 1; # 20120726
     process_line(_lines[_i]);
   }
-  m_lineno_cfile=_originalFile; # 2015-01-24
-  m_lineno_cline=_originalLine; # 2015-01-24
-}
-
-function dctv_error(message, _title){
-  if(m_lineno_cfile!=""||m_lineno)
-    _title=m_lineno_cfile ":" m_lineno_cline;
+  m_lineno_cfile = _originalFile; # 2015-01-24
+  m_lineno_cline = _originalLine; # 2015-01-24
+}
+
+function dctv_error(message, _title) {
+  if (m_lineno_cfile != "" || m_lineno)
+    _title = m_lineno_cfile ":" m_lineno_cline;
   else
-    _title=FILENAME;
-
-  print_error(_title,message);
+    _title = FILENAME;
+
+  print_error(_title, message);
 }

 #===============================================================================
-function data_define(pair, _sep,_i,_k,_v,_capt,_rex){
-  if(pair ~ /^[^\(_a-zA-Z0-9]/){ # #%data/name/value/
-
-    _sep="\\" substr(pair,1,1);
-    _rex="^" _sep "([^" _sep "]+)" _sep "([^" _sep "]+)" _sep
-    if(match(pair,_rex,_capt)){
-      _k=_capt[1];
-      _v=_capt[2];
-      d_data[_k]=_v;
-    }else{
-      printf("(#%%data directive)! ill-formed. (pair=%s, _rex=%s)\n",pair,_rex) > "/dev/stderr"
+function data_define(pair, _sep, _i, _k, _v, _capt, _rex) {
+  if (pair ~ /^[^\(_a-zA-Z0-9]/) { # #%data/name/value/
+
+    _sep = "\\" substr(pair, 1, 1);
+    _rex = "^" _sep "([^" _sep "]+)" _sep "([^" _sep "]+)" _sep
+    if (match(pair, _rex, _capt)) {
+      _k = _capt[1];
+      _v = _capt[2];
+      d_data[_k] = _v;
+    } else {
+      printf("(#%%data directive)! ill-formed. (pair=%s, _rex=%s)\n", pair, _rex) > "/dev/stderr"
       return 0;
     }
-  }else{ # #%data name value
+  } else { # #%data name value
     # #%data(=) name=value
-    _sep="";
-    if(match(pair,/^\([^\)]+\)/)>0){
-      _sep=substr(pair,2,RLENGTH-2);
-      pair=trim(substr(pair,RLENGTH+1));
-    }
-
-    _i=_sep!=""?index(pair,_sep):match(pair,/[ \t]/);
-    if(_i<=0){
-      printf("(#%%data directive)! ill-formed. (pair=%s, _sep=%s)\n",pair,_sep) > "/dev/stderr"
+    _sep = "";
+    if (match(pair, /^\([^\)]+\)/) > 0) {
+      _sep = substr(pair, 2, RLENGTH - 2);
+      pair = trim(substr(pair, RLENGTH + 1));
+    }
+
+    _i = _sep != ""?index(pair, _sep):match(pair, /[ \t]/);
+    if (_i <= 0) {
+      printf("(#%%data directive)! ill-formed. (pair=%s, _sep=%s)\n", pair, _sep) > "/dev/stderr"
       return 0;
     }

-    _k=substr(pair,1,_i-1);
-    _v=trim(substr(pair,_i+length(_sep)))
-    d_data[_k]=_v;
-
-    #_t[0];head_token(pair,_t);
-    #d_data[_t[0]]=_t[1];
-  }
-}
-function data_print(key){
+    _k = substr(pair, 1, _i - 1);
+    _v = trim(substr(pair, _i + length(_sep)))
+    d_data[_k] = _v;
+
+    #_t[0]; head_token(pair, _t);
+    #d_data[_t[0]] = _t[1];
+  }
+}
+function data_print(key) {
   add_line(d_data[key]);
 }
-function execute(command, _line,_caps,_n,_cfile){
-  if(match(command,/^(>>?)[[:space:]]*([^[:space:]]*)/,_caps)>0){
+function execute(command, _line, _caps, _n, _cfile) {
+  if (match(command, /^(>>?)[[:space:]]*([^[:space:]]*)/, _caps) > 0) {
     # 出力先の変更
     fflush(m_outpath);
-    m_outpath=_caps[2];
-    m_addline_cfile="";
-    if(_caps[1]==">"&&m_outpath!=""){
+    m_outpath = _caps[2];
+    m_addline_cfile = "";
+    if (_caps[1] == ">" && m_outpath != "") {
       printf("") > m_outpath
     }
-  }else{
-    _n=0;
-    while((command | getline _line)>0)
-      _lines[_n++]=_line;
+  } else {
+    _n = 0;
+    while ((command | getline _line) > 0)
+      _lines[_n++] = _line;
     close(command);

-    _cfile="$(" command ")";
-    gsub(/[\\"]/,"\\\\&",_cfile);
-    for(_i=0;_i<_n;_i++){
-      m_lineno_cfile=_cfile;
-      m_lineno_cline=_i+1;
+    _cfile = "$(" command ")";
+    gsub(/[\\"]/, "\\\\&", _cfile);
+    for (_i = 0; _i < _n; _i++) {
+      m_lineno_cfile = _cfile;
+      m_lineno_cline = _i + 1;
       process_line(_lines[_i]);
     }
   }
 }
 #===============================================================================
-function add_line(line){
-  if(d_level==0){
-    if(m_lineno){ # 20120726
-      if(m_addline_cfile!=m_lineno_cfile||++m_addline_cline!=m_lineno_cline){
-        m_addline_cline=m_lineno_cline;
-        m_addline_cfile=m_lineno_cfile;
-        if(m_addline_cline!=""&&m_addline_cfile!=""){
-          if(m_outpath=="")
+function add_line(line) {
+  if (d_level == 0) {
+    if (m_lineno) { # 20120726
+      if (m_addline_cfile != m_lineno_cfile||++m_addline_cline != m_lineno_cline) {
+        m_addline_cline = m_lineno_cline;
+        m_addline_cfile = m_lineno_cfile;
+        if (m_addline_cline != "" && m_addline_cfile != "") {
+          if (m_outpath == "")
             print "#line " m_addline_cline " \"" m_addline_cfile "\""
           else
             print "#line " m_addline_cline " \"" m_addline_cfile "\"" >> m_outpath
@@ -1422,154 +1422,154 @@
       }
     }

-    if(m_outpath=="")
+    if (m_outpath == "")
       print line
     else
       print line >> m_outpath
-  }else{
-    d_content[d_level]=d_content[d_level] line "\n"
-    d_content[d_level,"L"]=d_content[d_level,"L"] m_lineno_cline "\n";
-    d_content[d_level,"F"]=d_content[d_level,"F"] m_lineno_cfile "\n";
-  }
-}
-
-# function process_multiline2(txt,cline,cfile, _s,_l,_f,_len,_i){
-#   _len=split(txt,_s,"\n");
-#   if(length(_s[_len])==0)_len--;
-
-#   split(clines,_l,"\n");
-#   split(cfiles,_f,"\n");
-#   for(_i=0;_i<_len;_i++){
-#     m_lineno_cline=_l[_i+1];
-#     m_lineno_cfile=_f[_i+1];
-#     process_line(_s[_i+1]);
+  } else {
+    d_content[d_level] = d_content[d_level] line "\n"
+    d_content[d_level, "L"] = d_content[d_level, "L"] m_lineno_cline "\n";
+    d_content[d_level, "F"] = d_content[d_level, "F"] m_lineno_cfile "\n";
+  }
+}
+
+# function process_multiline2(txt, cline, cfile, _s, _l, _f, _len, _i) {
+#   _len = split(txt, _s, "\n");
+#   if (length(_s[_len]) == 0) _len--;
+
+#   split(clines, _l, "\n");
+#   split(cfiles, _f, "\n");
+#   for (_i = 0; _i < _len; _i++) {
+#     m_lineno_cline = _l[_i + 1];
+#     m_lineno_cfile = _f[_i + 1];
+#     process_line(_s[_i + 1]);
 #   }
 # }

-function process_multiline(txt,clines,cfiles,  _s,_l,_f,_len,_i){
-  _len=split(txt,_s,"\n");
-  if(length(_s[_len])==0)_len--;
-
-  split(clines,_l,"\n");
-  split(cfiles,_f,"\n");
-  for(_i=0;_i<_len;_i++){
-    m_lineno_cline=_l[_i+1];
-    m_lineno_cfile=_f[_i+1];
-    process_line(_s[_i+1]);
-  }
-}
-
-function process_line(line,_line,_text,_ind,_len,_directive, _cap){
-  _line=line;
-
-  sub(/^[ \t]+/,"",_line);
-  sub(/[ \t\r]+$/,"",_line);
-  if(m_comment_cpp)
-    sub(/^\/\//,"#",_line);
-  if(m_comment_pragma)
-    sub(/^[[:space:]]*\#[[:space:]]*pragma/,"#",_line);
-  if(m_comment_c&&match(_line,/^\/\*(.+)\*\/$/,_cap)>0)
-    _line="#" _cap[1];
-
-  if(_line ~ /^#%[^%]/){
+function process_multiline(txt, clines, cfiles, _, _s, _l, _f, _len, _i) {
+  _len = split(txt, _s, "\n");
+  if (length(_s[_len]) == 0) _len--;
+
+  split(clines, _l, "\n");
+  split(cfiles, _f, "\n");
+  for (_i = 0; _i < _len; _i++) {
+    m_lineno_cline = _l[_i + 1];
+    m_lineno_cfile = _f[_i + 1];
+    process_line(_s[_i + 1]);
+  }
+}
+
+function process_line(line, _line, _text, _ind, _len, _directive, _cap) {
+  _line = line;
+
+  sub(/^[ \t]+/, "", _line);
+  sub(/[ \t\r]+$/, "", _line);
+  if (m_comment_cpp)
+    sub(/^\/\//, "#", _line);
+  if (m_comment_pragma)
+    sub(/^[[:space:]]*#[[:space:]]*pragma/, "#", _line);
+  if (m_comment_c && match(_line, /^\/\*(.+)\*\/$/, _cap) > 0)
+    _line = "#" _cap[1];
+
+  if (_line ~ /^#%[^%]/) {
     # cut directive
-    if(match(_line,/^#%[ \t]*([-a-zA-Z_0-9\:]+)(.*)$/,_cap)>0){
-      _directive=_cap[1];
-      _text=trim(_cap[2]);
-    }else if(match(_line,/^#%[ \t]*([^-a-zA-Z_0-9\:])(.*)$/,_cap)>0){
-      _directive=_cap[1];
-      _text=trim(_cap[2]);
-    }else{
+    if (match(_line, /^#%[ \t]*([-a-zA-Z_0-9:]+)(.*)$/, _cap) > 0) {
+      _directive = _cap[1];
+      _text = trim(_cap[2]);
+    } else if (match(_line, /^#%[ \t]*([^-a-zA-Z_0-9:])(.*)$/, _cap) > 0) {
+      _directive = _cap[1];
+      _text = trim(_cap[2]);
+    } else {
       print_error("unrecognized directive line: " line);
       return;
     }

     # switch directive
-    if(_directive=="("||_directive=="begin"){
-      range_begin("none",_text);
-    }else if(_directive==")"||_directive=="end"){
+    if (_directive == "(" || _directive == "begin") {
+      range_begin("none", _text);
+    } else if (_directive == ")" || _directive == "end") {
       range_end(_text);
-    }else if(_directive=="define"||_directive=="m"){
+    } else if (_directive == "define" || _directive == "m") {
       dctv_define(_text);
-    }else if(_directive=="expand"||_directive=="x"){
+    } else if (_directive == "expand" || _directive == "x") {
       dctv_expand(_text);
-    }else if(_directive=="if"){
+    } else if (_directive == "if") {
       dctv_if(_text);
-    }else if(_directive=="else"){
+    } else if (_directive == "else") {
       dctv_else(_text);
-    }else if(_directive=="elif"){
+    } else if (_directive == "elif") {
       dctv_elif(_text);
-    }else if(_directive=="modify"){ # obsoleted. use #%define name name.mods
+    } else if (_directive == "modify") { # obsoleted. use #%define name name.mods
       print_error("obsoleted directive modify");
       dctv_modify(_text);
-    }else if(_directive=="include"||_directive=="<"){
+    } else if (_directive == "include" || _directive == "<") {
       include_file(_text);
-    }else if(_directive=="data"){ # obs → データ設定に有意。残す?
+    } else if (_directive == "data") { # obs → データ設定に有意。残す?
       data_define(_text);
-    }else if(_directive=="print"){ #obs
+    } else if (_directive == "print") { #obs
       data_print(_text);
-    }else if(_directive=="eval"){
+    } else if (_directive == "eval") {
       eval_expr(_text);
-    }else if(_directive=="["&&match(_text,/^(.+)\]$/,_cap)>0){
+    } else if (_directive == "[" && match(_text, /^(.+)\]$/, _cap) > 0) {
       eval_expr(_cap[1]);
-    }else if(_directive=="exec"||_directive=="$"){
+    } else if (_directive == "exec" || _directive == "$") {
       execute(_text);
-    }else if(_directive=="#"){
+    } else if (_directive == "#") {
       # comment. just ignored.
-    }else if(_directive=="error"){
+    } else if (_directive == "error") {
       dctv_error(_text);
-    }else{
+    } else {
       print_error("unrecognized directive " _directive);
     }
-  }else if(_line ~ /^##+%/){
-    add_line(substr(_line,2));
-  }else if(_line ~ /^#%%+/){
-    add_line("#" substr(_line,3));
-  }else{
+  } else if (_line ~ /^##+%/) {
+    add_line(substr(_line, 2));
+  } else if (_line ~ /^#%%+/) {
+    add_line("#" substr(_line, 3));
+  } else {
     add_line(line);
   }
 }

 BEGIN{
-  FS="MWG_PP" "_COMMENT";
+  FS = "MWG_PP" "_COMMENT";
   ev1scan_init();
-  d_level=0;
-  d_data[0]="";
-
-  m_outpath="";
-  m_comment_c     =int(ENVIRON["PPC_C"])!=0;
-  m_comment_cpp   =int(ENVIRON["PPC_CPP"])!=0;
-  m_comment_pragma=int(ENVIRON["PPC_PRAGMA"])!=0;
-
-  m_lineno        =int(ENVIRON["PPLINENO"])!=0;
-
-  INCLUDE_DIRECTORY=ENVIRON["HOME"] "/.mwg/mwgpp/include"
-
-  m_dependency_count=0
-  m_dependency_guard[""]=1;
-  m_dependency[0]="";
+  d_level = 0;
+  d_data[0] = "";
+
+  m_outpath = "";
+  m_comment_c      = int(ENVIRON["PPC_C"]) != 0;
+  m_comment_cpp    = int(ENVIRON["PPC_CPP"]) != 0;
+  m_comment_pragma = int(ENVIRON["PPC_PRAGMA"]) != 0;
+
+  m_lineno         = int(ENVIRON["PPLINENO"]) != 0;
+
+  INCLUDE_DIRECTORY = ENVIRON["HOME"] "/.mwg/mwgpp/include"
+
+  m_dependency_count = 0
+  m_dependency_guard[""] = 1;
+  m_dependency[0] = "";
 }

 {
-  if(FNR==1){
-    if(ENVIRON["PPLINENO_FILE"]!="")
-      m_rfile=ENVIRON["PPLINENO_FILE"];
+  if (FNR == 1) {
+    if (ENVIRON["PPLINENO_FILE"] != "")
+      m_rfile = ENVIRON["PPLINENO_FILE"];
     else
-      m_rfile=FILENAME;
+      m_rfile = FILENAME;
     dependency_add(m_rfile);
   }
-  m_lineno_cfile=m_rfile;
-  m_lineno_cline=FNR;
+  m_lineno_cfile = m_rfile;
+  m_lineno_cline = FNR;
   process_line($1);
 }

-function dependency_add(file){
-  if(!m_dependency_guard[file]){
-    m_dependency_guard[file]=1;
-    m_dependency[m_dependency_count++]=file;
-  }
-}
-function dependency_generate(output, target, is_phony, _i, _iMax, _line, _file){
+function dependency_add(file) {
+  if (!m_dependency_guard[file]) {
+    m_dependency_guard[file] = 1;
+    m_dependency[m_dependency_count++] = file;
+  }
+}
+function dependency_generate(output, target, is_phony, _i, _iMax, _line, _file) {
   if (!target) {
     target = m_rfile;
     sub(/\.pp$/, "", target);


avoid gnu extension, for installing

avoid gnu extension, for installing

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

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


The use of the public, final, and static attributes in Java interfaces is discouraged. (dm)

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

--- Bindings/Java/constants.awk
+++ Bindings/Java/constants.awk
@@ -104,7 +104,7 @@

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

 function writeJavadocComment(text) {


Languages: add Western Frisian language

Languages: add Western Frisian language

--- include/Languages.awk
+++ include/Languages.awk
@@ -406,6 +406,19 @@
     Locale["wo"]["iso"]                = "wol"
     Locale["wo"]["glotto"]             = "wolo1247"
     Locale["wo"]["script"]             = "Latn"
+
+    #? Western Frisian
+    Locale["fy"]["name"]               = "Western Frisian"
+    Locale["fy"]["endonym"]            = "Frysk"
+    #Locale["fy"]["translations-of"]
+    #Locale["fy"]["definitions-of"]
+    #Locale["fy"]["synonyms"]
+    #Locale["fy"]["examples"]
+    #Locale["fy"]["see-also"]
+    Locale["fy"]["family"]             = "Indo-European"
+    Locale["fy"]["iso"]                = "fry"
+    Locale["fy"]["glotto"]             = "west2354"
+    Locale["fy"]["script"]             = "Latn"

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


fill array with null string for each element in altTranslations[] (fix #31)

--- include/Translate.awk
+++ include/Translate.awk
@@ -129,8 +129,10 @@
         if (match(i, "^0" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "2" SUBSEP "([[:digit:]]+)" SUBSEP "1" SUBSEP "([[:digit:]]+)$", group))
             words[group[1]][group[2]]["1"][group[3]] = literal(ast[i])

-        if (match(i, "^0" SUBSEP "5" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group))
+        if (match(i, "^0" SUBSEP "5" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group)) {
             segments[group[1]] = literal(ast[i])
+            altTranslations[group[1]][0] = ""
+        }

         if (match(i, "^0" SUBSEP "5" SUBSEP "([[:digit:]]+)" SUBSEP "2" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group))
             altTranslations[group[1]][group[2]] = postprocess(literal(ast[i]))


read environment variable USER_AGENT

read environment variable USER_AGENT

--- include/Main.awk
+++ include/Main.awk
@@ -55,7 +55,7 @@
     Option["player"] = ENVIRON["PLAYER"]

     Option["proxy"] = ENVIRON["HTTP_PROXY"] ? ENVIRON["HTTP_PROXY"] : ENVIRON["http_proxy"]
-    Option["user-agent"] = NULLSTR
+    Option["user-agent"] = ENVIRON["USER_AGENT"]

     Option["interactive"] = 0
     Option["no-rlwrap"] = 0


Languages: add Oromo language

Languages: add Oromo language

--- include/Languages.awk
+++ include/Languages.awk
@@ -208,6 +208,19 @@
     Locale["oc"]["iso"]                = "oci"
     Locale["oc"]["glotto"]             = "occi1239"
     Locale["oc"]["script"]             = "Latn"
+
+    #? Oromo
+    Locale["om"]["name"]               = "Oromo"
+    Locale["om"]["endonym"]            = "Afaan Oromoo"
+    #Locale["om"]["translations-of"]
+    #Locale["om"]["definitions-of"]
+    #Locale["om"]["synonyms"]
+    #Locale["om"]["examples"]
+    #Locale["om"]["see-also"]
+    Locale["om"]["family"]             = "Afro-Asiatic"
+    Locale["om"]["iso"]                = "orm"
+    Locale["om"]["glotto"]             = "nucl1736"
+    Locale["om"]["script"]             = "Latn"

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


Seriosly, drop very large synsets

Seriosly, drop very large synsets

--- impl/delabel.awk
+++ impl/delabel.awk
@@ -5,7 +5,11 @@
 {
     gsub("(#[[:digit:]]+|, $)", "");

-    for (i = 1; i <= split($3, words, ", "); i++) uniq[words[i]];
+    len = split($3, words, ", ");
+
+    if (len >= 10000) next;
+
+    for (i = 1; i <= len; i++) uniq[words[i]];

     for (word in uniq) {
         synset = synset sep word;


md.awk: fix code handling

md.awk: fix code handling


No need to initialize the domain_count as the variables of numbers in awk are 0 as default.

--- gfwlist2dnsmasq.awk
+++ gfwlist2dnsmasq.awk
@@ -56,8 +56,6 @@
 	if (port == "") {
 		port = 5353
 	}
-
-	domain_count = 0
 }
 {
 	original_line = $0


support for code

support for code


checkpoint, mucking out old curie exceptions & adding new ones

--- scripts/ntriple2dot.awk
+++ scripts/ntriple2dot.awk
@@ -105,7 +105,13 @@
 	# exceptions
 	prefix["BNODE"]="BNODE"  # is a fixed point
 	prefix["https://monarchinitiative.org/.well-known/genid"]="BNODE"
-	prefix["https_archive_monarchinitiative_org_"]="MonarchArchive"
+	prefix["https://archive.monarchinitiative.org/"]="MonarchArchive"
+	############################################################
+	# not expected to be added to curie map
+	# in HPOA
+	prefix["http://www.ncbi.nlm.nih.gov/bookshelf/br.fcgi?book=gene&part="]="NCBIBook"
+	prefix["http://www.ncbi.nlm.nih.gov/books/NBK"]="NCBINBK"
+
 	############################################################
 	# Often re-visit whether these exceptions are still necessary
 	# they may have been moved into the curie prefix mapping file
@@ -114,7 +120,7 @@

 	# in mgi
 	prefix["https://www.mousephenotype.org"]="IMPC"
-	# in IMPC (not httpS)
+	# in IMPC (not httpS  --- hmm all three IRI exist)
 	prefix["http://www.mousephenotype.org"]="IMPC"
 	# note in curie_map IMPC is:
 	# http://www.mousephenotype.org/data/genes/
@@ -124,19 +130,14 @@
 	# note in curie_map WormBase is
 	# 'https://www.wormbase.org/get?name='

-	# in GWAScatalog
-	prefix["http://www.ncbi.nlm.nih.gov/SNP/"]="dbSNP"
-	# note in curie_map dbSNP is
-	# 'http://www.ncbi.nlm.nih.gov/projects/SNP/snp_ref.cgi?rs='
-
-	# Ensembl  transient
-	prefix["http://identifiers.org/ensembl/"]="ENSEMBL"
-	# various, transient
+	# various, transient?
     prefix["http://www.ncbi.nlm.nih.gov/gene/"]="NCBIGene"
+    prefix["http://www.ncbi.nlm.nih.gov/genome/"]="NCBIGenome"
+    prefix["http://www.ncbi.nlm.nih.gov/assembly?term="]="NCBIAssembly"
 	# kegg
-	prefix["http://identifiers.org/ec-code/"]="EC"
-	# ensembl
-	prefix["http://identifiers.org/hgnc/HGNC:"]="HGNC"
+	prefix["http://www.genome.jp/kegg/pathway/map/map"]="KEGG-img"
+	# in EOM
+	prefix['https://elementsofmorphology.nih.gov/images/terms/']="EOM_IMG"

 	# playing with the idea of a LOCAL identifier
     # not the same as a bnode in that tools won't rewrite identifier


Update generate_netbsd_ioctls.awk for NetBSD 8.99.25

Add dynamic detection of header files in /usr/include.
Handle "nvlist_ref_t" needed by npf(4) ioctl(2) operations.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@345715 91177308-0d34-0410-b5e6-96231b3b80d8

--- utils/generate_netbsd_ioctls.awk
+++ utils/generate_netbsd_ioctls.awk
@@ -44,133 +44,13 @@
     rootdir = ENVIRON["ROOTDIR"]
   }

-  # hardcode list of headers with ioctl(2) entries
-  # List generated manually with the following script:
-  #   for w in `find /usr/include/ -type f -name '*.h' -exec echo {} \;`; \
-  #   do awk '/[^a-zA-Z0-9_]_IO[W]*[R]*[ ]*\(/ && $2 ~ /^[A-Z_]+$/ {got=1} END{if(got) {print ARGV[1]}}' $w; \
-  #   done|awk '{print "  ARGV[ARGC++] = rootdir \"" substr($0, 14) "\""}'
-
-  ARGV[ARGC++] = rootdir "altq/altq_afmap.h"
-  ARGV[ARGC++] = rootdir "altq/altq.h"
-  ARGV[ARGC++] = rootdir "altq/altq_blue.h"
-  ARGV[ARGC++] = rootdir "altq/altq_cbq.h"
-  ARGV[ARGC++] = rootdir "altq/altq_cdnr.h"
-  ARGV[ARGC++] = rootdir "altq/altq_fifoq.h"
-  ARGV[ARGC++] = rootdir "altq/altq_hfsc.h"
-  ARGV[ARGC++] = rootdir "altq/altq_jobs.h"
-  ARGV[ARGC++] = rootdir "altq/altq_priq.h"
-  ARGV[ARGC++] = rootdir "altq/altq_red.h"
-  ARGV[ARGC++] = rootdir "altq/altq_rio.h"
-  ARGV[ARGC++] = rootdir "altq/altq_wfq.h"
-  ARGV[ARGC++] = rootdir "crypto/cryptodev.h"
-  ARGV[ARGC++] = rootdir "dev/apm/apmio.h"
-  ARGV[ARGC++] = rootdir "dev/dm/netbsd-dm.h"
-  ARGV[ARGC++] = rootdir "dev/dmover/dmover_io.h"
-  ARGV[ARGC++] = rootdir "dev/dtv/dtvio_demux.h"
-  ARGV[ARGC++] = rootdir "dev/dtv/dtvio_frontend.h"
-  ARGV[ARGC++] = rootdir "dev/filemon/filemon.h"
-  ARGV[ARGC++] = rootdir "dev/hdaudio/hdaudioio.h"
-  ARGV[ARGC++] = rootdir "dev/hdmicec/hdmicecio.h"
-  ARGV[ARGC++] = rootdir "dev/hpc/hpcfbio.h"
-  ARGV[ARGC++] = rootdir "dev/i2o/iopio.h"
-  ARGV[ARGC++] = rootdir "dev/ic/athioctl.h"
-  ARGV[ARGC++] = rootdir "dev/ic/bt8xx.h"
-  ARGV[ARGC++] = rootdir "dev/ic/hd44780var.h"
-  ARGV[ARGC++] = rootdir "dev/ic/icp_ioctl.h"
-  ARGV[ARGC++] = rootdir "dev/ic/isp_ioctl.h"
-  ARGV[ARGC++] = rootdir "dev/ic/mlxio.h"
-  ARGV[ARGC++] = rootdir "dev/ic/nvmeio.h"
-  ARGV[ARGC++] = rootdir "dev/ir/irdaio.h"
-  ARGV[ARGC++] = rootdir "dev/isa/satlinkio.h"
-  ARGV[ARGC++] = rootdir "dev/isa/isvio.h"
-  ARGV[ARGC++] = rootdir "dev/isa/wtreg.h"
-  ARGV[ARGC++] = rootdir "dev/iscsi/iscsi_ioctl.h"
-  ARGV[ARGC++] = rootdir "dev/ofw/openfirmio.h"
-  ARGV[ARGC++] = rootdir "dev/pci/amrio.h"
-  ARGV[ARGC++] = rootdir "dev/pci/mlyio.h"
-  ARGV[ARGC++] = rootdir "dev/pci/pciio.h"
-  ARGV[ARGC++] = rootdir "dev/pci/tweio.h"
-  ARGV[ARGC++] = rootdir "dev/pcmcia/if_cnwioctl.h"
-  ARGV[ARGC++] = rootdir "dev/pcmcia/if_rayreg.h"
-  ARGV[ARGC++] = rootdir "dev/raidframe/raidframeio.h"
-  ARGV[ARGC++] = rootdir "dev/sbus/mbppio.h"
-  ARGV[ARGC++] = rootdir "dev/scsipi/ses.h"
-  ARGV[ARGC++] = rootdir "dev/sun/disklabel.h"
-  ARGV[ARGC++] = rootdir "dev/sun/fbio.h"
-  ARGV[ARGC++] = rootdir "dev/sun/kbio.h"
-  ARGV[ARGC++] = rootdir "dev/sun/vuid_event.h"
-  ARGV[ARGC++] = rootdir "dev/tc/sticio.h"
-  ARGV[ARGC++] = rootdir "dev/usb/ukyopon.h"
-  ARGV[ARGC++] = rootdir "dev/usb/urio.h"
-  ARGV[ARGC++] = rootdir "dev/usb/usb.h"
-  ARGV[ARGC++] = rootdir "dev/usb/utoppy.h"
-  ARGV[ARGC++] = rootdir "dev/vme/xio.h"
-  ARGV[ARGC++] = rootdir "dev/wscons/wsdisplay_usl_io.h"
-  ARGV[ARGC++] = rootdir "dev/wscons/wsconsio.h"
-  ARGV[ARGC++] = rootdir "dev/biovar.h"
-  ARGV[ARGC++] = rootdir "dev/md.h"
-  ARGV[ARGC++] = rootdir "dev/ccdvar.h"
-  ARGV[ARGC++] = rootdir "dev/cgdvar.h"
-  ARGV[ARGC++] = rootdir "dev/fssvar.h"
-  ARGV[ARGC++] = rootdir "dev/bluetooth/btdev.h"
-  ARGV[ARGC++] = rootdir "dev/bluetooth/btsco.h"
-  ARGV[ARGC++] = rootdir "dev/kttcpio.h"
-  ARGV[ARGC++] = rootdir "dev/lockstat.h"
-  ARGV[ARGC++] = rootdir "dev/vndvar.h"
-  ARGV[ARGC++] = rootdir "dev/spkrio.h"
-  ARGV[ARGC++] = rootdir "net/bpf.h"
-  ARGV[ARGC++] = rootdir "net/if_atm.h"
-  ARGV[ARGC++] = rootdir "net/if_gre.h"
-  ARGV[ARGC++] = rootdir "net/if_ppp.h"
-  ARGV[ARGC++] = rootdir "net/npf.h"
-  ARGV[ARGC++] = rootdir "net/if_pppoe.h"
-  ARGV[ARGC++] = rootdir "net/if_sppp.h"
-  ARGV[ARGC++] = rootdir "net/if_srt.h"
-  ARGV[ARGC++] = rootdir "net/if_tap.h"
-  ARGV[ARGC++] = rootdir "net/if_tun.h"
-  ARGV[ARGC++] = rootdir "net/pfvar.h"
-  ARGV[ARGC++] = rootdir "net/slip.h"
-  ARGV[ARGC++] = rootdir "netbt/hci.h"
-  ARGV[ARGC++] = rootdir "netinet/ip_nat.h"
-  ARGV[ARGC++] = rootdir "netinet/ip_proxy.h"
-  ARGV[ARGC++] = rootdir "netinet6/in6_var.h"
-  ARGV[ARGC++] = rootdir "netnatm/natm.h"
-  ARGV[ARGC++] = rootdir "netsmb/smb_dev.h"
-  ARGV[ARGC++] = rootdir "sys/agpio.h"
-  ARGV[ARGC++] = rootdir "sys/audioio.h"
-  ARGV[ARGC++] = rootdir "sys/ataio.h"
-  ARGV[ARGC++] = rootdir "sys/cdio.h"
-  ARGV[ARGC++] = rootdir "sys/chio.h"
-  ARGV[ARGC++] = rootdir "sys/clockctl.h"
-  ARGV[ARGC++] = rootdir "sys/cpuio.h"
-  ARGV[ARGC++] = rootdir "sys/dkio.h"
-  ARGV[ARGC++] = rootdir "sys/drvctlio.h"
-  ARGV[ARGC++] = rootdir "sys/dvdio.h"
-  ARGV[ARGC++] = rootdir "sys/envsys.h"
-  ARGV[ARGC++] = rootdir "sys/event.h"
-  ARGV[ARGC++] = rootdir "sys/fdio.h"
-  ARGV[ARGC++] = rootdir "sys/filio.h"
-  ARGV[ARGC++] = rootdir "sys/gpio.h"
-  ARGV[ARGC++] = rootdir "sys/ioctl.h"
-  ARGV[ARGC++] = rootdir "sys/ioctl_compat.h"
-  ARGV[ARGC++] = rootdir "sys/joystick.h"
-  ARGV[ARGC++] = rootdir "sys/ksyms.h"
-  ARGV[ARGC++] = rootdir "sys/lua.h"
-  ARGV[ARGC++] = rootdir "sys/midiio.h"
-  ARGV[ARGC++] = rootdir "sys/mtio.h"
-  ARGV[ARGC++] = rootdir "sys/power.h"
-  ARGV[ARGC++] = rootdir "sys/radioio.h"
-  ARGV[ARGC++] = rootdir "sys/rndio.h"
-  ARGV[ARGC++] = rootdir "sys/scanio.h"
-  ARGV[ARGC++] = rootdir "sys/scsiio.h"
-  ARGV[ARGC++] = rootdir "sys/sockio.h"
-  ARGV[ARGC++] = rootdir "sys/timepps.h"
-  ARGV[ARGC++] = rootdir "sys/ttycom.h"
-  ARGV[ARGC++] = rootdir "sys/verified_exec.h"
-  ARGV[ARGC++] = rootdir "sys/videoio.h"
-  ARGV[ARGC++] = rootdir "sys/wdog.h"
-  ARGV[ARGC++] = rootdir "soundcard.h"
-  ARGV[ARGC++] = rootdir "xen/xenio.h"
+  # detect and register files to detect ioctl() definitions
+  ARGC = 1
+  cmd = "find " rootdir " -type f -name '*.h'"
+  while (cmd | getline) {
+    ARGV[ARGC++] = $0
+  }
+  close(cmd)

   ioctl_table_max = 0
 }
@@ -744,6 +624,8 @@
     return "struct_RF_SingleComponent_sz"
   } else if (string == "RF_ProgressInfo_t") {
     return "struct_RF_ProgressInfo_sz"
+  } else if (string == "nvlist_ref_t") {
+    return "struct_nvlist_ref_sz"
   } else {
     print "Unrecognized entry: " string
     print "Aborting"


Languages: split initLocaleAlias() and initLocaleDisplay() from initLocale()

--- include/Languages.awk
+++ include/Languages.awk
@@ -2,7 +2,7 @@
 # Languages.awk                                                    #
 ####################################################################

-# Initialize all locales supported on Google Translate.
+# Initialize all locales supported.
 # Mostly ISO 639-1 codes, with a few ISO 639-3 codes.
 # "family" : Language family (from Glottolog)
 # "iso"    : ISO 639-3 code
@@ -12,7 +12,7 @@
 #      <https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes>
 #      <https://en.wikipedia.org/wiki/ISO_15924#List_of_codes>
 #      <http://glottolog.org/>
-function initLocale(    i) {
+function initLocale() {

     #1 Afrikaans
     Locale["af"]["name"]               = "Afrikaans"
@@ -1820,11 +1820,11 @@
     Locale["emj"]["support"]           = "yandex-only"
     Locale["emj"]["name"]              = "Emoji"
     Locale["emj"]["endonym"]           = "Emoji"
-
+}
+
+# Initialize aliases of all locales supported.
+function initLocaleAlias(    i) {
     for (i in Locale) {
-        # Initialize strings for displaying endonyms of locales
-        Locale[i]["display"] = show(Locale[i]["endonym"], i)
-
         # ISO 639-3 codes as aliases
         LocaleAlias[Locale[i]["iso"]] = i

@@ -1854,6 +1854,13 @@
     LocaleAlias["tlh-Latn"] = "tlh"
     LocaleAlias["tlh-Piqd"] = "tlh-Qaak"
     # TODO: more aliases
+}
+
+# Initialize strings for displaying endonyms of all locales supported.
+function initLocaleDisplay(    i) {
+    for (i in Locale) {
+        Locale[i]["display"] = show(Locale[i]["endonym"], i)
+    }
 }

 # Get locale key by language code or alias.