From MAILER-DAEMON Mon Jun 04 15:37:53 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sbd69-0006bU-Dm
	for mharc-gawk-diffs@gnu.org; Mon, 04 Jun 2012 15:37:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42834)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sbd66-0006bF-Hc
	for gawk-diffs@gnu.org; Mon, 04 Jun 2012 15:37:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sbd64-0007Vo-Ch
	for gawk-diffs@gnu.org; Mon, 04 Jun 2012 15:37:50 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:60025)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sbd64-0007VT-8j
	for gawk-diffs@gnu.org; Mon, 04 Jun 2012 15:37:48 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1Sbd62-0005lW-OD
	for gawk-diffs@gnu.org; Mon, 04 Jun 2012 19:37:47 +0000
Date: Mon, 04 Jun 2012 19:37:47 +0000
Message-Id: <E1Sbd62-0005lW-OD@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 90813d0b1978f96589b707545a64e7a83b097432
X-Git-Newrev: a0f0d2b98fa88ef98f7c7100795869e0bad5b08d
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. a0f0d2b98fa88ef98f7c7100795869e0bad5b08d
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 04 Jun 2012 19:37:52 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  a0f0d2b98fa88ef98f7c7100795869e0bad5b08d (commit)
      from  90813d0b1978f96589b707545a64e7a83b097432 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=a0f0d2b98fa88ef98f7c7100795869e0bad5b08d

commit a0f0d2b98fa88ef98f7c7100795869e0bad5b08d
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Mon Jun 4 22:37:20 2012 +0300

    Remove use of -export-dynamic for GCC.

diff --git a/ChangeLog b/ChangeLog
index 46a9e33..52d677a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-04         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* configure.ac: Remove use of -export-dynamic for GCC.
+	* configure: Regenerated.
+
 2012-05-30         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* main.c (is_off_limits_var): Minor coding style edit.
diff --git a/configure b/configure
index 42ed1ca..44116db 100755
--- a/configure
+++ b/configure
@@ -10018,17 +10018,6 @@ if test "x$ac_cv_header_dlfcn_h" = xyes; then :
 
 $as_echo "#define DYNAMIC 1" >>confdefs.h
 
-	if test "$GCC" = yes
-	then
-		# Add others here as appropriate,
-		# one day use GNU libtool.
-		# 3/2010: Used to have cygwin here but removed since
-		# we get complaints that -export-dynamic doesn't work.
-		if uname | $EGREP -i 'linux|freebsd' > /dev/null
-		then
-			LDFLAGS="$LDFLAGS -export-dynamic"
-		fi
-	fi
 
 	# Check this separately. Some systems have dlopen
 	# in libc. Notably freebsd and cygwin.
diff --git a/configure.ac b/configure.ac
index 334e5ac..55bf0ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -285,17 +285,6 @@ dnl check for dynamic linking
 dnl This is known to be very primitive
 AC_CHECK_HEADER(dlfcn.h,
 	[AC_DEFINE([DYNAMIC], 1, [dynamic loading is possible])
-	if test "$GCC" = yes
-	then
-		# Add others here as appropriate,
-		# one day use GNU libtool.
-		# 3/2010: Used to have cygwin here but removed since
-		# we get complaints that -export-dynamic doesn't work.
-		if uname | $EGREP -i 'linux|freebsd' > /dev/null
-		then
-			LDFLAGS="$LDFLAGS -export-dynamic"
-		fi
-	fi
 
 	# Check this separately. Some systems have dlopen
 	# in libc. Notably freebsd and cygwin.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog    |    5 +++++
 configure    |   11 -----------
 configure.ac |   11 -----------
 3 files changed, 5 insertions(+), 22 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Tue Jun 05 16:18:45 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sc0DF-0000GV-Mb
	for mharc-gawk-diffs@gnu.org; Tue, 05 Jun 2012 16:18:45 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60071)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sc0DA-0000GI-ER
	for gawk-diffs@gnu.org; Tue, 05 Jun 2012 16:18:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sc0D4-0001jh-4F
	for gawk-diffs@gnu.org; Tue, 05 Jun 2012 16:18:40 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:43173)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sc0D4-0001jd-0r
	for gawk-diffs@gnu.org; Tue, 05 Jun 2012 16:18:34 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1Sc0D1-00088h-PP
	for gawk-diffs@gnu.org; Tue, 05 Jun 2012 20:18:33 +0000
Date: Tue, 05 Jun 2012 20:18:32 +0000
Message-Id: <E1Sc0D1-00088h-PP@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: a0f0d2b98fa88ef98f7c7100795869e0bad5b08d
X-Git-Newrev: a9c75046c071c9a67455ef27be44cac0b64be3c4
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. a9c75046c071c9a67455ef27be44cac0b64be3c4
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 05 Jun 2012 20:18:45 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  a9c75046c071c9a67455ef27be44cac0b64be3c4 (commit)
      from  a0f0d2b98fa88ef98f7c7100795869e0bad5b08d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=a9c75046c071c9a67455ef27be44cac0b64be3c4

commit a9c75046c071c9a67455ef27be44cac0b64be3c4
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 5 23:17:26 2012 +0300

    Minor edits in load_ext.

diff --git a/ChangeLog b/ChangeLog
index 52d677a..16cd1de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-05         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* ext.c (load_ext): Remove use of RTLD_GLOBAL. Not needed in new
+	scheme. Clean up error messages.
+
 2012-06-04         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* configure.ac: Remove use of -export-dynamic for GCC.
diff --git a/ext.c b/ext.c
index 0da6174..66ea7fb 100644
--- a/ext.c
+++ b/ext.c
@@ -69,28 +69,24 @@ load_ext(const char *lib_name, const char *init_func)
 		fatal(_("extensions are not allowed in sandbox mode"));
 
 	if (do_traditional || do_posix)
-		fatal(_("`extension' is a gawk extension"));
-
-#ifdef RTLD_GLOBAL
-	flags |= RTLD_GLOBAL;
-#endif
+		fatal(_("-l / @load / `extension' are gawk extensions"));
 
 	if ((dl = dlopen(lib_name, flags)) == NULL)
-		fatal(_("extension: cannot open library `%s' (%s)\n"), lib_name,
+		fatal(_("load_ext: cannot open library `%s' (%s)\n"), lib_name,
 		      dlerror());
 
 	/* Per the GNU Coding standards */
 	gpl_compat = (int *) dlsym(dl, "plugin_is_GPL_compatible");
 	if (gpl_compat == NULL)
-		fatal(_("extension: library `%s': does not define `plugin_is_GPL_compatible' (%s)\n"),
+		fatal(_("load_ext: library `%s': does not define `plugin_is_GPL_compatible' (%s)\n"),
 				lib_name, dlerror());
 	func = (int (*)(const gawk_api_t *const, awk_ext_id_t)) dlsym(dl, init_func);
 	if (func == NULL)
-		fatal(_("extension: library `%s': cannot call function `%s' (%s)\n"),
+		fatal(_("load_ext: library `%s': cannot call function `%s' (%s)\n"),
 				lib_name, init_func, dlerror());
 
 	if ((*func)(& api_impl, NULL /* ext_id */) == 0) {
-		warning(_("extension: library `%s' initialization routine `%s' failed\n"),
+		warning(_("load_ext: library `%s' initialization routine `%s' failed\n"),
 				lib_name, init_func);
 		return make_number(-1);
 	}

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |    5 +++++
 ext.c     |   14 +++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Wed Jun 06 13:09:38 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ScJjm-0007rI-5r
	for mharc-gawk-diffs@gnu.org; Wed, 06 Jun 2012 13:09:38 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35578)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ScJjZ-0007JT-Oz
	for gawk-diffs@gnu.org; Wed, 06 Jun 2012 13:09:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ScJjW-0003mn-Ln
	for gawk-diffs@gnu.org; Wed, 06 Jun 2012 13:09:25 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:52784)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ScJjW-0003md-HL
	for gawk-diffs@gnu.org; Wed, 06 Jun 2012 13:09:22 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1ScJjU-0001bh-8l
	for gawk-diffs@gnu.org; Wed, 06 Jun 2012 17:09:21 +0000
Date: Wed, 06 Jun 2012 17:09:21 +0000
Message-Id: <E1ScJjU-0001bh-8l@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: a9c75046c071c9a67455ef27be44cac0b64be3c4
X-Git-Newrev: dab3a678b3f65ae4cde21ca4b1d4fd24e8a71918
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. dab3a678b3f65ae4cde21ca4b1d4fd24e8a71918
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 06 Jun 2012 17:09:36 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  dab3a678b3f65ae4cde21ca4b1d4fd24e8a71918 (commit)
       via  fcc37ab5b658388a6fa14bcd9c0254454418c96a (commit)
      from  a9c75046c071c9a67455ef27be44cac0b64be3c4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=dab3a678b3f65ae4cde21ca4b1d4fd24e8a71918

commit dab3a678b3f65ae4cde21ca4b1d4fd24e8a71918
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Jun 6 20:08:02 2012 +0300

    Changes to LINT reflect to extn API. Add API tests.

diff --git a/ChangeLog b/ChangeLog
index 928b628..f7e9ac9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
 	* cint_array.c (tree_print, leaf_print): Add additional casts
 	for printf warnings.
 
+	* awk.h (update_ext_api): Add declaration.
+	* gawkapi.c (update_ext_api): New function.
+	* eval.c (set_LINT): Call update_ext_api() at the end.
+	* gawkapi.h: Document that do_XXX could change on the fly.
+
 2012-06-05         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* ext.c (load_ext): Remove use of RTLD_GLOBAL. Not needed in new
diff --git a/awk.h b/awk.h
index ea4819e..280563c 100644
--- a/awk.h
+++ b/awk.h
@@ -709,6 +709,7 @@ struct break_point;
 #include "gawkapi.h"
 extern gawk_api_t api_impl;
 extern void init_ext_api(void);
+extern void update_ext_api(void);
 extern NODE *awk_value_to_node(const awk_value_t *);
 #endif
 
diff --git a/eval.c b/eval.c
index 9044565..9b3e8e0 100644
--- a/eval.c
+++ b/eval.c
@@ -967,6 +967,9 @@ set_LINT()
 	/* explicitly use warning() here, in case lintfunc == r_fatal */
 	if (old_lint != do_lint && old_lint && ! do_lint)
 		warning(_("turning off `--lint' due to assignment to `LINT'"));
+
+	/* inform plug-in api of change */
+	update_ext_api();
 #endif /* ! NO_LINT */
 }
 
diff --git a/extension/ChangeLog b/extension/ChangeLog
index e31a107..140aea5 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -2,6 +2,9 @@
 
 	* filefuncs.c (do_stat): Make `type' const char *.
 
+	* testext.c: Functions renamed, some of them filled in. Corresponding
+	awk code for each test added inline.
+
 2012-05-30         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* testext.c: New file. Outline of tests for extension API.
diff --git a/extension/testext.c b/extension/testext.c
index 599581c..5b171e8 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -41,35 +41,92 @@ static awk_ext_id_t *ext_id;
 
 int plugin_is_GPL_compatible;
 
+/*
+ * The awk code for these tests is embedded in this file and then extracted
+ * dynamically to create the script that is run together with this extension.
+ * Extraction requires the format for awk code where test code is enclosed
+ * in a BEGIN block, with the BEGIN and close brace on lines by themselves
+ * and at the front of the lines.
+ */
+
+/*
+@load testext
+BEGIN {
+	dump_procinfo()
+}
+*/
 static awk_value_t *
-do_func1(int nargs, awk_value_t *result)
+dump_procinfo(int nargs, awk_value_t *result)
 {
 	/* get PROCINFO as flat array and print it */
 }
 
+/*
+BEGIN {
+	testvar = "One Adam Twelve"
+	ret = var_test("testvar")
+	printf "var_test() returned %d, test_var = %s\n", ret, testvar
+}
+*/
+
 static awk_value_t *
-do_func2(int nargs, awk_value_t *result)
+var_test(int nargs, awk_value_t *result)
 {
+	awk_value_t value;
+
+	if (nargs != 1 || result == NULL)
+		return NULL;
+
 	/* look up a reserved variable - should fail */
+	if (sym_lookup("ARGC", & value, AWK_NUMBER) != NULL)
+		printf("var_test: sym_lookup of ARGC failed - got a value!\n");
+	else
+		printf("var_test: sym_lookup of ARGC passed\n");
+
 	/* look up variable whose name is passed in, should pass */
 	/* change the value, should be reflected in awk script */
 }
 
+/*
+BEGIN {
+	ERRNO = ""
+	ret = test_errno()
+	printf "test_errno() returned %d, ERRNO = %s\n", ret, ERRNO
+}
+*/
 static awk_value_t *
-do_func3(int nargs, awk_value_t *result)
+test_errno(int nargs, awk_value_t *result)
 {
-	/* set ERRNO, should be reflected in awk script */
+	update_ERRNO_int(ECHILD);
 }
 
+/*
+BEGIN {
+	for (i = 1; i <= 10; i++)
+		test_array[i] = i + 2
+
+	printf ("length of test_array is %d, should be 10\n", length(test_array)
+	ret = test_array_size(test_array);
+	printf "test_array_size() returned %d, length is now %d\n", ret, length(test_array)
+}
+*/
+
 static awk_value_t *
-do_func4(int nargs, awk_value_t *result)
+test_array_size(int nargs, awk_value_t *result)
 {
 	/* get element count and print it; should match length(array) from awk script */
 	/* clear array - length(array) should then go to zero in script */
 }
 
+/*
+BEGIN {
+	n = split("one two three four five six", test_array2)
+	ret = test_array_elem(test_array2, "3")
+	printf "test_array_elem() returned %d, test_array2[3] = %g\n", ret, test_array2[3]
+}
+*/
 static awk_value_t *
-do_func5(int nargs, awk_value_t *result)
+test_array_elem(int nargs, awk_value_t *result)
 {
 	/* look up an array element and print the value */
 	/* change the element */
@@ -77,9 +134,66 @@ do_func5(int nargs, awk_value_t *result)
 	/* change and deletion should be reflected in awk script */
 }
 
+/*
+BEGIN {
+	printf "Initial value of LINT is %d\n", LINT
+	ret = print_do_lint();
+	printf "print_do_lint() returned %d\n", ret
+	LINT = ! LINT
+	printf "Changed value of LINT is %d\n", LINT
+	ret = print_do_lint();
+	printf "print_do_lint() returned %d\n", ret
+}
+*/
+static awk_value_t *
+print_do_lint(int nargs, awk_value_t *result)
+{
+	printf("print_do_lint: lint = %d\n", do_lint);
+}
+
+static void at_exit0(void *data, int exit_status)
+{
+	printf("at_exit0 called (should be third):");
+	if (data)
+		printf(" data = %p,", data);
+	else
+		printf(" data = <null>,");
+	printf(" exit_status = %d\n", exit_status);
+}
+
+
+static int data_for_1 = 0xDeadBeef;
+static void at_exit1(void *data, int exit_status)
+{
+	printf("at_exit1 called (should be second):");
+	if (data) {
+		printf(" data = %p", data);
+		if (data == & data_for_1)
+			printf(" (data is & data_for_1),");
+		else
+			printf(" (data is NOT & data_for_1),");
+	} else
+		printf(" data = <null>,");
+	printf(" exit_status = %d\n", exit_status);
+}
+
+static void at_exit2(void *data, int exit_status)
+{
+	printf("at_exit2 called (should be first):");
+	if (data)
+		printf(" data = %p,", data);
+	else
+		printf(" data = <null>,");
+	printf(" exit_status = %d\n", exit_status);
+}
 
 static awk_ext_func_t func_table[] = {
-	{ "test_func1", do_func1, 1 },
+	{ "dump_procinfo", dump_procinfo, 0 },
+	{ "var_test", var_test, 1 },
+	{ "test_errno", test_errno, 0 },
+	{ "test_array_size", test_array_size, 1 },
+	{ "test_array_elem", test_array_elem, 2 },
+	{ "print_do_lint", print_do_lint, 0 },
 };
 
 
@@ -88,6 +202,8 @@ int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id)
 {
 	size_t i, j;
 	int errors = 0;
+	awk_value_t value;
+	static const char message[] = "hello, world";	/* of course */
 
 	api = api_p;
 	ext_id = id;
@@ -103,7 +219,7 @@ int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id)
 
 	/* load functions */
 	for (i = 0, j = sizeof(func_table) / sizeof(func_table[0]); i < j; i++) {
-		if (! add_ext_func(& func_table[i], name_space)) {
+		if (! add_ext_func(& func_table[i], "")) {
 			warning(ext_id, "testfuncs: could not add %s\n",
 					func_table[i].name);
 			errors++;
@@ -111,8 +227,23 @@ int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id)
 	}
 
 	/* add at_exit functions */
+	awk_atexit(at_exit0, NULL);
+	awk_atexit(at_exit1, & data_for_1);
+	awk_atexit(at_exit2, NULL);
+
+/*
+BEGIN {
+	printf("answer_num = %g\n", answer_num);
+	printf("message_string = %s\n", message_string);
+}
+*/
 
 	/* install some variables */
+	if (! sym_update("answer_num", make_number(42, & value)))
+			printf("textext: sym_update(\"answer_num\") failed!\n");
+
+	if (! sym_update("message_string", dup_string(message, strlen(message), & value)))
+			printf("textext: sym_update(\"answer_num\") failed!\n");
 
 	return (errors == 0);
 }
diff --git a/gawkapi.c b/gawkapi.c
index 3b915fc..7a79f78 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -479,3 +479,11 @@ init_ext_api()
 	api_impl.do_flags[4] = do_debug;
 	api_impl.do_flags[5] = do_mpfr;
 }
+
+/* update_ext_api --- update the variables in the API that can change */
+
+void
+update_ext_api()
+{
+	api_impl.do_flags[0] = do_lint;
+}
diff --git a/gawkapi.h b/gawkapi.h
index 87d2d2f..09a1ce7 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -179,6 +179,11 @@ typedef struct gawk_api {
 	int major_version;
 	int minor_version;
 
+	/*
+	 * These can change on the fly as things happen within gawk.
+	 * Currently only do_lint is prone to change, but we reserve
+	 * the right to allow the others also.
+	 */
 	int do_flags[DO_FLAGS_SIZE];
 /* Use these as indices into do_flags[] array to check the values */
 #define gawk_do_lint		0

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=fcc37ab5b658388a6fa14bcd9c0254454418c96a

commit fcc37ab5b658388a6fa14bcd9c0254454418c96a
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Jun 6 20:03:29 2012 +0300

    Minor fixes for printf compile warnings.

diff --git a/ChangeLog b/ChangeLog
index 16cd1de..928b628 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-06         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* cint_array.c (tree_print, leaf_print): Add additional casts
+	for printf warnings.
+
 2012-06-05         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* ext.c (load_ext): Remove use of RTLD_GLOBAL. Not needed in new
diff --git a/cint_array.c b/cint_array.c
index 3245cdc..cafd1bb 100644
--- a/cint_array.c
+++ b/cint_array.c
@@ -996,7 +996,8 @@ tree_print(NODE *tree, size_t bi, int indent_level)
 	hsize = tree->array_size;
 	if ((tree->flags & HALFHAT) != 0)
 		hsize /= 2;
-	fprintf(output_fp, "%4lu:%s[%4lu:%-4lu]\n", bi,
+	fprintf(output_fp, "%4lu:%s[%4lu:%-4lu]\n",
+			(unsigned long) bi,
 			(tree->flags & HALFHAT) ? "HH" : "H",
 			(unsigned long) hsize, (unsigned long) tree->table_size);
 
@@ -1210,7 +1211,8 @@ static void
 leaf_print(NODE *array, size_t bi, int indent_level)
 {
 	indent(indent_level);
-	fprintf(output_fp, "%4lu:L[%4lu:%-4lu]\n", bi,
+	fprintf(output_fp, "%4lu:L[%4lu:%-4lu]\n",
+			(unsigned long) bi,
 			(unsigned long) array->array_size,
 			(unsigned long) array->table_size);
 }
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 9551de9..e31a107 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-06         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* filefuncs.c (do_stat): Make `type' const char *.
+
 2012-05-30         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* testext.c: New file. Outline of tests for extension API.
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index 46b1596..4d38200 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -240,7 +240,7 @@ do_stat(int nargs, awk_value_t *result)
 	struct stat sbuf;
 	int ret, j, k;
 	char *pmode;	/* printable mode */
-	char *type = "unknown";
+	const char *type = "unknown";
 	awk_value_t tmp;
 	static struct ftype_map {
 		int mask;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |   10 +++
 awk.h                 |    1 +
 cint_array.c          |    6 +-
 eval.c                |    3 +
 extension/ChangeLog   |    7 ++
 extension/filefuncs.c |    2 +-
 extension/testext.c   |  147 ++++++++++++++++++++++++++++++++++++++++++++++---
 gawkapi.c             |    8 +++
 gawkapi.h             |    5 ++
 9 files changed, 178 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Sun Jun 10 12:07:26 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sdkfm-0005Kw-K5
	for mharc-gawk-diffs@gnu.org; Sun, 10 Jun 2012 12:07:26 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40530)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdkfi-0005I3-Vo
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 12:07:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdkff-0008Qi-8F
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 12:07:22 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:35879)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdkff-0008Qc-4h
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 12:07:19 -0400
Received: from ajschorr by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdkfe-00081k-0o
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 16:07:18 +0000
Date: Sun, 10 Jun 2012 16:07:18 +0000
Message-Id: <E1Sdkfe-00081k-0o@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: dab3a678b3f65ae4cde21ca4b1d4fd24e8a71918
X-Git-Newrev: 058fc8ac436001c3f186bdeaf0d596352483a0b8
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 058fc8ac436001c3f186bdeaf0d596352483a0b8
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 10 Jun 2012 16:07:25 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  058fc8ac436001c3f186bdeaf0d596352483a0b8 (commit)
      from  dab3a678b3f65ae4cde21ca4b1d4fd24e8a71918 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=058fc8ac436001c3f186bdeaf0d596352483a0b8

commit 058fc8ac436001c3f186bdeaf0d596352483a0b8
Author: Andrew J. Schorr <aschorr@telemetry-investments.com>
Date:   Sun Jun 10 12:06:32 2012 -0400

    Remove unused (obsolete) files in the extension directory.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index 140aea5..d647ebb 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,9 @@
+2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
+
+	* arrayparm.c, dl.c, doit, foo.awk, steps, testarg.awk, testarg.c,
+	testarrayparm.awk, testff.awk, testfork.awk, testordchr.awk: Remove
+	unused (obsolete) files.
+
 2012-06-06         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* filefuncs.c (do_stat): Make `type' const char *.
diff --git a/extension/arrayparm.c b/extension/arrayparm.c
deleted file mode 100644
index 02b8c2e..0000000
--- a/extension/arrayparm.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * arrayparm.c --- figure out how to make a parameter be an array
- *
- * Arnold Robbins
- * arnold@skeeve.com
- * 10/2001
- *
- * Revised 7/2003
- * Revised 6/2004
- */
-
-/*
- * Copyright (C) 2001, 2003, 2004, 2011 the Free Software Foundation, Inc.
- * 
- * This file is part of GAWK, the GNU implementation of the
- * AWK Programming Language.
- * 
- * GAWK is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- * 
- * GAWK is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-#include "awk.h"
-
-int plugin_is_GPL_compatible;
-
-/*  do_mkarray --- turn a variable into an array */
-
-/*
- * From awk, call
- *
- * 	mkarray(var, sub, val)
- */
-
-static NODE *
-do_mkarray(int nargs)
-{
-	int ret = -1;
-	NODE *var, *sub, *val;
-	NODE **elemval;
-
-	if  (do_lint && nargs > 3)
-		lintwarn("mkarray: called with too many arguments");
-
-	var = get_array_argument(0, false);
-	sub = get_scalar_argument(1, false);
-	val = get_scalar_argument(2, false);
-
-	printf("var->type = %s\n", nodetype2str(var->type));
-	printf("sub->type = %s\n", nodetype2str(sub->type));
-	printf("val->type = %s\n", nodetype2str(val->type));
-
-	assoc_clear(var);
-
-	elemval = assoc_lookup(var, sub);
-	*elemval = dupnode(val);
-	ret = 0;
-
-	/* Set the return value */
-	return make_number((AWKNUM) ret);
-}
-
-/* dlload --- load new builtins in this library */
-
-NODE *
-dlload(tree, dl)
-NODE *tree;
-void *dl;
-{
-	make_builtin("mkarray", do_mkarray, 3);
-
-	return make_number((AWKNUM) 0);
-}
diff --git a/extension/dl.c b/extension/dl.c
deleted file mode 100644
index ee3b08f..0000000
--- a/extension/dl.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * dl.c - Example of adding a new builtin function to gawk.
- *
- * Christos Zoulas, Thu Jun 29 17:40:41 EDT 1995
- * Arnold Robbins, update for 3.1, Wed Sep 13 09:38:56 2000
- */
-
-/*
- * Copyright (C) 1995 - 2001, 2011 the Free Software Foundation, Inc.
- * 
- * This file is part of GAWK, the GNU implementation of the
- * AWK Programming Language.
- * 
- * GAWK is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- * 
- * GAWK is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
-
-#include "awk.h"
-#include <dlfcn.h>
-
-int plugin_is_GPL_compatible;
-
-static void *sdl = NULL;
-
-static NODE *
-zaxxon(int nargs)
-{
-	NODE *obj;
-	int i;
-	int comma = 0;
-
-	/*
-	 * Print the arguments
-	 */
-	printf("External linkage zaxxon(");
-
-	for (i = 0; i < nargs; i++) {
-
-		obj = get_scalar_argument(i, true);
-
-		if (obj == NULL)
-			break;
-
-		force_string(obj);
-
-		printf(comma ? ", %s" : "%s", obj->stptr);
-		comma = 1;
-	}
-
-	printf(");\n");
-
-	/*
-	 * Do something useful
-	 */
-	obj = get_scalar_argument(0, false);
-
-	if (obj != NULL) {
-		force_string(obj);
-		if (strcmp(obj->stptr, "unload") == 0 && sdl) {
-			/*
-			 * XXX: How to clean up the function? 
-			 * I would like the ability to remove a function...
-			 */
-			dlclose(sdl);
-			sdl = NULL;
-		}
-	}
-
-	/* Set the return value */
-	return make_number((AWKNUM) 3.14);
-}
-
-NODE *
-dlload(tree, dl)
-NODE *tree;
-void *dl;
-{
-	sdl = dl;
-	make_builtin("zaxxon", zaxxon, 4);
-	return make_number((AWKNUM) 0);
-}
diff --git a/extension/doit b/extension/doit
deleted file mode 100755
index 29dff7d..0000000
--- a/extension/doit
+++ /dev/null
@@ -1 +0,0 @@
-../gawk -f foo.awk
diff --git a/extension/foo.awk b/extension/foo.awk
deleted file mode 100644
index 00a89e5..0000000
--- a/extension/foo.awk
+++ /dev/null
@@ -1,9 +0,0 @@
-BEGIN {
-    extension("./dl.so","dlload")
-    zaxxon("hi there", "this is", "a test", "of argument passing")
-    zaxxon(1)
-    zaxxon(1,2)
-    z = zaxxon(1,2,3,4)
-    z = zaxxon(1,zaxxon(zaxxon("foo")),3,4)
-    print z
-}
diff --git a/extension/steps b/extension/steps
deleted file mode 100755
index a6696dd..0000000
--- a/extension/steps
+++ /dev/null
@@ -1,23 +0,0 @@
-# what to do under linux to make dl.so
-# Tue Nov 24 15:04:14 EST 1998
-# Sun Aug 26 16:03:58 IDT 2001
-# Sun Apr 28 15:59:57 IDT 2002
-# Mon Jun 21 17:03:37 IDT 2004
-# Fri May 15 15:48:45 IDT 2009
-
-gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. dl.c
-gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. filefuncs.c
-gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. fork.c
-gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. ordchr.c
-gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. arrayparm.c
-gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. readfile.c
-gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. testarg.c
-gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. rwarray.c
-ld -o dl.so -shared dl.o
-ld -o filefuncs.so -shared filefuncs.o
-ld -o fork.so -shared fork.o
-ld -o ordchr.so -shared ordchr.o
-ld -o arrayparm.so -shared arrayparm.o
-ld -o readfile.so -shared readfile.o
-ld -o testarg.so -shared testarg.o
-ld -o rwarray.so -shared rwarray.o
diff --git a/extension/testarg.awk b/extension/testarg.awk
deleted file mode 100644
index a91df1a..0000000
--- a/extension/testarg.awk
+++ /dev/null
@@ -1,7 +0,0 @@
-BEGIN {
-	extension("./testarg.so", "dlload")
-	check_arg(x, a);
-	check_arg(y, b, z);
-	check_arg(u, v, u=1);
-	check_arg(p, q, r, s);
-}
diff --git a/extension/testarg.c b/extension/testarg.c
deleted file mode 100644
index 32481b3..0000000
--- a/extension/testarg.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "awk.h"
-
-int plugin_is_GPL_compatible;
-
-static NODE *
-do_check_arg(int nargs)
-{
-	int ret = 0;
-	NODE *arg1, *arg2, *arg3;
-
-	printf("arg count: defined = 3, supplied = %d\n", nargs);
-
-	arg1 = get_scalar_argument(0, false);
-	arg2 = get_array_argument(1, false);
-	arg3 = get_scalar_argument(2, true);	/* optional */
-	if (nargs > 3) {
-		/* try to use an extra arg */
-		NODE *arg4;
-		arg4 = get_array_argument(3, true);
-		printf("Shouldn't see this line\n");
-	}
-	if (arg3 != NULL) {
-		printf("3rd arg present\n");
-		if (arg3->type != Node_val)
-			printf("3nd arg type = %s (*** NOT OK ***)\n", nodetype2str(arg3->type));
-	} else
-		printf("no 3rd arg\n");
-
-	if (arg2 != NULL) {
-		if (arg2->type != Node_var_array)
-			printf("2nd arg type = %s (*** NOT OK ***)\n", nodetype2str(arg2->type));
-	} else
-		printf("2nd arg missing (NULL) (*** NOT OK ***)\n");
-
-	if (arg1 != NULL) {
-		if (arg1->type != Node_val)
-			printf("1st arg type = %s (*** NOT OK ***)\n", nodetype2str(arg1->type));
-	} else
-		printf("1st arg missing (NULL) (*** NOT OK ***)\n");
-	printf("\n");
-
-	/* Set the return value */
-	return make_number((AWKNUM) ret);
-}
-
-/* dlload --- load new builtins in this library */
-
-NODE *
-dlload(tree, dl)
-NODE *tree;
-void *dl;
-{
-        make_builtin("check_arg", do_check_arg, 3);
-        return make_number((AWKNUM) 0);
-}
diff --git a/extension/testarrayparm.awk b/extension/testarrayparm.awk
deleted file mode 100644
index 08178f3..0000000
--- a/extension/testarrayparm.awk
+++ /dev/null
@@ -1,10 +0,0 @@
-#! /bin/awk -f
-
-BEGIN {
-	extension("./arrayparm.so", "dlload")
-
-	mkarray(newvar, "hi", "hello")
-
-	for (i in newvar)
-		printf ("newvar[\"%s\"] = \"%s\"\n", i, newvar[i])
-}
diff --git a/extension/testff.awk b/extension/testff.awk
deleted file mode 100644
index 0a0a9b2..0000000
--- a/extension/testff.awk
+++ /dev/null
@@ -1,30 +0,0 @@
-BEGIN {
-	extension("./filefuncs.so", "dlload")
-
-#	printf "before: "
-#	fflush()
-#	system("pwd")
-#
-#	chdir("..")
-#
-#	printf "after: "
-#	fflush()
-#	system("pwd")
-
-	chdir(".")
-
-	data[1] = 1
-	print "Info for testff.awk"
-	ret = stat("testff.awk", data)
-	print "ret =", ret
-	for (i in data)
-		printf "data[\"%s\"] = %s\n", i, data[i]
-	print "testff.awk modified:", strftime("%m %d %y %H:%M:%S", data["mtime"])
-
-	print "\nInfo for JUNK"
-	ret = stat("JUNK", data)
-	print "ret =", ret
-	for (i in data)
-		printf "data[\"%s\"] = %s\n", i, data[i]
-	print "JUNK modified:", strftime("%m %d %y %H:%M:%S", data["mtime"])
-}
diff --git a/extension/testfork.awk b/extension/testfork.awk
deleted file mode 100644
index ca00dca..0000000
--- a/extension/testfork.awk
+++ /dev/null
@@ -1,20 +0,0 @@
-BEGIN {
-	extension("./fork.so", "dlload")
-
-	printf "before fork, pid = %d, ppid = %d\n", PROCINFO["pid"],
-			PROCINFO["ppid"]
-
-	fflush()
-	ret = fork()
-	if (ret < 0)
-		printf("ret = %d, ERRNO = %s\n", ret, ERRNO)
-	else if (ret == 0)
-		printf "child, pid = %d, ppid = %d\n", PROCINFO["pid"],
-			PROCINFO["ppid"]
-	else {
-		system("sleep 3")
-		printf "parent, ret = %d\n", ret
-		printf "parent, pid = %d, ppid = %d\n", PROCINFO["pid"],
-			PROCINFO["ppid"]
-	}
-}
diff --git a/extension/testordchr.awk b/extension/testordchr.awk
deleted file mode 100644
index 64e53d1..0000000
--- a/extension/testordchr.awk
+++ /dev/null
@@ -1,6 +0,0 @@
-BEGIN {
-	extension("./ordchr.so", "dlload")
-
-	print "ord(\"a\") is", ord("a")
-	print "chr(65) is", chr(65)
-}

-----------------------------------------------------------------------

Summary of changes:
 extension/ChangeLog         |    6 +++
 extension/arrayparm.c       |   83 --------------------------------------
 extension/dl.c              |   92 -------------------------------------------
 extension/doit              |    1 -
 extension/foo.awk           |    9 ----
 extension/steps             |   23 -----------
 extension/testarg.awk       |    7 ---
 extension/testarg.c         |   55 -------------------------
 extension/testarrayparm.awk |   10 -----
 extension/testff.awk        |   30 --------------
 extension/testfork.awk      |   20 ---------
 extension/testordchr.awk    |    6 ---
 12 files changed, 6 insertions(+), 336 deletions(-)
 delete mode 100644 extension/arrayparm.c
 delete mode 100644 extension/dl.c
 delete mode 100755 extension/doit
 delete mode 100644 extension/foo.awk
 delete mode 100755 extension/steps
 delete mode 100644 extension/testarg.awk
 delete mode 100644 extension/testarg.c
 delete mode 100644 extension/testarrayparm.awk
 delete mode 100644 extension/testff.awk
 delete mode 100644 extension/testfork.awk
 delete mode 100644 extension/testordchr.awk


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Sun Jun 10 12:38:00 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sdl9M-0005SN-E4
	for mharc-gawk-diffs@gnu.org; Sun, 10 Jun 2012 12:38:00 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41005)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdl9J-0005Re-75
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 12:37:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdl9H-0006l5-3W
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 12:37:56 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:40237)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdl9H-0006ko-07
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 12:37:55 -0400
Received: from ajschorr by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdl9F-00011P-Lj
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 16:37:53 +0000
Date: Sun, 10 Jun 2012 16:37:53 +0000
Message-Id: <E1Sdl9F-00011P-Lj@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 058fc8ac436001c3f186bdeaf0d596352483a0b8
X-Git-Newrev: 18e7a6250a5daa170729a2adbc6b9d71f75f2bb5
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 18e7a6250a5daa170729a2adbc6b9d71f75f2bb5
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 10 Jun 2012 16:37:59 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  18e7a6250a5daa170729a2adbc6b9d71f75f2bb5 (commit)
      from  058fc8ac436001c3f186bdeaf0d596352483a0b8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=18e7a6250a5daa170729a2adbc6b9d71f75f2bb5

commit 18e7a6250a5daa170729a2adbc6b9d71f75f2bb5
Author: Andrew J. Schorr <aschorr@telemetry-investments.com>
Date:   Sun Jun 10 12:37:28 2012 -0400

    Remove obsolete comment in extension/Makefile.am.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index d647ebb..56eaa97 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,5 +1,10 @@
 2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
 
+	* Makefile.am: Remove comment referring to deleted test extensions
+	arrayparm, dl (zaxxon) and testarg.
+
+2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
+
 	* arrayparm.c, dl.c, doit, foo.awk, steps, testarg.awk, testarg.c,
 	testarrayparm.awk, testff.awk, testfork.awk, testordchr.awk: Remove
 	unused (obsolete) files.
diff --git a/extension/Makefile.am b/extension/Makefile.am
index 8161223..5e9a59f 100644
--- a/extension/Makefile.am
+++ b/extension/Makefile.am
@@ -29,9 +29,6 @@ AM_CPPFLAGS = -I$(srcdir)/..
 # correctly after changing configure.ac
 ACLOCAL_AMFLAGS = -I m4
 
-# The arrayparm, zaxxon (dl), and testarg libraries do not do anything useful,
-# so do not build or install them.
-
 # Note: rwarray does not currently compile.
 
 pkgextension_LTLIBRARIES =	\

-----------------------------------------------------------------------

Summary of changes:
 extension/ChangeLog   |    5 +++++
 extension/Makefile.am |    3 ---
 2 files changed, 5 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Sun Jun 10 21:04:39 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sdt3f-0000G5-7d
	for mharc-gawk-diffs@gnu.org; Sun, 10 Jun 2012 21:04:39 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48185)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdt3Z-0000F3-Gy
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 21:04:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdt3U-0005KF-Hs
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 21:04:33 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:49919)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdt3U-0005KA-CX
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 21:04:28 -0400
Received: from ajschorr by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdt3R-0000tP-QH
	for gawk-diffs@gnu.org; Mon, 11 Jun 2012 01:04:28 +0000
Date: Mon, 11 Jun 2012 01:04:26 +0000
Message-Id: <E1Sdt3R-0000tP-QH@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 18e7a6250a5daa170729a2adbc6b9d71f75f2bb5
X-Git-Newrev: 7891af5ec56ff4ed99435433c135079a9e24e037
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 7891af5ec56ff4ed99435433c135079a9e24e037
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 11 Jun 2012 01:04:37 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  7891af5ec56ff4ed99435433c135079a9e24e037 (commit)
      from  18e7a6250a5daa170729a2adbc6b9d71f75f2bb5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=7891af5ec56ff4ed99435433c135079a9e24e037

commit 7891af5ec56ff4ed99435433c135079a9e24e037
Author: Andrew J. Schorr <aschorr@telemetry-investments.com>
Date:   Sun Jun 10 21:03:48 2012 -0400

    Add time extension providing gettimeofday and sleep.

diff --git a/ChangeLog b/ChangeLog
index f7e9ac9..253daee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
+
+	* gawkapi.c (api_update_ERRNO_string): Treat boolean true as a request
+	for TRANSLATE, and false as DONT_TRANSLATE.
+
 2012-06-06         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* cint_array.c (tree_print, leaf_print): Add additional casts
diff --git a/awklib/eg/lib/gettime.awk b/awklib/eg/lib/gettime.awk
index 95f9c32..4cb5633 100644
--- a/awklib/eg/lib/gettime.awk
+++ b/awklib/eg/lib/gettime.awk
@@ -1,4 +1,4 @@
-# gettimeofday.awk --- get the time of day in a usable format
+# getlocaltime.awk --- get the time of day in a usable format
 #
 # Arnold Robbins, arnold@skeeve.com, Public Domain, May 1993
 #
@@ -25,7 +25,7 @@
 #    time["weeknum"]      -- week number, Sunday first day
 #    time["altweeknum"]   -- week number, Monday first day
 
-function gettimeofday(time,    ret, now, i)
+function getlocaltime(time,    ret, now, i)
 {
     # get time once, avoids unnecessary system calls
     now = systime()
diff --git a/awklib/eg/prog/alarm.awk b/awklib/eg/prog/alarm.awk
index 53563d1..9bb1633 100644
--- a/awklib/eg/prog/alarm.awk
+++ b/awklib/eg/prog/alarm.awk
@@ -1,6 +1,6 @@
 # alarm.awk --- set an alarm
 #
-# Requires gettimeofday() library function
+# Requires getlocaltime() library function
 #
 # Arnold Robbins, arnold@skeeve.com, Public Domain
 # May 1993
@@ -53,7 +53,7 @@ BEGIN    \
     minute = atime[2] + 0  # force numeric
 
     # get current broken down time
-    gettimeofday(now)
+    getlocaltime(now)
 
     # if time given is 12-hour hours and it's after that
     # hour, e.g., `alarm 5:30' at 9 a.m. means 5:30 p.m.,
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 756b841..421be54 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
+
+	* gawk.texi: Rename gettimeofday function to getlocaltime, since
+	the new time extension will provide gettimeofday.
+
 2012-05-24         Andrew J. Schorr     <aschorr@telemetry-investments.com>
 
 	* gawk.texi, gawk.1: Replace references to dlload with dl_load.
diff --git a/doc/gawk.info b/doc/gawk.info
index 7109ee6..8c93984 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -398,7 +398,7 @@ texts being (a) (see below), and with the Back-Cover Texts being (b)
 * Ordinal Functions::              Functions for using characters as numbers
                                    and vice versa.
 * Join Function::                  A function to join an array into a string.
-* Gettimeofday Function::          A function to get formatted times.
+* Getlocaltime Function::          A function to get formatted times.
 * Data File Management::           Functions for managing command-line data
                                    files.
 * Filetrans Function::             A function for handling data file
@@ -15487,7 +15487,7 @@ programming use.
 * Ordinal Functions::           Functions for using characters as numbers and
                                 vice versa.
 * Join Function::               A function to join an array into a string.
-* Gettimeofday Function::       A function to get formatted times.
+* Getlocaltime Function::       A function to get formatted times.
 
 
 File: gawk.info,  Node: Strtonum Function,  Next: Assert Function,  Up: General Functions
@@ -15833,7 +15833,7 @@ tests such as used here prohibitively expensive.
 extensions, you can simplify `_ord_init' to loop from 0 to 255.
 
 
-File: gawk.info,  Node: Join Function,  Next: Gettimeofday Function,  Prev: Ordinal Functions,  Up: General Functions
+File: gawk.info,  Node: Join Function,  Next: Getlocaltime Function,  Prev: Ordinal Functions,  Up: General Functions
 
 13.2.6 Merging an Array into a String
 -------------------------------------
@@ -15880,7 +15880,7 @@ concatenation.  The lack of an explicit operator for concatenation
 makes string operations more difficult than they really need to be.
 
 
-File: gawk.info,  Node: Gettimeofday Function,  Prev: Join Function,  Up: General Functions
+File: gawk.info,  Node: Getlocaltime Function,  Prev: Join Function,  Up: General Functions
 
 13.2.7 Managing the Time of Day
 -------------------------------
@@ -15891,11 +15891,11 @@ with the time of day in human readable form.  While `strftime()' is
 extensive, the control formats are not necessarily easy to remember or
 intuitively obvious when reading a program.
 
-   The following function, `gettimeofday()', populates a user-supplied
+   The following function, `getlocaltime()', populates a user-supplied
 array with preformatted time information.  It returns a string with the
 current time formatted in the same way as the `date' utility:
 
-     # gettimeofday.awk --- get the time of day in a usable format
+     # getlocaltime.awk --- get the time of day in a usable format
 
      # Returns a string in the format of output of date(1)
      # Populates the array argument time with individual values:
@@ -15919,7 +15919,7 @@ current time formatted in the same way as the `date' utility:
      #    time["weeknum"]      -- week number, Sunday first day
      #    time["altweeknum"]   -- week number, Monday first day
 
-     function gettimeofday(time,    ret, now, i)
+     function getlocaltime(time,    ret, now, i)
      {
          # get time once, avoids unnecessary system calls
          now = systime()
@@ -15958,7 +15958,7 @@ current time formatted in the same way as the `date' utility:
    The string indices are easier to use and read than the various
 formats required by `strftime()'.  The `alarm' program presented in
 *note Alarm Program::, uses this function.  A more general design for
-the `gettimeofday()' function would have allowed the user to supply an
+the `getlocaltime()' function would have allowed the user to supply an
 optional timestamp value to use instead of the current time.
 
 
@@ -18389,8 +18389,8 @@ prints the message on the standard output. In addition, you can give it
 the number of times to repeat the message as well as a delay between
 repetitions.
 
-   This program uses the `gettimeofday()' function from *note
-Gettimeofday Function::.
+   This program uses the `getlocaltime()' function from *note
+Getlocaltime Function::.
 
    All the work is done in the `BEGIN' rule.  The first part is argument
 checking and setting of defaults: the delay, the count, and the message
@@ -18405,7 +18405,7 @@ Statement::), but the processing could be done with a series of
 
      # alarm.awk --- set an alarm
      #
-     # Requires gettimeofday() library function
+     # Requires getlocaltime() library function
      # usage: alarm time [ "message" [ count [ delay ] ] ]
 
      BEGIN    \
@@ -18461,7 +18461,7 @@ alarm:
          minute = atime[2] + 0  # force numeric
 
          # get current broken down time
-         gettimeofday(now)
+         getlocaltime(now)
 
          # if time given is 12-hour hours and it's after that
          # hour, e.g., `alarm 5:30' at 9 a.m. means 5:30 p.m.,
@@ -27030,7 +27030,7 @@ Index
                                                               (line   6)
 * functions, library, managing data files: Data File Management.
                                                               (line   6)
-* functions, library, managing time:     Gettimeofday Function.
+* functions, library, managing time:     Getlocaltime Function.
                                                               (line   6)
 * functions, library, merging arrays into strings: Join Function.
                                                               (line   6)
@@ -27185,6 +27185,8 @@ Index
 * getline command, variants:             Getline Summary.     (line   6)
 * getline statement, BEGINFILE/ENDFILE patterns and: BEGINFILE/ENDFILE.
                                                               (line  54)
+* getlocaltime() user-defined function:  Getlocaltime Function.
+                                                              (line  16)
 * getopt() function (C library):         Getopt Function.     (line  15)
 * getopt() user-defined function:        Getopt Function.     (line 108)
 * getpwent() function (C library):       Passwd Functions.    (line  16)
@@ -27196,8 +27198,6 @@ Index
 * gettext library:                       Explaining gettext.  (line   6)
 * gettext library, locale categories:    Explaining gettext.  (line  80)
 * gettext() function (C library):        Explaining gettext.  (line  62)
-* gettimeofday() user-defined function:  Gettimeofday Function.
-                                                              (line  16)
 * GMP:                                   Arbitrary Precision Arithmetic.
                                                               (line   6)
 * GNITS mailing list:                    Acknowledgments.     (line  52)
@@ -27446,7 +27446,7 @@ Index
                                                               (line   6)
 * libraries of awk functions, managing, data files: Data File Management.
                                                               (line   6)
-* libraries of awk functions, managing, time: Gettimeofday Function.
+* libraries of awk functions, managing, time: Getlocaltime Function.
                                                               (line   6)
 * libraries of awk functions, merging arrays into strings: Join Function.
                                                               (line   6)
@@ -28296,13 +28296,13 @@ Index
 * tilde (~), ~ operator:                 Regexp Usage.        (line  19)
 * time, alarm clock example program:     Alarm Program.       (line   9)
 * time, localization and:                Explaining gettext.  (line 115)
-* time, managing:                        Gettimeofday Function.
+* time, managing:                        Getlocaltime Function.
                                                               (line   6)
 * time, retrieving:                      Time Functions.      (line  17)
 * timeout, reading input:                Read Timeout.        (line   6)
 * timestamps:                            Time Functions.      (line   6)
 * timestamps, converting dates to:       Time Functions.      (line  74)
-* timestamps, formatted:                 Gettimeofday Function.
+* timestamps, formatted:                 Getlocaltime Function.
                                                               (line   6)
 * tolower() function:                    String Functions.    (line 523)
 * toupper() function:                    String Functions.    (line 529)
@@ -28822,7 +28822,7 @@ Ref: Ordinal Functions-Footnote-1652320
 Ref: Ordinal Functions-Footnote-2652572
 Node: Join Function652781
 Ref: Join Function-Footnote-1654552
-Node: Gettimeofday Function654752
+Node: Getlocaltime Function654752
 Node: Data File Management658467
 Node: Filetrans Function659099
 Node: Rewind Function663238
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 8c6f371..b8ce91a 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -597,7 +597,7 @@ particular records in a file and perform operations upon them.
 * Ordinal Functions::              Functions for using characters as numbers
                                    and vice versa.
 * Join Function::                  A function to join an array into a string.
-* Gettimeofday Function::          A function to get formatted times.
+* Getlocaltime Function::          A function to get formatted times.
 * Data File Management::           Functions for managing command-line data
                                    files.
 * Filetrans Function::             A function for handling data file
@@ -20608,7 +20608,7 @@ programming use.
 * Ordinal Functions::           Functions for using characters as numbers and
                                 vice versa.
 * Join Function::               A function to join an array into a string.
-* Gettimeofday Function::       A function to get formatted times.
+* Getlocaltime Function::       A function to get formatted times.
 @end menu
 
 @node Strtonum Function
@@ -21133,7 +21133,7 @@ be nice if @command{awk} had an assignment operator for concatenation.
 The lack of an explicit operator for concatenation makes string operations
 more difficult than they really need to be.}
 
-@node Gettimeofday Function
+@node Getlocaltime Function
 @subsection Managing the Time of Day
 
 @cindex libraries of @command{awk} functions, managing, time
@@ -21147,14 +21147,14 @@ in human readable form.  While @code{strftime()} is extensive, the control
 formats are not necessarily easy to remember or intuitively obvious when
 reading a program.
 
-The following function, @code{gettimeofday()}, populates a user-supplied array
+The following function, @code{getlocaltime()}, populates a user-supplied array
 with preformatted time information.  It returns a string with the current
 time formatted in the same way as the @command{date} utility:
 
-@cindex @code{gettimeofday()} user-defined function
+@cindex @code{getlocaltime()} user-defined function
 @example
 @c file eg/lib/gettime.awk
-# gettimeofday.awk --- get the time of day in a usable format
+# getlocaltime.awk --- get the time of day in a usable format
 @c endfile
 @ignore
 @c file eg/lib/gettime.awk
@@ -21187,7 +21187,7 @@ time formatted in the same way as the @command{date} utility:
 #    time["weeknum"]      -- week number, Sunday first day
 #    time["altweeknum"]   -- week number, Monday first day
 
-function gettimeofday(time,    ret, now, i)
+function getlocaltime(time,    ret, now, i)
 @{
     # get time once, avoids unnecessary system calls
     now = systime()
@@ -21229,7 +21229,7 @@ The string indices are easier to use and read than the various formats
 required by @code{strftime()}.  The @code{alarm} program presented in
 @ref{Alarm Program},
 uses this function.
-A more general design for the @code{gettimeofday()} function would have
+A more general design for the @code{getlocaltime()} function would have
 allowed the user to supply an optional timestamp value to use instead
 of the current time.
 
@@ -24521,8 +24521,8 @@ it prints the message on the standard output. In addition, you can give it
 the number of times to repeat the message as well as a delay between
 repetitions.
 
-This program uses the @code{gettimeofday()} function from
-@ref{Gettimeofday Function}.
+This program uses the @code{getlocaltime()} function from
+@ref{Getlocaltime Function}.
 
 All the work is done in the @code{BEGIN} rule.  The first part is argument
 checking and setting of defaults: the delay, the count, and the message to
@@ -24541,7 +24541,7 @@ Here is the program:
 @c file eg/prog/alarm.awk
 # alarm.awk --- set an alarm
 #
-# Requires gettimeofday() library function
+# Requires getlocaltime() library function
 @c endfile
 @ignore
 @c file eg/prog/alarm.awk
@@ -24613,7 +24613,7 @@ is how long to wait before setting off the alarm:
     minute = atime[2] + 0  # force numeric
 
     # get current broken down time
-    gettimeofday(now)
+    getlocaltime(now)
 
     # if time given is 12-hour hours and it's after that
     # hour, e.g., `alarm 5:30' at 9 a.m. means 5:30 p.m.,
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 56eaa97..5e513f8 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,5 +1,12 @@
 2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
 
+	* Makefile.am: Add time extension.
+	* configure.ac: To support time extension, check for some headers
+	and functions that are needed.
+	* time.c: New file implementing sleep and gettimeofday.
+
+2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
+
 	* Makefile.am: Remove comment referring to deleted test extensions
 	arrayparm, dl (zaxxon) and testarg.
 
diff --git a/extension/Makefile.am b/extension/Makefile.am
index 5e9a59f..f2b30ed 100644
--- a/extension/Makefile.am
+++ b/extension/Makefile.am
@@ -35,7 +35,8 @@ pkgextension_LTLIBRARIES =	\
 	filefuncs.la	\
 	fork.la		\
 	ordchr.la	\
-	readfile.la
+	readfile.la	\
+	time.la
 
 MY_MODULE_FLAGS = -module -avoid-version -no-undefined
 
@@ -47,6 +48,8 @@ ordchr_la_SOURCES     = ordchr.c
 ordchr_la_LDFLAGS     = $(MY_MODULE_FLAGS)
 readfile_la_SOURCES   = readfile.c
 readfile_la_LDFLAGS   = $(MY_MODULE_FLAGS)
+time_la_SOURCES       = time.c
+time_la_LDFLAGS       = $(MY_MODULE_FLAGS)
 #rwarray_la_SOURCES    = rwarray.c
 #rwarray_la_LDFLAGS    = $(MY_MODULE_FLAGS)
 
diff --git a/extension/Makefile.in b/extension/Makefile.in
index c90a0b4..5952891 100644
--- a/extension/Makefile.in
+++ b/extension/Makefile.in
@@ -154,6 +154,12 @@ readfile_la_OBJECTS = $(am_readfile_la_OBJECTS)
 readfile_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(readfile_la_LDFLAGS) $(LDFLAGS) -o $@
+time_la_LIBADD =
+am_time_la_OBJECTS = time.lo
+time_la_OBJECTS = $(am_time_la_OBJECTS)
+time_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(time_la_LDFLAGS) \
+	$(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
 am__depfiles_maybe = depfiles
@@ -168,9 +174,9 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(filefuncs_la_SOURCES) $(fork_la_SOURCES) \
-	$(ordchr_la_SOURCES) $(readfile_la_SOURCES)
+	$(ordchr_la_SOURCES) $(readfile_la_SOURCES) $(time_la_SOURCES)
 DIST_SOURCES = $(filefuncs_la_SOURCES) $(fork_la_SOURCES) \
-	$(ordchr_la_SOURCES) $(readfile_la_SOURCES)
+	$(ordchr_la_SOURCES) $(readfile_la_SOURCES) $(time_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -317,15 +323,13 @@ AM_CPPFLAGS = -I$(srcdir)/..
 # correctly after changing configure.ac
 ACLOCAL_AMFLAGS = -I m4
 
-# The arrayparm, zaxxon (dl), and testarg libraries do not do anything useful,
-# so do not build or install them.
-
 # Note: rwarray does not currently compile.
 pkgextension_LTLIBRARIES = \
 	filefuncs.la	\
 	fork.la		\
 	ordchr.la	\
-	readfile.la
+	readfile.la	\
+	time.la
 
 MY_MODULE_FLAGS = -module -avoid-version -no-undefined
 filefuncs_la_SOURCES = filefuncs.c
@@ -336,6 +340,8 @@ ordchr_la_SOURCES = ordchr.c
 ordchr_la_LDFLAGS = $(MY_MODULE_FLAGS)
 readfile_la_SOURCES = readfile.c
 readfile_la_LDFLAGS = $(MY_MODULE_FLAGS)
+time_la_SOURCES = time.c
+time_la_LDFLAGS = $(MY_MODULE_FLAGS)
 #rwarray_la_SOURCES    = rwarray.c
 #rwarray_la_LDFLAGS    = $(MY_MODULE_FLAGS)
 EXTRA_DIST = \
@@ -441,6 +447,8 @@ ordchr.la: $(ordchr_la_OBJECTS) $(ordchr_la_DEPENDENCIES) $(EXTRA_ordchr_la_DEPE
 	$(ordchr_la_LINK) -rpath $(pkgextensiondir) $(ordchr_la_OBJECTS) $(ordchr_la_LIBADD) $(LIBS)
 readfile.la: $(readfile_la_OBJECTS) $(readfile_la_DEPENDENCIES) $(EXTRA_readfile_la_DEPENDENCIES) 
 	$(readfile_la_LINK) -rpath $(pkgextensiondir) $(readfile_la_OBJECTS) $(readfile_la_LIBADD) $(LIBS)
+time.la: $(time_la_OBJECTS) $(time_la_DEPENDENCIES) $(EXTRA_time_la_DEPENDENCIES) 
+	$(time_la_LINK) -rpath $(pkgextensiondir) $(time_la_OBJECTS) $(time_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -452,6 +460,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fork.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ordchr.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/extension/configh.in b/extension/configh.in
index e0beaf2..519f8ea 100644
--- a/extension/configh.in
+++ b/extension/configh.in
@@ -3,12 +3,24 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define to 1 if you have the `GetSystemTimeAsFileTime' function. */
+#undef HAVE_GETSYSTEMTIMEASFILETIME
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `nanosleep' function. */
+#undef HAVE_NANOSLEEP
+
+/* Define to 1 if you have the `select' function. */
+#undef HAVE_SELECT
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -21,12 +33,21 @@
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the <time.h> header file. */
+#undef HAVE_TIME_H
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
diff --git a/extension/configure b/extension/configure
index 7333bda..30b162a 100755
--- a/extension/configure
+++ b/extension/configure
@@ -1754,6 +1754,97 @@ $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_func
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval \${$3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ------------------------------- ##
+## Report this to bug-gawk@gnu.org ##
+## ------------------------------- ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -11371,6 +11462,32 @@ then
 	CFLAGS="$CFLAGS -Wall -Wextra"
 fi
 
+for ac_header in time.h sys/time.h sys/select.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_func in nanosleep select gettimeofday GetSystemTimeAsFileTime
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
 $as_echo_n "checking for inline... " >&6; }
diff --git a/extension/configure.ac b/extension/configure.ac
index 461826e..838350c 100644
--- a/extension/configure.ac
+++ b/extension/configure.ac
@@ -45,9 +45,9 @@ then
 	CFLAGS="$CFLAGS -Wall -Wextra"
 fi
 
-dnl AC_CHECK_HEADERS(stdarg.h)
-dnl AC_CHECK_FUNCS(snprintf)
-dnl AC_FUNC_VPRINTF
+AC_CHECK_HEADERS(time.h sys/time.h sys/select.h)
+
+AC_CHECK_FUNCS(nanosleep select gettimeofday GetSystemTimeAsFileTime)
 
 dnl checks for compiler characteristics
 AC_C_INLINE
diff --git a/extension/time.c b/extension/time.c
new file mode 100644
index 0000000..4f590c8
--- /dev/null
+++ b/extension/time.c
@@ -0,0 +1,167 @@
+/*
+ * time.c - Builtin functions that provide time-related functions.
+ *
+ */
+
+/*
+ * Copyright (C) 2012
+ * the Free Software Foundation, Inc.
+ * 
+ * This file is part of GAWK, the GNU implementation of the
+ * AWK Programming Language.
+ * 
+ * GAWK is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * GAWK is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "config.h"
+#include "gawkapi.h"
+
+static const gawk_api_t *api;	/* for convenience macros to work */
+static awk_ext_id_t *ext_id;
+
+int plugin_is_GPL_compatible;
+
+#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
+#include <sys/time.h>
+#endif
+#if defined(HAVE_SELECT) && defined(HAVE_SYS_SELECT_H)
+#include <sys/select.h>
+#endif
+#if defined(HAVE_NANOSLEEP) && defined(HAVE_TIME_H)
+#include <time.h>
+#endif
+
+#define RETURN return tmp_number((AWKNUM) 0)
+
+/*
+ * Returns time since 1/1/1970 UTC as a floating point value; should
+ * have sub-second precision, but the actual precision will vary based
+ * on the platform
+ */
+static awk_value_t *
+do_gettimeofday(int nargs, awk_value_t *result)
+{
+	double curtime;
+
+	if  (do_lint && nargs > 0)
+		lintwarn(ext_id, "gettimeofday: ignoring arguments");
+
+#if defined(HAVE_GETTIMEOFDAY)
+	{
+		struct timeval tv;
+		gettimeofday(&tv,NULL);
+		curtime = tv.tv_sec+(tv.tv_usec/1000000.0);
+	}
+#elif defined(HAVE_GETSYSTEMTIMEASFILETIME)
+	/* based on perl win32/win32.c:win32_gettimeofday() implementation */
+	{
+		union {
+			unsigned __int64 ft_i64;
+			FILETIME ft_val;
+		} ft;
+
+		/* # of 100-nanosecond intervals since January 1, 1601 (UTC) */
+		GetSystemTimeAsFileTime(&ft.ft_val);
+#ifdef __GNUC__
+#define Const64(x) x##LL
+#else
+#define Const64(x) x##i64
+#endif
+/* Number of 100 nanosecond units from 1/1/1601 to 1/1/1970 */
+#define EPOCH_BIAS  Const64(116444736000000000)
+		curtime = (ft.ft_i64 - EPOCH_BIAS)/10000000.0;
+#undef Const64
+	}
+#else
+	/* no way to retrieve system time on this platform */
+	curtime = -1;
+	update_ERRNO_string("gettimeofday: not supported on this platform", 1);
+#endif
+
+	return make_number(curtime, result);
+}
+
+/*
+ * Returns 0 if successful in sleeping the requested time;
+ * returns -1 if there is no platform support, or if the sleep request
+ * did not complete successfully (perhaps interrupted)
+ */
+static awk_value_t *
+do_sleep(int nargs, awk_value_t *result)
+{
+	awk_value_t num;
+	double secs;
+	int rc;
+
+	if  (do_lint && nargs > 1)
+		lintwarn(ext_id, "sleep: called with too many arguments");
+
+
+	if (get_curfunc_param(0, AWK_NUMBER, &num) == NULL) {
+		update_ERRNO_string("sleep: missing required numeric argument", 1);
+		return make_number(-1, result);
+	}
+	secs = num.num_value;
+
+	if (secs < 0) {
+		update_ERRNO_string("sleep: argument is negative", 1);
+		return make_number(-1, result);
+	}
+
+#if defined(HAVE_NANOSLEEP)
+	{
+		struct timespec req;
+
+		req.tv_sec = secs;
+		req.tv_nsec = (secs-(double)req.tv_sec)*1000000000.0;
+		if ((rc = nanosleep(&req,NULL)) < 0)
+			/* probably interrupted */
+			update_ERRNO_int(errno);
+	}
+#elif defined(HAVE_SELECT)
+	{
+		struct timeval timeout;
+
+		timeout.tv_sec = secs;
+		timeout.tv_usec = (secs-(double)timeout.tv_sec)*1000000.0;
+		if ((rc = select(0,NULL,NULL,NULL,&timeout)) < 0)
+			/* probably interrupted */
+			update_ERRNO_int(errno);
+	}
+#else
+	/* no way to sleep on this platform */
+	rc = -1;
+	set_ERRNO("sleep: not supported on this platform");
+#endif
+
+	return make_number(rc, result);
+}
+
+static awk_ext_func_t func_table[] = {
+	{ "gettimeofday", do_gettimeofday, 0 },
+	{ "sleep", do_sleep, 1 },
+};
+
+/* define the dl_load function using the boilerplate macro */
+
+dl_load_func(func_table, time, "")
diff --git a/gawkapi.c b/gawkapi.c
index 7a79f78..95bcbf1 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -132,7 +132,7 @@ static void
 api_update_ERRNO_string(awk_ext_id_t id, const char *string,
 		awk_bool_t translate)
 {
-	update_ERRNO_string(string, translate);
+	update_ERRNO_string(string, (translate ? TRANSLATE : DONT_TRANSLATE));
 }
 
 static void
diff --git a/test/ChangeLog b/test/ChangeLog
index c4ac50d..72a7c9f 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
+
+	* Makefile.am (EXTRA_DIST): Add new files time.awk and time.ok.
+	(SHLIB_TESTS): Add time.
+	* time.awk, time.ok: New files.
+
 2012-05-29         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* Makefile.am (clean): Add readfile.ok to list of files to removed.
diff --git a/test/Makefile.am b/test/Makefile.am
index 348d4df..6c65ae3 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -757,6 +757,8 @@ EXTRA_DIST = \
 	synerr1.ok \
 	synerr2.awk \
 	synerr2.ok \
+	time.awk \
+	time.ok \
 	tradanch.awk \
 	tradanch.in \
 	tradanch.ok \
@@ -882,7 +884,7 @@ LOCALE_CHARSET_TESTS = \
 	asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \
 	mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc
 
-SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs
+SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs time
 
 # List of the tests which should be run with --lint option:
 NEED_LINT = \
diff --git a/test/Makefile.in b/test/Makefile.in
index 0afe5e0..2ec9024 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -969,6 +969,8 @@ EXTRA_DIST = \
 	synerr1.ok \
 	synerr2.awk \
 	synerr2.ok \
+	time.awk \
+	time.ok \
 	tradanch.awk \
 	tradanch.in \
 	tradanch.ok \
@@ -1090,7 +1092,7 @@ LOCALE_CHARSET_TESTS = \
 	asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \
 	mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc
 
-SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs
+SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs time
 
 # List of the tests which should be run with --lint option:
 NEED_LINT = \
@@ -3179,6 +3181,11 @@ filefuncs:
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
+time:
+	@echo $@
+	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
 # end of file Maketests
 
 # Targets generated for other tests:
diff --git a/test/Maketests b/test/Maketests
index 6856b87..64cd8e7 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1219,4 +1219,9 @@ filefuncs:
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
+time:
+	@echo $@
+	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
 # end of file Maketests
diff --git a/test/time.awk b/test/time.awk
new file mode 100644
index 0000000..eeabc7b
--- /dev/null
+++ b/test/time.awk
@@ -0,0 +1,12 @@
+@load "time"
+
+BEGIN {
+   delta = 1.3
+   printf "gettimeofday - systime = %d\n", (t0 = gettimeofday())-systime()
+   printf "sleep(%s) = %s\n",delta,sleep(delta)
+   printf "gettimeofday - systime = %d\n", (t1 = gettimeofday())-systime()
+   slept = t1-t0
+   if ((slept < 0.9*delta) || (slept > 1.3*delta))
+      printf "Warning: tried to sleep %.2f secs, but slept for %.2f secs\n",
+	     delta,slept
+}
diff --git a/test/time.ok b/test/time.ok
new file mode 100644
index 0000000..46606bf
--- /dev/null
+++ b/test/time.ok
@@ -0,0 +1,3 @@
+gettimeofday - systime = 0
+sleep(1.3) = 0
+gettimeofday - systime = 0

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                 |    5 ++
 awklib/eg/lib/gettime.awk |    4 +-
 awklib/eg/prog/alarm.awk  |    4 +-
 doc/ChangeLog             |    5 ++
 doc/gawk.info             |   38 +++++-----
 doc/gawk.texi             |   24 +++---
 extension/ChangeLog       |    7 ++
 extension/Makefile.am     |    5 +-
 extension/Makefile.in     |   21 ++++--
 extension/configh.in      |   21 ++++++
 extension/configure       |  117 +++++++++++++++++++++++++++++++
 extension/configure.ac    |    6 +-
 extension/time.c          |  167 +++++++++++++++++++++++++++++++++++++++++++++
 gawkapi.c                 |    2 +-
 test/ChangeLog            |    6 ++
 test/Makefile.am          |    4 +-
 test/Makefile.in          |    9 ++-
 test/Maketests            |    5 ++
 test/time.awk             |   12 +++
 test/time.ok              |    3 +
 20 files changed, 417 insertions(+), 48 deletions(-)
 create mode 100644 extension/time.c
 create mode 100644 test/time.awk
 create mode 100644 test/time.ok


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Sun Jun 10 21:08:18 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sdt7C-0000zl-Kk
	for mharc-gawk-diffs@gnu.org; Sun, 10 Jun 2012 21:08:18 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47313)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdt7A-0000z6-8W
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 21:08:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdt78-0006Az-E5
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 21:08:15 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:33097)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdt78-0006As-AH
	for gawk-diffs@gnu.org; Sun, 10 Jun 2012 21:08:14 -0400
Received: from ajschorr by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1Sdt77-00014n-KA
	for gawk-diffs@gnu.org; Mon, 11 Jun 2012 01:08:13 +0000
Date: Mon, 11 Jun 2012 01:08:13 +0000
Message-Id: <E1Sdt77-00014n-KA@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 7891af5ec56ff4ed99435433c135079a9e24e037
X-Git-Newrev: 5472c2cc2889aab121c32ed4ca6bd831ae520d89
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 5472c2cc2889aab121c32ed4ca6bd831ae520d89
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 11 Jun 2012 01:08:17 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  5472c2cc2889aab121c32ed4ca6bd831ae520d89 (commit)
      from  7891af5ec56ff4ed99435433c135079a9e24e037 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=5472c2cc2889aab121c32ed4ca6bd831ae520d89

commit 5472c2cc2889aab121c32ed4ca6bd831ae520d89
Author: Andrew J. Schorr <aschorr@telemetry-investments.com>
Date:   Sun Jun 10 21:07:43 2012 -0400

    Update TODO.xgawk to show that the time extension has been added.

diff --git a/ChangeLog b/ChangeLog
index 253daee..533847c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
 
+	* TODO.xgawk: Addition of time extension moved to "done" section.
+
+2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
+
 	* gawkapi.c (api_update_ERRNO_string): Treat boolean true as a request
 	for TRANSLATE, and false as DONT_TRANSLATE.
 
diff --git a/TODO.xgawk b/TODO.xgawk
index 3a600a7..a2f78e8 100644
--- a/TODO.xgawk
+++ b/TODO.xgawk
@@ -10,10 +10,6 @@ To-do list for xgawk enhancements:
 - Attempting to load the same file with -f and -i (or @include) should
   be a fatal error.
 
-- Add time extension to the gawk distro. This defines sleep and gettimeofday.
-  Rename existing gettimeofday by adding some underscores.  Awaiting
-  confirmation of copyright assignment from FSF...
-
 - Develop a libgawk shared library for use by extensions.  Should this
   be hosted in a separate project?
 
@@ -161,3 +157,6 @@ Done:
   stuff in there.
 
 - Running "make install" should install gawkapi.h in /usr/include.
+
+- Add time extension to the gawk distro. This defines sleep and gettimeofday.
+  Renamed existing gettimeofday to getlocaltime.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog  |    4 ++++
 TODO.xgawk |    7 +++----
 2 files changed, 7 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Tue Jun 12 16:12:33 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SeXS5-0004lT-S9
	for mharc-gawk-diffs@gnu.org; Tue, 12 Jun 2012 16:12:33 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52846)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SeXRx-0004l9-BH
	for gawk-diffs@gnu.org; Tue, 12 Jun 2012 16:12:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SeXRp-0001Zu-0M
	for gawk-diffs@gnu.org; Tue, 12 Jun 2012 16:12:24 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:54112)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SeXRo-0001Zg-Qo
	for gawk-diffs@gnu.org; Tue, 12 Jun 2012 16:12:16 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1SeXRj-0006Kp-PY
	for gawk-diffs@gnu.org; Tue, 12 Jun 2012 20:12:15 +0000
Date: Tue, 12 Jun 2012 20:12:14 +0000
Message-Id: <E1SeXRj-0006Kp-PY@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 5472c2cc2889aab121c32ed4ca6bd831ae520d89
X-Git-Newrev: 8ce87087172ee5be4ee72a1513daad3821185bf7
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 8ce87087172ee5be4ee72a1513daad3821185bf7
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 12 Jun 2012 20:12:33 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  8ce87087172ee5be4ee72a1513daad3821185bf7 (commit)
       via  820b6a2ccb7859e15ade36af6ac1d0d08c1da4b1 (commit)
       via  b4a2d75b7d9fd23069a55dc91a42f7fddd0c7570 (commit)
       via  21a01e3ad4e2e77dccf73e8fd069370749880757 (commit)
      from  5472c2cc2889aab121c32ed4ca6bd831ae520d89 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=8ce87087172ee5be4ee72a1513daad3821185bf7

commit 8ce87087172ee5be4ee72a1513daad3821185bf7
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 12 23:11:37 2012 +0300

    More API implementations and testext improvements.

diff --git a/ChangeLog b/ChangeLog
index d6bad9e..1b071e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,12 @@
 2012-06-12         Arnold D. Robbins     <arnold@skeeve.com>
 
+	API Work:
+
 	* gawkapi.h (awk_value_t): Restore union.
 	(get_curfunc_param): Renamed to get_argument. Return type changed
 	to awk_bool_t. Semantics better thought out and documented.
 	(awk_atexit, get_array_element): Return type now void.
 	(sym_lookup): Return type now void. Argument order rationalized.
-
 	* gawkapi.c (node_to_awk_value): Return type is now awk_bool_t.
 	Semantics now match table in gawkawpi.h.
 	(api_awk_atexit): Return type now void.
@@ -13,6 +14,21 @@
 	order.
 	(api_get_array_element): Return type is now awk_bool_t.
 
+	Further API implementations and fixes for extension/testext.c:
+
+	* awk.h (final_exit): Add declaration.
+	* ext.c (load_ext): Change `func' to install_func.
+	* gawkapi.c: Add casts to void for id param in all functions.
+	(api_sym_update): Finish implementation.
+	(api_get_array_element): Start implementation.
+	(api_set_array_element): Add error checking.
+	(api_get_element_count): Add error checking, return the right value.
+	* main.c (main): Call final_exit instead of exit.
+	(arg_assign): Ditto.
+	* msg.c (final_exit): New routine to run the exit handlers and exit.
+	(gawk_exit): Call it.
+	* profile.c (dump_and_exit): Ditto.
+
 2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
 
 	* TODO.xgawk: Addition of time extension moved to "done" section.
diff --git a/awk.h b/awk.h
index d8aa238..6c1e706 100644
--- a/awk.h
+++ b/awk.h
@@ -1604,6 +1604,7 @@ extern int mpg_strtoui(mpz_ptr, char *, size_t, char **, int);
 #endif
 /* msg.c */
 extern void gawk_exit(int status);
+extern void final_exit(int status) ATTRIBUTE_NORETURN;
 extern void err(const char *s, const char *emsg, va_list argp) ATTRIBUTE_PRINTF(2, 0);
 extern void msg (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
 extern void error (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
diff --git a/ext.c b/ext.c
index 66ea7fb..d0755cc 100644
--- a/ext.c
+++ b/ext.c
@@ -60,7 +60,7 @@ do_ext(int nargs)
 NODE *
 load_ext(const char *lib_name, const char *init_func)
 {
-	int (*func)(const gawk_api_t *const, awk_ext_id_t);
+	int (*install_func)(const gawk_api_t *const, awk_ext_id_t);
 	void *dl;
 	int flags = RTLD_LAZY;
 	int *gpl_compat;
@@ -80,12 +80,13 @@ load_ext(const char *lib_name, const char *init_func)
 	if (gpl_compat == NULL)
 		fatal(_("load_ext: library `%s': does not define `plugin_is_GPL_compatible' (%s)\n"),
 				lib_name, dlerror());
-	func = (int (*)(const gawk_api_t *const, awk_ext_id_t)) dlsym(dl, init_func);
-	if (func == NULL)
+	install_func = (int (*)(const gawk_api_t *const, awk_ext_id_t))
+				dlsym(dl, init_func);
+	if (install_func == NULL)
 		fatal(_("load_ext: library `%s': cannot call function `%s' (%s)\n"),
 				lib_name, init_func, dlerror());
 
-	if ((*func)(& api_impl, NULL /* ext_id */) == 0) {
+	if (install_func(& api_impl, NULL /* ext_id */) == 0) {
 		warning(_("load_ext: library `%s' initialization routine `%s' failed\n"),
 				lib_name, init_func);
 		return make_number(-1);
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 6c4ea84..4d504fb 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,5 +1,7 @@
 2012-06-12         Arnold D. Robbins     <arnold@skeeve.com>
 
+	Revise API:
+
 	* filefuncs.c (do_chdir): Replace get_curfunc_param with get_argument.
 	(format_mode): Use unsigned masks.
 	(do_stat): Replace get_curfunc_param with get_argument.
@@ -10,6 +12,14 @@
 	* time.c (do_sleep): Replace get_curfunc_param with get_argument.
 	Replace set_ERRNO with update_ERRNO_str for no way to sleep case.
 
+	Work on testext.c:
+
+	* Makefile.am: Add stuff to make testext. Remove doit and steps
+	from EXTRA_DIST.
+	* testext.c: Fill in many of the test routines. Still more to do.
+	Fix up test scripts for each routine.
+	* time.c (do_sleep): Fix use of get_argument to be boolean.
+
 2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
 
 	* Makefile.am: Add time extension.
diff --git a/extension/Makefile.am b/extension/Makefile.am
index f2b30ed..bdb1bd1 100644
--- a/extension/Makefile.am
+++ b/extension/Makefile.am
@@ -36,6 +36,7 @@ pkgextension_LTLIBRARIES =	\
 	fork.la		\
 	ordchr.la	\
 	readfile.la	\
+	testext.la	\
 	time.la
 
 MY_MODULE_FLAGS = -module -avoid-version -no-undefined
@@ -50,12 +51,12 @@ readfile_la_SOURCES   = readfile.c
 readfile_la_LDFLAGS   = $(MY_MODULE_FLAGS)
 time_la_SOURCES       = time.c
 time_la_LDFLAGS       = $(MY_MODULE_FLAGS)
+testext_la_SOURCES       = testext.c
+testext_la_LDFLAGS       = $(MY_MODULE_FLAGS)
 #rwarray_la_SOURCES    = rwarray.c
 #rwarray_la_LDFLAGS    = $(MY_MODULE_FLAGS)
 
 EXTRA_DIST = \
 	ChangeLog \
 	ChangeLog.0 \
-	*.awk \
-	doit \
-	steps
+	*.awk
diff --git a/extension/Makefile.in b/extension/Makefile.in
index 5952891..202989a 100644
--- a/extension/Makefile.in
+++ b/extension/Makefile.in
@@ -154,6 +154,12 @@ readfile_la_OBJECTS = $(am_readfile_la_OBJECTS)
 readfile_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(readfile_la_LDFLAGS) $(LDFLAGS) -o $@
+testext_la_LIBADD =
+am_testext_la_OBJECTS = testext.lo
+testext_la_OBJECTS = $(am_testext_la_OBJECTS)
+testext_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(testext_la_LDFLAGS) $(LDFLAGS) -o $@
 time_la_LIBADD =
 am_time_la_OBJECTS = time.lo
 time_la_OBJECTS = $(am_time_la_OBJECTS)
@@ -174,9 +180,11 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(filefuncs_la_SOURCES) $(fork_la_SOURCES) \
-	$(ordchr_la_SOURCES) $(readfile_la_SOURCES) $(time_la_SOURCES)
+	$(ordchr_la_SOURCES) $(readfile_la_SOURCES) \
+	$(testext_la_SOURCES) $(time_la_SOURCES)
 DIST_SOURCES = $(filefuncs_la_SOURCES) $(fork_la_SOURCES) \
-	$(ordchr_la_SOURCES) $(readfile_la_SOURCES) $(time_la_SOURCES)
+	$(ordchr_la_SOURCES) $(readfile_la_SOURCES) \
+	$(testext_la_SOURCES) $(time_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -329,6 +337,7 @@ pkgextension_LTLIBRARIES = \
 	fork.la		\
 	ordchr.la	\
 	readfile.la	\
+	testext.la	\
 	time.la
 
 MY_MODULE_FLAGS = -module -avoid-version -no-undefined
@@ -342,14 +351,14 @@ readfile_la_SOURCES = readfile.c
 readfile_la_LDFLAGS = $(MY_MODULE_FLAGS)
 time_la_SOURCES = time.c
 time_la_LDFLAGS = $(MY_MODULE_FLAGS)
+testext_la_SOURCES = testext.c
+testext_la_LDFLAGS = $(MY_MODULE_FLAGS)
 #rwarray_la_SOURCES    = rwarray.c
 #rwarray_la_LDFLAGS    = $(MY_MODULE_FLAGS)
 EXTRA_DIST = \
 	ChangeLog \
 	ChangeLog.0 \
-	*.awk \
-	doit \
-	steps
+	*.awk
 
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -447,6 +456,8 @@ ordchr.la: $(ordchr_la_OBJECTS) $(ordchr_la_DEPENDENCIES) $(EXTRA_ordchr_la_DEPE
 	$(ordchr_la_LINK) -rpath $(pkgextensiondir) $(ordchr_la_OBJECTS) $(ordchr_la_LIBADD) $(LIBS)
 readfile.la: $(readfile_la_OBJECTS) $(readfile_la_DEPENDENCIES) $(EXTRA_readfile_la_DEPENDENCIES) 
 	$(readfile_la_LINK) -rpath $(pkgextensiondir) $(readfile_la_OBJECTS) $(readfile_la_LIBADD) $(LIBS)
+testext.la: $(testext_la_OBJECTS) $(testext_la_DEPENDENCIES) $(EXTRA_testext_la_DEPENDENCIES) 
+	$(testext_la_LINK) -rpath $(pkgextensiondir) $(testext_la_OBJECTS) $(testext_la_LIBADD) $(LIBS)
 time.la: $(time_la_OBJECTS) $(time_la_DEPENDENCIES) $(EXTRA_time_la_DEPENDENCIES) 
 	$(time_la_LINK) -rpath $(pkgextensiondir) $(time_la_OBJECTS) $(time_la_LIBADD) $(LIBS)
 
@@ -460,6 +471,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fork.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ordchr.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testext.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Plo@am__quote@
 
 .c.o:
diff --git a/extension/testext.c b/extension/testext.c
index 5b171e8..fa8dbf6 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -50,18 +50,20 @@ int plugin_is_GPL_compatible;
  */
 
 /*
-@load testext
-BEGIN {
-	dump_procinfo()
-}
+#@load "testext"
+#BEGIN {
+#	dump_procinfo()
+#}
 */
 static awk_value_t *
 dump_procinfo(int nargs, awk_value_t *result)
 {
 	/* get PROCINFO as flat array and print it */
+	return result;
 }
 
 /*
+@load "testext"
 BEGIN {
 	testvar = "One Adam Twelve"
 	ret = var_test("testvar")
@@ -72,19 +74,45 @@ BEGIN {
 static awk_value_t *
 var_test(int nargs, awk_value_t *result)
 {
-	awk_value_t value;
+	awk_value_t value, value2;
+	awk_value_t *valp;
 
-	if (nargs != 1 || result == NULL)
+	if (nargs != 1 || result == NULL) {
+		printf("var_test: nargs not right (%d should be 1) or result == NULL\n", nargs);
 		return NULL;
+	}
 
 	/* look up a reserved variable - should fail */
-	if (sym_lookup("ARGC", & value, AWK_NUMBER) != NULL)
+	if (sym_lookup("ARGC", AWK_NUMBER, & value))
 		printf("var_test: sym_lookup of ARGC failed - got a value!\n");
 	else
 		printf("var_test: sym_lookup of ARGC passed\n");
 
 	/* look up variable whose name is passed in, should pass */
-	/* change the value, should be reflected in awk script */
+	if (get_argument(0, AWK_STRING, & value)) {
+		if (sym_lookup(value.str_value.str, AWK_STRING, & value2)) {
+			/* change the value, should be reflected in awk script */
+			valp = make_number(42.0, & value2);
+
+			if (sym_update(value.str_value.str, valp)) {
+				printf("var_test: sym_update(\"%s\") succeeded\n", value.str_value.str);
+			} else {
+				printf("var_test: sym_update(\"%s\") failed\n", value.str_value.str);
+				return NULL;
+			}
+		} else {
+			printf("var_test: sym_lookup(\"%s\") failed\n", value.str_value.str);
+			return NULL;
+		}
+	} else {
+		printf("var_test: get_argument() failed\n");
+		return NULL;
+	}
+
+	result->val_type = AWK_NUMBER;
+	result->num_value = 1.0;
+
+	return result;
 }
 
 /*
@@ -97,7 +125,17 @@ BEGIN {
 static awk_value_t *
 test_errno(int nargs, awk_value_t *result)
 {
+	if (nargs != 0 || result == NULL) {
+		printf("test_errno: nargs not right (%d should be 0) or result == NULL\n", nargs);
+		return NULL;
+	}
+
 	update_ERRNO_int(ECHILD);
+
+	result->val_type = AWK_NUMBER;
+	result->num_value = 1.0;
+
+	return result;
 }
 
 /*
@@ -105,7 +143,7 @@ BEGIN {
 	for (i = 1; i <= 10; i++)
 		test_array[i] = i + 2
 
-	printf ("length of test_array is %d, should be 10\n", length(test_array)
+	printf ("length of test_array is %d, should be 10\n", length(test_array))
 	ret = test_array_size(test_array);
 	printf "test_array_size() returned %d, length is now %d\n", ret, length(test_array)
 }
@@ -114,24 +152,62 @@ BEGIN {
 static awk_value_t *
 test_array_size(int nargs, awk_value_t *result)
 {
+	awk_value_t value;
+	size_t count = 0;
+
+	if (nargs != 1 || result == NULL) {
+		printf("test_array_size: nargs not right (%d should be 0) or result == NULL\n", nargs);
+		return NULL;
+	}
+
 	/* get element count and print it; should match length(array) from awk script */
+	if (! get_argument(0, AWK_ARRAY, & value)) {
+		printf("test_array_size: get_argument failed\n");
+		return NULL;
+	}
+
+	if (! get_element_count(value.array_cookie, & count)) {
+		printf("test_array_size: get_element_count failed\n");
+		return NULL;
+	}
+
+	printf("test_array_size: incoming size is %lu\n", (unsigned long) count);
+
 	/* clear array - length(array) should then go to zero in script */
+	if (! clear_array(value.array_cookie)) {
+		printf("test_array_size: clear_array failed\n");
+		return NULL;
+	}
+
+	result->val_type = AWK_NUMBER;
+	result->num_value = 1.0;
+
+	return result;
 }
 
 /*
-BEGIN {
-	n = split("one two three four five six", test_array2)
-	ret = test_array_elem(test_array2, "3")
-	printf "test_array_elem() returned %d, test_array2[3] = %g\n", ret, test_array2[3]
-}
+#BEGIN {
+#	n = split("one two three four five six", test_array2)
+#	ret = test_array_elem(test_array2, "3")
+#	printf "test_array_elem() returned %d, test_array2[3] = %g\n", ret, test_array2[3]
+#	if ("5" in test_array2)
+#		printf "error: test_array_elem did not remove element \"5\"\n"
+#	else
+#		printf "test_array_elem did remove element \"5\"\n"
+#}
 */
 static awk_value_t *
 test_array_elem(int nargs, awk_value_t *result)
 {
+	if (nargs != 2 || result == NULL) {
+		printf("test_array_elem: nargs not right (%d should be 2) or result == NULL\n", nargs);
+		return NULL;
+	}
 	/* look up an array element and print the value */
-	/* change the element */
-	/* delete another element */
+	/* change the element - "3" */
+	/* delete another element - "5" */
 	/* change and deletion should be reflected in awk script */
+	return result;
 }
 
 /*
@@ -148,7 +224,17 @@ BEGIN {
 static awk_value_t *
 print_do_lint(int nargs, awk_value_t *result)
 {
+	if (nargs != 0 || result == NULL) {
+		printf("print_do_lint: nargs not right (%d should be 0) or result == NULL\n", nargs);
+		return NULL;
+	}
+
 	printf("print_do_lint: lint = %d\n", do_lint);
+
+	result->val_type = AWK_NUMBER;
+	result->num_value = 1.0;
+
+	return result;
 }
 
 static void at_exit0(void *data, int exit_status)
@@ -157,7 +243,7 @@ static void at_exit0(void *data, int exit_status)
 	if (data)
 		printf(" data = %p,", data);
 	else
-		printf(" data = <null>,");
+		printf(" data = NULL,");
 	printf(" exit_status = %d\n", exit_status);
 }
 
@@ -173,7 +259,7 @@ static void at_exit1(void *data, int exit_status)
 		else
 			printf(" (data is NOT & data_for_1),");
 	} else
-		printf(" data = <null>,");
+		printf(" data = NULL,");
 	printf(" exit_status = %d\n", exit_status);
 }
 
@@ -183,7 +269,7 @@ static void at_exit2(void *data, int exit_status)
 	if (data)
 		printf(" data = %p,", data);
 	else
-		printf(" data = <null>,");
+		printf(" data = NULL,");
 	printf(" exit_status = %d\n", exit_status);
 }
 
diff --git a/extension/time.c b/extension/time.c
index 09e71d0..a12a05d 100644
--- a/extension/time.c
+++ b/extension/time.c
@@ -116,7 +116,7 @@ do_sleep(int nargs, awk_value_t *result)
 	if  (do_lint && nargs > 1)
 		lintwarn(ext_id, "sleep: called with too many arguments");
 
-	if (get_argument(0, AWK_NUMBER, &num) == NULL) {
+	if (! get_argument(0, AWK_NUMBER, &num)) {
 		update_ERRNO_string("sleep: missing required numeric argument", 1);
 		return make_number(-1, result);
 	}
diff --git a/gawkapi.c b/gawkapi.c
index 885d514..3f9159d 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -42,6 +42,8 @@ api_get_argument(awk_ext_id_t id, size_t count,
 	if (result == NULL)
 		return false;
 
+	(void) id;
+
 	arg = (wanted == AWK_ARRAY
 			? get_array_argument(count, false)
 			: get_scalar_argument(count, false) );
@@ -81,10 +83,16 @@ awk_value_to_node(const awk_value_t *retval)
 
 /* Functions to print messages */
 /* FIXME: Code duplicate from msg.c. Fix this. */
+
+/* api_fatal --- print a fatal message and exit */
+
 static void
 api_fatal(awk_ext_id_t id, const char *format, ...)
 {
 	va_list args;
+
+	(void) id;
+
 	va_start(args, format);
 	err(_("fatal: "), format, args);
 	va_end(args);
@@ -94,19 +102,29 @@ api_fatal(awk_ext_id_t id, const char *format, ...)
 	gawk_exit(EXIT_FATAL);
 }
 
+/* api_warning --- print a warning message and exit */
+
 static void
 api_warning(awk_ext_id_t id, const char *format, ...)
 {
 	va_list args;
+
+	(void) id;
+
 	va_start(args, format);
 	err(_("warning: "), format, args);
 	va_end(args);
 }
 
+/* api_lintwarn --- print a lint warning message and exit if appropriate */
+
 static void
 api_lintwarn(awk_ext_id_t id, const char *format, ...)
 {
 	va_list args;
+
+	(void) id;
+
 	va_start(args, format);
 	if (lintwarn == r_fatal) {
 		err(_("fatal: "), format, args);
@@ -121,31 +139,47 @@ api_lintwarn(awk_ext_id_t id, const char *format, ...)
 	}
 }
 
-/* Register an open hook; for opening files read-only */
+/* api_register_open_hook --- register an open hook; for opening files read-only */
 
 static void
 api_register_open_hook(awk_ext_id_t id, void* (*open_func)(IOBUF *))
 {
+	(void) id;
+
 	register_open_hook(open_func);
 }
 
 /* Functions to update ERRNO */
+
+/* api_update_ERRNO_int --- update ERRNO with an integer value */
+
 static void
 api_update_ERRNO_int(awk_ext_id_t id, int errno_val)
 {
+	(void) id;
+
 	update_ERRNO_int(errno_val);
 }
 
+/* api_update_ERRNO_string --- update ERRNO with a string value */
+
 static void
-api_update_ERRNO_string(awk_ext_id_t id, const char *string,
-		awk_bool_t translate)
+api_update_ERRNO_string(awk_ext_id_t id,
+			const char *string,
+			awk_bool_t translate)
 {
+	(void) id;
+
 	update_ERRNO_string(string, (translate ? TRANSLATE : DONT_TRANSLATE));
 }
 
+/* api_unset_ERRNO --- unset ERRNO */
+
 static void
 api_unset_ERRNO(awk_ext_id_t id)
 {
+	(void) id;
+
 	unset_ERRNO();
 }
 
@@ -157,6 +191,9 @@ api_add_ext_func(awk_ext_id_t id,
 		const awk_ext_func_t *func,
 		const char *namespace)
 {
+	(void) id;
+	(void) namespace;
+
 	return make_builtin(func);
 }
 
@@ -193,6 +230,8 @@ api_awk_atexit(awk_ext_id_t id,
 {
 	struct ext_exit_handler *p;
 
+	(void) id;
+
 	/* allocate memory */
 	emalloc(p, struct ext_exit_handler *, sizeof(struct ext_exit_handler), "api_awk_atexit");
 
@@ -300,6 +339,9 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
  * In the latter case, fills in vaule->val_type with the real type.
  * Built-in variables (except PROCINFO) may not be accessed by an extension.
  */
+
+/* api_sym_lookup --- look up a symbol */
+
 static awk_bool_t
 api_sym_lookup(awk_ext_id_t id,
 		const char *name,
@@ -318,27 +360,13 @@ api_sym_lookup(awk_ext_id_t id,
 	return node_to_awk_value(node, result, wanted);
 }
 
-/* api_sym_update --- update a value, see gawkapi.h for semantics */
+/* api_sym_update --- update a symbol's value, see gawkapi.h for semantics */
 
 static awk_bool_t
 api_sym_update(awk_ext_id_t id, const char *name, awk_value_t *value)
 {
 	NODE *node;
 
-	if (   name == NULL
-	    || *name == '\0'
-	    || value == NULL
-	    || is_off_limits_var(name))	/* most built-in vars not allowed */
-		return false;
-
-	node = lookup(name);
-
-	if (node == NULL) {
-		/* new value to be installed */
-	} else {
-		/* existing value to be updated */
-	}
-
 	switch (value->val_type) {
 	case AWK_NUMBER:
 	case AWK_STRING:
@@ -349,11 +377,27 @@ api_sym_update(awk_ext_id_t id, const char *name, awk_value_t *value)
 		return false;
 
 	default:
-		fatal(_("api_sym_update: invalid value for type of new value (%d)"), value->val_type);
+		/* fatal(_("api_sym_update: invalid value for type of new value (%d)"), value->val_type); */
 		return false;
 	}
 
-	return true;	/* for now */
+	if (   name == NULL
+	    || *name == '\0'
+	    || is_off_limits_var(name)	/* most built-in vars not allowed */
+	    || value == NULL)
+		return false;
+
+	node = lookup(name);
+
+	if (node == NULL) {
+		/* new value to be installed */
+		node = install_symbol((char *) name, Node_var);
+	}
+	unref(node->var_value);
+
+	node->var_value = awk_value_to_node(value);
+
+	return true;
 }
 
 /* Array management */
@@ -366,6 +410,21 @@ api_get_array_element(awk_ext_id_t id,
 		awk_array_t a_cookie, const awk_value_t *const index,
 		awk_valtype_t wanted, awk_value_t *result)
 {
+	NODE *array;
+	NODE *subscript;
+
+	/* don't check for index len zero, null str is ok as index */
+	if (   a_cookie == NULL
+	    || result == NULL
+	    || index == NULL
+	    || index->val_type != AWK_STRING
+	    || index->str_value.str == NULL)
+		return false;
+
+	array = (NODE *) a_cookie;
+	subscript = awk_value_to_node(index);
+	/* FIXME: write rest of code */
+
 	return true;	/* for now */
 }
 
@@ -381,6 +440,12 @@ api_set_array_element(awk_ext_id_t id, awk_array_t a_cookie,
 	NODE *tmp;
 	NODE **aptr;
 
+	/* don't check for index len zero, null str is ok as index */
+	if (   a_cookie == NULL
+	    || element == NULL
+	    || element->index.str == NULL)
+		return false;
+
 	tmp = make_string(element->index.str, element->index.len);
 	aptr = assoc_lookup(array, tmp);
 	unref(tmp);
@@ -410,10 +475,10 @@ api_get_element_count(awk_ext_id_t id,
 {
 	NODE *node = (NODE *) a_cookie;
 
-	if (node == NULL || node->type != Node_var_array)
+	if (count == NULL || node == NULL || node->type != Node_var_array)
 		return false;
 
-	*count = node->array_size;
+	*count = node->table_size;
 	return true;
 }
 
diff --git a/main.c b/main.c
index 91da77d..b3f7f9e 100644
--- a/main.c
+++ b/main.c
@@ -731,7 +731,7 @@ out:
 	if (extra_stack)
 		efree(extra_stack);
 
-	exit(exit_val);		/* more portable */
+	final_exit(exit_val);
 	return exit_val;	/* to suppress warnings */
 }
 
@@ -1318,7 +1318,7 @@ arg_assign(char *arg, bool initing)
 
 		var = variable(0, cp2, Node_var);
 		if (var == NULL)	/* error */
-			exit(EXIT_FATAL);
+			final_exit(EXIT_FATAL);
 		if (var->type == Node_var && var->var_update)
 			var->var_update();
 		lhs = get_lhs(var, false);
diff --git a/msg.c b/msg.c
index 22cf556..b94e840 100644
--- a/msg.c
+++ b/msg.c
@@ -159,6 +159,14 @@ gawk_exit(int status)
 		longjmp(fatal_tag, 1);
 	}
 
+	final_exit(status);
+}
+
+/* final_exit --- run extension exit handlers and exit */
+
+void
+final_exit(int status)
+{
 	/* run any extension exit handlers */
 	run_ext_exit_handlers(status);
 
diff --git a/profile.c b/profile.c
index 15c9879..16aa1cd 100644
--- a/profile.c
+++ b/profile.c
@@ -922,7 +922,7 @@ static RETSIGTYPE
 dump_and_exit(int signum)
 {
 	just_dump(signum);
-	exit(EXIT_FAILURE);
+	final_exit(EXIT_FAILURE);
 }
 
 

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=820b6a2ccb7859e15ade36af6ac1d0d08c1da4b1

commit 820b6a2ccb7859e15ade36af6ac1d0d08c1da4b1
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 12 22:10:31 2012 +0300

    Further cleanups and improvements in API.

diff --git a/ChangeLog b/ChangeLog
index fb7b6ae..d6bad9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2012-06-12         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* gawkapi.h (awk_value_t): Restore union.
+	(get_curfunc_param): Renamed to get_argument. Return type changed
+	to awk_bool_t. Semantics better thought out and documented.
+	(awk_atexit, get_array_element): Return type now void.
+	(sym_lookup): Return type now void. Argument order rationalized.
+
+	* gawkapi.c (node_to_awk_value): Return type is now awk_bool_t.
+	Semantics now match table in gawkawpi.h.
+	(api_awk_atexit): Return type now void.
+	(api_sym_lookup): Return type is now awk_bool_t. Change parameter
+	order.
+	(api_get_array_element): Return type is now awk_bool_t.
+
 2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
 
 	* TODO.xgawk: Addition of time extension moved to "done" section.
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 5e513f8..6c4ea84 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,15 @@
+2012-06-12         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* filefuncs.c (do_chdir): Replace get_curfunc_param with get_argument.
+	(format_mode): Use unsigned masks.
+	(do_stat): Replace get_curfunc_param with get_argument.
+	* fork.c (do_fork): Rearrange arg order in call to sym_lookup
+	(do_waitpid): Replace get_curfunc_param with get_argument.
+	* ordchr.c (do_ord, do_chr): Replace get_curfunc_param with get_argument.
+	* readfile.c (do_readfile): Replace get_curfunc_param with get_argument.
+	* time.c (do_sleep): Replace get_curfunc_param with get_argument.
+	Replace set_ERRNO with update_ERRNO_str for no way to sleep case.
+
 2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
 
 	* Makefile.am: Add time extension.
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index 4d38200..12f3acb 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -57,7 +57,7 @@ do_chdir(int nargs, awk_value_t *result)
 	if (do_lint && nargs != 1)
 		lintwarn(ext_id, "chdir: called with incorrect number of arguments, expecting 1");
 
-	if (get_curfunc_param(0, AWK_STRING, & newdir) != NULL) {
+	if (get_argument(0, AWK_STRING, & newdir)) {
 		ret = chdir(newdir.str_value.str);
 		if (ret < 0)
 			update_ERRNO_int(errno);
@@ -73,7 +73,7 @@ format_mode(unsigned long fmode)
 {
 	static char outbuf[12];
 	static struct ftype_map {
-		int mask;
+		unsigned int mask;
 		int charval;
 	} ftype_map[] = {
 		{ S_IFREG, '-' },	/* redundant */
@@ -94,7 +94,7 @@ format_mode(unsigned long fmode)
 #endif /* S_IFDOOR */
 	};
 	static struct mode_map {
-		int mask;
+		unsigned int mask;
 		int rep;
 	} map[] = {
 		{ S_IRUSR, 'r' }, { S_IWUSR, 'w' }, { S_IXUSR, 'x' },
@@ -102,7 +102,7 @@ format_mode(unsigned long fmode)
 		{ S_IROTH, 'r' }, { S_IWOTH, 'w' }, { S_IXOTH, 'x' },
 	};
 	static struct setuid_map {
-		int mask;
+		unsigned int mask;
 		int index;
 		int small_rep;
 		int big_rep;
@@ -243,7 +243,7 @@ do_stat(int nargs, awk_value_t *result)
 	const char *type = "unknown";
 	awk_value_t tmp;
 	static struct ftype_map {
-		int mask;
+		unsigned int mask;
 		const char *type;
 	} ftype_map[] = {
 		{ S_IFREG, "file" },
@@ -270,8 +270,8 @@ do_stat(int nargs, awk_value_t *result)
 	}
 
 	/* file is first arg, array to hold results is second */
-	if (   get_curfunc_param(0, AWK_STRING, & file_param) == NULL
-	    || get_curfunc_param(1, AWK_ARRAY, & array_param) == NULL) {
+	if (   ! get_argument(0, AWK_STRING, & file_param)
+	    || ! get_argument(1, AWK_ARRAY, & array_param)) {
 		warning(ext_id, "stat: bad parameters");
 		return make_number(-1, result);
 	}
diff --git a/extension/fork.c b/extension/fork.c
index 1d4ad82..0c2e31d 100644
--- a/extension/fork.c
+++ b/extension/fork.c
@@ -78,7 +78,7 @@ do_fork(int nargs, awk_value_t *result)
 		/* update PROCINFO in the child, if the array exists */
 		awk_value_t procinfo;
 
-		if (sym_lookup("PROCINFO", & procinfo, AWK_ARRAY) != NULL) {
+		if (sym_lookup("PROCINFO", AWK_ARRAY, & procinfo)) {
 			if (procinfo.val_type != AWK_ARRAY) {
 				if (do_lint)
 					lintwarn(ext_id, "fork: PROCINFO is not an array!");
@@ -105,7 +105,7 @@ do_waitpid(int nargs, awk_value_t *result)
 	if  (do_lint && nargs > 1)
 		lintwarn(ext_id, "waitpid: called with too many arguments");
 
-	if (get_curfunc_param(0, AWK_NUMBER, &pid) != NULL) {
+	if (get_argument(0, AWK_NUMBER, &pid)) {
 		options = WNOHANG|WUNTRACED;
 		ret = waitpid(pid.num_value, NULL, options);
 		if (ret < 0)
diff --git a/extension/ordchr.c b/extension/ordchr.c
index c5d2bb4..dc02479 100644
--- a/extension/ordchr.c
+++ b/extension/ordchr.c
@@ -56,7 +56,7 @@ do_ord(int nargs, awk_value_t *result)
 	if  (do_lint && nargs > 1)
 		lintwarn(ext_id, "ord: called with too many arguments");
 
-	if (get_curfunc_param(0, AWK_STRING, & str) != NULL) {
+	if (get_argument(0, AWK_STRING, & str)) {
 		ret = str.str_value.str[0];
 	} else if (do_lint)
 		lintwarn(ext_id, "ord: called with no arguments");
@@ -80,7 +80,7 @@ do_chr(int nargs, awk_value_t *result)
 	if  (do_lint && nargs > 1)
 		lintwarn(ext_id, "chr: called with too many arguments");
 
-	if (get_curfunc_param(0, AWK_NUMBER, &num) != NULL) {
+	if (get_argument(0, AWK_NUMBER, & num)) {
 		val = num.num_value;
 		ret = val;	/* convert to int */
 		ret &= 0xff;
diff --git a/extension/readfile.c b/extension/readfile.c
index ca51391..166bb8f 100644
--- a/extension/readfile.c
+++ b/extension/readfile.c
@@ -66,7 +66,7 @@ do_readfile(int nargs, awk_value_t *result)
 	if  (do_lint && nargs > 1)
 		lintwarn(ext_id, "readfile: called with too many arguments");
 
-	if (get_curfunc_param(0, AWK_STRING, &filename) != NULL) {
+	if (get_argument(0, AWK_STRING, &filename)) {
 		ret = stat(filename.str_value.str, & sbuf);
 		if (ret < 0) {
 			update_ERRNO_int(errno);
diff --git a/extension/time.c b/extension/time.c
index 4f590c8..09e71d0 100644
--- a/extension/time.c
+++ b/extension/time.c
@@ -116,8 +116,7 @@ do_sleep(int nargs, awk_value_t *result)
 	if  (do_lint && nargs > 1)
 		lintwarn(ext_id, "sleep: called with too many arguments");
 
-
-	if (get_curfunc_param(0, AWK_NUMBER, &num) == NULL) {
+	if (get_argument(0, AWK_NUMBER, &num) == NULL) {
 		update_ERRNO_string("sleep: missing required numeric argument", 1);
 		return make_number(-1, result);
 	}
@@ -151,7 +150,7 @@ do_sleep(int nargs, awk_value_t *result)
 #else
 	/* no way to sleep on this platform */
 	rc = -1;
-	set_ERRNO("sleep: not supported on this platform");
+	update_ERRNO_str("sleep: not supported on this platform", 0);
 #endif
 
 	return make_number(rc, result);
diff --git a/gawkapi.c b/gawkapi.c
index 95bcbf1..885d514 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -25,24 +25,32 @@
 
 #include "awk.h"
 
-static awk_value_t *node_to_awk_value(NODE *node, awk_value_t *result, awk_valtype_t wanted);
+static awk_bool_t node_to_awk_value(NODE *node, awk_value_t *result, awk_valtype_t wanted);
 
 /*
  * Get the count'th paramater, zero-based.
- * Returns NULL if count is out of range, or if actual paramater
- * does not match what is specified in wanted.
+ * Returns false if count is out of range, or if actual paramater
+ * does not match what is specified in wanted. In the latter
+ * case, fills in result->val_type with the actual type.
  */
-static awk_value_t *
-api_get_curfunc_param(awk_ext_id_t id, size_t count,
+static awk_bool_t
+api_get_argument(awk_ext_id_t id, size_t count,
 			awk_valtype_t wanted, awk_value_t *result)
 {
 	NODE *arg;
 
+	if (result == NULL)
+		return false;
+
 	arg = (wanted == AWK_ARRAY
 			? get_array_argument(count, false)
 			: get_scalar_argument(count, false) );
-	if (arg == NULL)
-		return NULL;
+
+	if (arg == NULL) {
+		memset(result, 0, sizeof(*result));
+		result->val_type = AWK_UNDEFINED;
+		return false;
+	}
 
 	return node_to_awk_value(arg, result, wanted);
 }
@@ -142,7 +150,8 @@ api_unset_ERRNO(awk_ext_id_t id)
 }
 
 
-/* Add a function to the interpreter, returns true upon success */
+/* api_add_ext_func --- add a function to the interpreter, returns true upon success */
+
 static awk_bool_t
 api_add_ext_func(awk_ext_id_t id,
 		const awk_ext_func_t *func,
@@ -177,7 +186,7 @@ run_ext_exit_handlers(int exitval)
 
 /* api_awk_atexit --- add an exit call back, returns true upon success */
 
-static awk_bool_t
+static void
 api_awk_atexit(awk_ext_id_t id,
 		void (*funcp)(void *data, int exit_status),
 		void *arg0)
@@ -194,73 +203,87 @@ api_awk_atexit(awk_ext_id_t id,
 	/* add to linked list, LIFO order */
 	p->next = list_head;
 	list_head = p;
-	return true;	/* for now */
 }
 
 /* node_to_awk_value --- convert a node into a value for an extension */
 
-static awk_value_t *
+static awk_bool_t
 node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
 {
-	/* clear out the result */
-	memset(val, 0, sizeof(*val));
+	awk_bool_t ret = false;
 
-	switch (wanted) {
-	case AWK_NUMBER:
-	case AWK_STRING:
-		/* handle it below */
-		break;
-
-	case AWK_UNDEFINED:
-		/* ignore the actual value. weird but could happen */
+	switch (node->type) {
+	case Node_var_new:	/* undefined variable */
 		val->val_type = AWK_UNDEFINED;
-		return val;
-
-	case AWK_ARRAY:
-		if (node->type == Node_var_array) {
-			val->val_type = AWK_ARRAY;
-			val->array_cookie = node;
-
-			return val;
+		if (wanted == AWK_UNDEFINED) {
+			ret = true;
 		}
-		return NULL;
-
-	default:
-		fatal(_("node_to_awk_value: invalid value for `wanted' (%d)"), wanted);
 		break;
-	}
 
-	/* get here only for string or number */
-
-	switch (node->type) {
 	case Node_var:
 		node = node->var_value;
 		/* FALL THROUGH */
 	case Node_val:
-		/* make sure both values are valid */
-		(void) force_number(node);
-		(void) force_string(node);
-
-		if (wanted == AWK_NUMBER) {
+		/* a scalar value */
+		switch (wanted) {
+		case AWK_NUMBER:
 			val->val_type = AWK_NUMBER;
-			val->num_value = get_number_d(node);
-			val->str_value.str = node->stptr;
-			val->str_value.len = node->stlen;
-		} else if (wanted == AWK_STRING) {
+
+			(void) force_number(node);
+			if (node->flags & NUMCUR) {
+				val->num_value = get_number_d(node);
+				ret = true;
+			}
+			break;
+
+		case AWK_STRING:
 			val->val_type = AWK_STRING;
-			val->str_value.str = node->stptr;
-			val->str_value.len = node->stlen;
-			val->num_value = get_number_d(node);
+
+			(void) force_string(node);
+			if (node->flags & STRCUR) {
+				val->str_value.str = node->stptr;
+				val->str_value.len = node->stlen;
+				ret = true;
+			}
+			break;
+
+		case AWK_UNDEFINED:
+			/* return true and actual type for request of undefined */
+			if (node->flags & NUMBER) {
+				val->val_type = AWK_NUMBER;
+				val->num_value = get_number_d(node);
+				ret = true;
+			} else if (node->flags & STRING) {
+				val->val_type = AWK_STRING;
+				val->str_value.str = node->stptr;
+				val->str_value.len = node->stlen;
+				ret = true;
+			} else
+				val->val_type = AWK_UNDEFINED;
+			break;
+
+		case AWK_ARRAY:
+			break;
 		}
-		return val;
+		break;
 
-	case Node_var_new:
 	case Node_var_array:
+		val->val_type = AWK_ARRAY;
+		if (wanted == AWK_ARRAY || wanted == AWK_UNDEFINED) {
+			val->array_cookie = node;
+			ret = true;
+		} else {
+			ret = false;
+		}
+		break;
+
 	default:
+		val->val_type = AWK_UNDEFINED;
+		ret = false;
 		break;
 	}
 
-	return NULL;
+	return ret;
 }
 
 /*
@@ -271,22 +294,26 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
  *	  to scalar or array. 
  */
 /*
- * Lookup a variable, return its value. No messing with the value
- * returned. Return value is NULL if the variable doesn't exist.
- * Built-in variables (except PROCINFO) may not be changed by an extension.
+ * Lookup a variable, fills in value. No messing with the value
+ * returned. Returns false if the variable doesn't exist
+ * or the wrong type was requested.
+ * In the latter case, fills in vaule->val_type with the real type.
+ * Built-in variables (except PROCINFO) may not be accessed by an extension.
  */
-static awk_value_t *
+static awk_bool_t
 api_sym_lookup(awk_ext_id_t id,
-		const char *name, awk_value_t *result,
-		awk_valtype_t wanted)
+		const char *name,
+		awk_valtype_t wanted,
+		awk_value_t *result)
 {
 	NODE *node;
 
 	if (   name == NULL
 	    || *name == '\0'
+	    || result == NULL
 	    || is_off_limits_var(name)	/* most built-in vars not allowed */
 	    || (node = lookup(name)) == NULL)
-		return NULL;
+		return false;
 
 	return node_to_awk_value(node, result, wanted);
 }
@@ -334,12 +361,12 @@ api_sym_update(awk_ext_id_t id, const char *name, awk_value_t *value)
  * Return the value of an element - read only!
  * Use set_array_element to change it.
  */
-static awk_value_t *
+static awk_bool_t
 api_get_array_element(awk_ext_id_t id,
 		awk_array_t a_cookie, const awk_value_t *const index,
-		awk_value_t *result, awk_valtype_t wanted)
+		awk_valtype_t wanted, awk_value_t *result)
 {
-	return NULL;	/* for now */
+	return true;	/* for now */
 }
 
 /*
@@ -438,7 +465,7 @@ gawk_api_t api_impl = {
 	GAWK_API_MINOR_VERSION,
 	{ 0 },			/* do_flags */
 
-	api_get_curfunc_param,
+	api_get_argument,
 
 	api_fatal,
 	api_warning,
diff --git a/gawkapi.h b/gawkapi.h
index 09a1ce7..7e6a66f 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -116,15 +116,18 @@ typedef void *awk_array_t;
 
 /*
  * An awk value. The val_type tag indicates what
- * is contained.  For scalars, gawk fills in both kinds
- * of values and val_type indicates the assigned type.
- * For arrays, the scalar types will be set to zero.
+ * is in the union.
  */
 typedef struct {
 	awk_valtype_t	val_type;
-	awk_string_t	str_value;
-	double		num_value;
-	awk_array_t	array_cookie;
+	union {
+		awk_string_t	s;
+		double		d;
+		awk_array_t	a;
+	} u;
+#define str_value	u.s
+#define num_value	u.d
+#define array_cookie	u.a
 } awk_value_t;
 
 /*
@@ -195,10 +198,27 @@ typedef struct gawk_api {
 
 	/*
 	 * Get the count'th paramater, zero-based.
-	 * Returns NULL if count is out of range, or if actual paramater
-	 * does not match what is specified in wanted.
+	 * Returns false if count is out of range, or if actual paramater
+	 * does not match what is specified in wanted. In that case,
+	 * result->val_type will hold the actual type of what was passed.
+
+	Table entry is type returned:
+
+	                      +-----------------------------------------+
+	                      |               Type Requested:           |
+	                      +----------+----------+-------+-----------+
+	                      |  String  |  Number  | Array | Undefined |
+	+---------+-----------+----------+----------+-------+-----------+
+	| Type    | String    |  String  |   false  | false |   String  |
+	| of      +-----------+----------+----------+-------+-----------+
+	| Actual  | Number    |   false  |  Number  | false |   Number  |
+	| Value:  +-----------+----------+----------+-------+-----------+
+	|         | Array     |   false  |   false  | Array |   Array   |
+	|         +-----------+----------+----------+-------+-----------+
+	|         | Undefined |   false  |   false  | false | Undefined |
+	+---------+-----------+----------+----------+-------+-----------+
 	 */
-	awk_value_t *(*get_curfunc_param)(awk_ext_id_t id, size_t count,
+	awk_bool_t (*get_argument)(awk_ext_id_t id, size_t count,
 					  awk_valtype_t wanted,
 					  awk_value_t *result);
 
@@ -221,7 +241,7 @@ typedef struct gawk_api {
 			const char *namespace);
 
 	/* Add an exit call back, returns true upon success */
-	awk_bool_t (*awk_atexit)(awk_ext_id_t id,
+	void (*awk_atexit)(awk_ext_id_t id,
 			void (*funcp)(void *data, int exit_status),
 			void *arg0);
 
@@ -233,20 +253,23 @@ typedef struct gawk_api {
 	 *	  to scalar or array. 
 	 */
 	/*
-	 * Lookup a variable, return its value. No messing with the value
-	 * returned. Return value is NULL if the variable doesn't exist.
-	 *
-	 * Returns a pointer to a static variable. Correct usage is thus:
+	 * Lookup a variable, fills in value. No messing with the value
+	 * returned. Returns false if the variable doesn't exist
+	 * or the wrong type was requested.
+	 * In the latter case, fills in vaule->val_type with the real type.
+	 * Built-in variables (except PROCINFO) may not be accessed by an extension.
 	 *
 	 * 	awk_value_t val;
-	 * 	if (api->sym_lookup(id, name, &val, wanted) == NULL)
+	 * 	if (! api->sym_lookup(id, name, wanted, & val))
 	 * 		error_code();
 	 *	else {
 	 *		// safe to use val
 	 *	}
 	 */
-	awk_value_t *(*sym_lookup)(awk_ext_id_t id, const char *name, awk_value_t *result,
-			awk_valtype_t wanted);
+	awk_bool_t (*sym_lookup)(awk_ext_id_t id,
+				const char *name,
+				awk_valtype_t wanted,
+				awk_value_t *result);
 
 	/*
 	 * Update a value. Adds it to the symbol table if not there.
@@ -260,10 +283,13 @@ typedef struct gawk_api {
 	/*
 	 * Return the value of an element - read only!
 	 * Use set_array_element() to change it.
+	 * Behavior for value and return is same as for get_argument
+	 * and sym_lookup.
 	 */
-	awk_value_t *(*get_array_element)(awk_ext_id_t id,
+	awk_bool_t (*get_array_element)(awk_ext_id_t id,
 			awk_array_t a_cookie, const awk_value_t *const index,
-			awk_value_t *result, awk_valtype_t wanted);
+			awk_valtype_t wanted,
+			awk_value_t *result);
 
 	/*
 	 * Change (or create) element in existing array with
@@ -321,8 +347,8 @@ typedef struct gawk_api {
 #define do_debug	(api->do_flags[gawk_do_debug])
 #define do_mpfr		(api->do_flags[gawk_do_mpfr])
 
-#define get_curfunc_param(count, wanted, result) \
-	(api->get_curfunc_param(ext_id, count, wanted, result))
+#define get_argument(count, wanted, result) \
+	(api->get_argument(ext_id, count, wanted, result))
 
 #define fatal		api->api_fatal
 #define warning		api->api_warning
diff --git a/test/ChangeLog b/test/ChangeLog
index 72a7c9f..ac8737d 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-12         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* Makefile.am (clean): Add fork.tmp.* to the list.
+
 2012-06-10         Andrew J. Schorr     <aschorr@telemetry-investments.com>
 
 	* Makefile.am (EXTRA_DIST): Add new files time.awk and time.ok.
diff --git a/test/Makefile.am b/test/Makefile.am
index 6c65ae3..6b052f1 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1588,7 +1588,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests
 	$(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests
 
 clean:
-	rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok
+	rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.*
 
 # An attempt to print something that can be grepped for in build logs
 pass-fail:
diff --git a/test/Makefile.in b/test/Makefile.in
index 2ec9024..05f9db1 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -3195,7 +3195,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests
 	$(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests
 
 clean:
-	rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok
+	rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.*
 
 # An attempt to print something that can be grepped for in build logs
 pass-fail:

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=b4a2d75b7d9fd23069a55dc91a42f7fddd0c7570

commit b4a2d75b7d9fd23069a55dc91a42f7fddd0c7570
Merge: 21a01e3 5472c2c
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 12 21:51:41 2012 +0300

    Merge branch 'extgawk' of ssh://git.sv.gnu.org/srv/git/gawk into extgawk


http://git.sv.gnu.org/cgit/gawk.git/commit/?id=21a01e3ad4e2e77dccf73e8fd069370749880757

commit 21a01e3ad4e2e77dccf73e8fd069370749880757
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Jun 6 22:14:32 2012 +0300

    Hook in extension at_exit functions.

diff --git a/ChangeLog b/ChangeLog
index f7e9ac9..78ae5bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@
 	* eval.c (set_LINT): Call update_ext_api() at the end.
 	* gawkapi.h: Document that do_XXX could change on the fly.
 
+	* awk.h (run_ext_exit_handlers): Add declaration.
+	* msg.c (gawk_exit): Call it.
+
 2012-06-05         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* ext.c (load_ext): Remove use of RTLD_GLOBAL. Not needed in new
diff --git a/awk.h b/awk.h
index 280563c..d8aa238 100644
--- a/awk.h
+++ b/awk.h
@@ -707,10 +707,12 @@ struct break_point;
 
 #if 1
 #include "gawkapi.h"
+/* gawkapi.c: */
 extern gawk_api_t api_impl;
 extern void init_ext_api(void);
 extern void update_ext_api(void);
 extern NODE *awk_value_to_node(const awk_value_t *);
+extern void run_ext_exit_handlers(int exitval);
 #endif
 
 typedef struct exp_instruction {
diff --git a/msg.c b/msg.c
index c579b62..22cf556 100644
--- a/msg.c
+++ b/msg.c
@@ -158,5 +158,9 @@ gawk_exit(int status)
 		exit_val = status;
 		longjmp(fatal_tag, 1);
 	}
+
+	/* run any extension exit handlers */
+	run_ext_exit_handlers(status);
+
 	exit(status);
 }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |   34 +++++++
 awk.h                 |    3 +
 ext.c                 |    9 +-
 extension/ChangeLog   |   22 ++++
 extension/Makefile.am |    7 +-
 extension/Makefile.in |   22 +++-
 extension/filefuncs.c |   14 ++--
 extension/fork.c      |    4 +-
 extension/ordchr.c    |    4 +-
 extension/readfile.c  |    2 +-
 extension/testext.c   |  124 ++++++++++++++++++++----
 extension/time.c      |    5 +-
 gawkapi.c             |  262 +++++++++++++++++++++++++++++++++----------------
 gawkapi.h             |   68 +++++++++----
 main.c                |    4 +-
 msg.c                 |   12 +++
 profile.c             |    2 +-
 test/ChangeLog        |    4 +
 test/Makefile.am      |    2 +-
 test/Makefile.in      |    2 +-
 20 files changed, 449 insertions(+), 157 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Thu Jun 14 20:10:24 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SfK7M-00050N-1j
	for mharc-gawk-diffs@gnu.org; Thu, 14 Jun 2012 20:10:24 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54936)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SfK7J-00050H-DR
	for gawk-diffs@gnu.org; Thu, 14 Jun 2012 20:10:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SfK7H-0007wb-DY
	for gawk-diffs@gnu.org; Thu, 14 Jun 2012 20:10:20 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:33728)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SfK7H-0007wX-9s
	for gawk-diffs@gnu.org; Thu, 14 Jun 2012 20:10:19 -0400
Received: from ajschorr by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SfK7G-0001bl-08
	for gawk-diffs@gnu.org; Fri, 15 Jun 2012 00:10:18 +0000
Date: Fri, 15 Jun 2012 00:10:18 +0000
Message-Id: <E1SfK7G-0001bl-08@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 8ce87087172ee5be4ee72a1513daad3821185bf7
X-Git-Newrev: 2c698c5eb4294783e821e986c74e55b63507c790
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 2c698c5eb4294783e821e986c74e55b63507c790
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 15 Jun 2012 00:10:22 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  2c698c5eb4294783e821e986c74e55b63507c790 (commit)
      from  8ce87087172ee5be4ee72a1513daad3821185bf7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=2c698c5eb4294783e821e986c74e55b63507c790

commit 2c698c5eb4294783e821e986c74e55b63507c790
Author: Andrew J. Schorr <aschorr@telemetry-investments.com>
Date:   Thu Jun 14 20:09:57 2012 -0400

    Minor cleanups in extension/time.c.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index 4d504fb..09c88d3 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-14         Andrew J. Schorr     <aschorr@telemetry-investments.com>
+
+	* time.c (RETURN): Remove obsolete define.
+	(do_sleep): Change update_ERRNO_str argument to request translation.
+
 2012-06-12         Arnold D. Robbins     <arnold@skeeve.com>
 
 	Revise API:
diff --git a/extension/time.c b/extension/time.c
index a12a05d..ba8578c 100644
--- a/extension/time.c
+++ b/extension/time.c
@@ -51,8 +51,6 @@ int plugin_is_GPL_compatible;
 #include <time.h>
 #endif
 
-#define RETURN return tmp_number((AWKNUM) 0)
-
 /*
  * Returns time since 1/1/1970 UTC as a floating point value; should
  * have sub-second precision, but the actual precision will vary based
@@ -150,7 +148,7 @@ do_sleep(int nargs, awk_value_t *result)
 #else
 	/* no way to sleep on this platform */
 	rc = -1;
-	update_ERRNO_str("sleep: not supported on this platform", 0);
+	update_ERRNO_str("sleep: not supported on this platform", 1);
 #endif
 
 	return make_number(rc, result);

-----------------------------------------------------------------------

Summary of changes:
 extension/ChangeLog |    5 +++++
 extension/time.c    |    4 +---
 2 files changed, 6 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Sun Jun 17 15:19:28 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SgL0S-0001HT-1N
	for mharc-gawk-diffs@gnu.org; Sun, 17 Jun 2012 15:19:28 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37135)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SgL0N-0001HM-KU
	for gawk-diffs@gnu.org; Sun, 17 Jun 2012 15:19:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SgL0J-0002LA-N3
	for gawk-diffs@gnu.org; Sun, 17 Jun 2012 15:19:23 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:56690)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SgL0J-0002L6-GB
	for gawk-diffs@gnu.org; Sun, 17 Jun 2012 15:19:19 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1SgL0H-0002rn-Qo
	for gawk-diffs@gnu.org; Sun, 17 Jun 2012 19:19:18 +0000
Date: Sun, 17 Jun 2012 19:19:18 +0000
Message-Id: <E1SgL0H-0002rn-Qo@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 2c698c5eb4294783e821e986c74e55b63507c790
X-Git-Newrev: 7eaf540145fa9ed1ffb19196f18124b076bae495
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 7eaf540145fa9ed1ffb19196f18124b076bae495
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 17 Jun 2012 19:19:27 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  7eaf540145fa9ed1ffb19196f18124b076bae495 (commit)
       via  5e79fa8735ec2984fee9054cccd51d86fa939621 (commit)
      from  2c698c5eb4294783e821e986c74e55b63507c790 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=7eaf540145fa9ed1ffb19196f18124b076bae495

commit 7eaf540145fa9ed1ffb19196f18124b076bae495
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Sun Jun 17 22:19:01 2012 +0300

    Add some prints.

diff --git a/extension/testext.c b/extension/testext.c
index 697913f..2a54295 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -54,6 +54,7 @@ int plugin_is_GPL_compatible;
 #@load "testext"
 #BEGIN {
 #	dump_procinfo()
+#	print ""
 #}
 */
 static awk_value_t *
@@ -70,6 +71,7 @@ BEGIN {
 	testvar = "One Adam Twelve"
 	ret = var_test("testvar")
 	printf "var_test() returned %d, test_var = %s\n", ret, testvar
+	print ""
 }
 */
 
@@ -124,6 +126,7 @@ BEGIN {
 	ERRNO = ""
 	ret = test_errno()
 	printf "test_errno() returned %d, ERRNO = %s\n", ret, ERRNO
+	print ""
 }
 */
 static awk_value_t *
@@ -152,6 +155,7 @@ BEGIN {
 	printf ("length of test_array is %d, should be 10\n", length(test_array))
 	ret = test_array_size(test_array);
 	printf "test_array_size() returned %d, length is now %d\n", ret, length(test_array)
+	print ""
 }
 */
 
@@ -207,6 +211,7 @@ BEGIN {
 		printf "test_array_elem added element \"7\" --> %s\n", test_array2[7]
 	else
 		printf "test_array_elem did not add element \"7\"\n"
+	print ""
 }
 */
 static awk_value_t *
@@ -294,6 +299,7 @@ BEGIN {
 	printf "Changed value of LINT is %d\n", LINT
 	ret = print_do_lint();
 	printf "print_do_lint() returned %d\n", ret
+	print ""
 }
 */
 static awk_value_t *
@@ -324,6 +330,7 @@ out:
 #		printf "error: test_array_flatten() did not remove element \"3\"\n"
 #	else
 #		printf "test_array_flatten() did remove element \"3\"\n"
+#	print ""
 #}
 */
 
@@ -356,7 +363,7 @@ create_new_array()
 
 	a_cookie = create_array();
 
-	(void) make_string("hello", 6, & index);
+	(void) make_string("hello", 5, & index);
 	element.index = index.str_value;
 	(void) make_string("world", 5, & element.value);
 	if (! set_array_element(a_cookie, & element)) {
@@ -466,6 +473,7 @@ BEGIN {
 	printf("message_string = %s\n", message_string);
 	for (i in new_array)
 		printf("new_array[\"%s\"] = \"%s\"\n", i, new_array[i])
+	print ""
 }
 */
 

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=5e79fa8735ec2984fee9054cccd51d86fa939621

commit 5e79fa8735ec2984fee9054cccd51d86fa939621
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Sun Jun 17 20:47:50 2012 +0300

    Still more API and testext.c work.

diff --git a/ChangeLog b/ChangeLog
index 1b071e9..a5856ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2012-06-17         Arnold D. Robbins     <arnold@skeeve.com>
+
+	API Work:
+
+	* gawkapi.h (get_array_element): Remove `wanted' parameter.
+	(r_make_string): Comment the need for `api' and `ext_id' parameters.
+	* gawkapi.c (api_sym_update): Move checks to front.
+	Initial code for handling arrays. Still needs work.
+	(api_get_array_element): Implemented.
+	(api_set_array_element): Additional checking code.
+	(api_del_array_element): Implemented.
+	(api_create_array): Implemented.
+	(init_ext_api): Force do_xxx values to be 1 or 0.
+	(update_ext_api): Ditto.
+
 2012-06-12         Arnold D. Robbins     <arnold@skeeve.com>
 
 	API Work:
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 09c88d3..2a62ff7 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,17 @@
+2012-06-17         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* filefuncs.c (do_chdir, do_stat): Add assert(result != NULL).
+	* fork.c (do_fork, do_waitpid, do_wait): Ditto.
+	* ordchr.c (do_ord, do_chr): Ditto.
+	* readfile.c (do_readfile): Ditto.
+	* time.c (do_gettimeofday, do_sleep): Ditto.
+	* testext.c (All functions): Ditto. Clean up initial testing and use
+	make_number to make default return value up front.
+	(create_new_array, test_array_flatten): New functions.
+	(test_array_elem): Implemented.
+	(at_exit1): Don't printa actual pointer value: not portable.
+	(dl_load): Load up an array also.
+
 2012-06-14         Andrew J. Schorr     <aschorr@telemetry-investments.com>
 
 	* time.c (RETURN): Remove obsolete define.
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index 12f3acb..433a0ea 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -30,6 +30,7 @@
  */
 
 #include <stdio.h>
+#include <assert.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
@@ -54,6 +55,8 @@ do_chdir(int nargs, awk_value_t *result)
 	awk_value_t newdir;
 	int ret = -1;
 
+	assert(result != NULL);
+
 	if (do_lint && nargs != 1)
 		lintwarn(ext_id, "chdir: called with incorrect number of arguments, expecting 1");
 
@@ -264,6 +267,8 @@ do_stat(int nargs, awk_value_t *result)
 #endif /* S_IFDOOR */
 	};
 
+	assert(result != NULL);
+
 	if (do_lint && nargs != 2) {
 		lintwarn(ext_id, "stat: called with wrong number of arguments");
 		return make_number(-1, result);
diff --git a/extension/fork.c b/extension/fork.c
index 0c2e31d..21a4145 100644
--- a/extension/fork.c
+++ b/extension/fork.c
@@ -26,9 +26,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
-#include <stdlib.h>
 #include <stdio.h>
+#include <assert.h>
 #include <errno.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <sys/wait.h>
@@ -67,7 +68,9 @@ do_fork(int nargs, awk_value_t *result)
 {
 	int ret = -1;
 
-	if  (do_lint && nargs > 0)
+	assert(result != NULL);
+
+	if (do_lint && nargs > 0)
 		lintwarn(ext_id, "fork: called with too many arguments");
 
 	ret = fork();
@@ -102,7 +105,9 @@ do_waitpid(int nargs, awk_value_t *result)
 	int ret = -1;
 	int options = 0;
 
-	if  (do_lint && nargs > 1)
+	assert(result != NULL);
+
+	if (do_lint && nargs > 1)
 		lintwarn(ext_id, "waitpid: called with too many arguments");
 
 	if (get_argument(0, AWK_NUMBER, &pid)) {
@@ -125,7 +130,9 @@ do_wait(int nargs, awk_value_t *result)
 {
 	int ret;
 
-	if  (do_lint && nargs > 0)
+	assert(result != NULL);
+
+	if (do_lint && nargs > 0)
 		lintwarn(ext_id, "wait: called with too many arguments");
 
 	ret = wait(NULL);
diff --git a/extension/ordchr.c b/extension/ordchr.c
index dc02479..ba29d13 100644
--- a/extension/ordchr.c
+++ b/extension/ordchr.c
@@ -30,6 +30,7 @@
  */
 
 #include <stdio.h>
+#include <assert.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
@@ -53,7 +54,9 @@ do_ord(int nargs, awk_value_t *result)
 	awk_value_t str;
 	double ret = -1;
 
-	if  (do_lint && nargs > 1)
+	assert(result != NULL);
+
+	if (do_lint && nargs > 1)
 		lintwarn(ext_id, "ord: called with too many arguments");
 
 	if (get_argument(0, AWK_STRING, & str)) {
@@ -77,7 +80,9 @@ do_chr(int nargs, awk_value_t *result)
 
 	str[0] = str[1] = '\0';
 
-	if  (do_lint && nargs > 1)
+	assert(result != NULL);
+
+	if (do_lint && nargs > 1)
 		lintwarn(ext_id, "chr: called with too many arguments");
 
 	if (get_argument(0, AWK_NUMBER, & num)) {
diff --git a/extension/readfile.c b/extension/readfile.c
index 166bb8f..8972303 100644
--- a/extension/readfile.c
+++ b/extension/readfile.c
@@ -32,6 +32,7 @@
  */
 
 #include <stdio.h>
+#include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
@@ -63,7 +64,9 @@ do_readfile(int nargs, awk_value_t *result)
 	char *text;
 	int fd;
 
-	if  (do_lint && nargs > 1)
+	assert(result != NULL);
+
+	if (do_lint && nargs > 1)
 		lintwarn(ext_id, "readfile: called with too many arguments");
 
 	if (get_argument(0, AWK_STRING, &filename)) {
diff --git a/extension/testext.c b/extension/testext.c
index fa8dbf6..697913f 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -25,6 +25,7 @@
  */
 
 #include <stdio.h>
+#include <assert.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
@@ -58,6 +59,7 @@ int plugin_is_GPL_compatible;
 static awk_value_t *
 dump_procinfo(int nargs, awk_value_t *result)
 {
+	assert(result != NULL);
 	/* get PROCINFO as flat array and print it */
 	return result;
 }
@@ -77,16 +79,19 @@ var_test(int nargs, awk_value_t *result)
 	awk_value_t value, value2;
 	awk_value_t *valp;
 
-	if (nargs != 1 || result == NULL) {
-		printf("var_test: nargs not right (%d should be 1) or result == NULL\n", nargs);
-		return NULL;
+	assert(result != NULL);
+	make_number(0.0, result);
+
+	if (nargs != 1) {
+		printf("var_test: nargs not right (%d should be 1)\n", nargs);
+		goto out;
 	}
 
 	/* look up a reserved variable - should fail */
 	if (sym_lookup("ARGC", AWK_NUMBER, & value))
 		printf("var_test: sym_lookup of ARGC failed - got a value!\n");
 	else
-		printf("var_test: sym_lookup of ARGC passed\n");
+		printf("var_test: sym_lookup of ARGC passed - did not get a value\n");
 
 	/* look up variable whose name is passed in, should pass */
 	if (get_argument(0, AWK_STRING, & value)) {
@@ -98,20 +103,19 @@ var_test(int nargs, awk_value_t *result)
 				printf("var_test: sym_update(\"%s\") succeeded\n", value.str_value.str);
 			} else {
 				printf("var_test: sym_update(\"%s\") failed\n", value.str_value.str);
-				return NULL;
+				goto out;
 			}
 		} else {
 			printf("var_test: sym_lookup(\"%s\") failed\n", value.str_value.str);
-			return NULL;
+			goto out;
 		}
 	} else {
 		printf("var_test: get_argument() failed\n");
-		return NULL;
+		goto out;
 	}
 
-	result->val_type = AWK_NUMBER;
-	result->num_value = 1.0;
-
+	make_number(1.0, result);
+out:
 	return result;
 }
 
@@ -125,16 +129,18 @@ BEGIN {
 static awk_value_t *
 test_errno(int nargs, awk_value_t *result)
 {
-	if (nargs != 0 || result == NULL) {
-		printf("test_errno: nargs not right (%d should be 0) or result == NULL\n", nargs);
-		return NULL;
+	assert(result != NULL);
+	make_number(0.0, result);
+
+	if (nargs != 0) {
+		printf("test_errno: nargs not right (%d should be 0)\n", nargs);
+		goto out;
 	}
 
 	update_ERRNO_int(ECHILD);
 
-	result->val_type = AWK_NUMBER;
-	result->num_value = 1.0;
-
+	make_number(1.0, result);
+out:
 	return result;
 }
 
@@ -155,20 +161,23 @@ test_array_size(int nargs, awk_value_t *result)
 	awk_value_t value;
 	size_t count = 0;
 
-	if (nargs != 1 || result == NULL) {
-		printf("test_array_size: nargs not right (%d should be 0) or result == NULL\n", nargs);
-		return NULL;
+	assert(result != NULL);
+	make_number(0.0, result);
+
+	if (nargs != 1) {
+		printf("test_array_size: nargs not right (%d should be 1)\n", nargs);
+		goto out;
 	}
 
 	/* get element count and print it; should match length(array) from awk script */
 	if (! get_argument(0, AWK_ARRAY, & value)) {
 		printf("test_array_size: get_argument failed\n");
-		return NULL;
+		goto out;
 	}
 
 	if (! get_element_count(value.array_cookie, & count)) {
 		printf("test_array_size: get_element_count failed\n");
-		return NULL;
+		goto out;
 	}
 
 	printf("test_array_size: incoming size is %lu\n", (unsigned long) count);
@@ -176,37 +185,103 @@ test_array_size(int nargs, awk_value_t *result)
 	/* clear array - length(array) should then go to zero in script */
 	if (! clear_array(value.array_cookie)) {
 		printf("test_array_size: clear_array failed\n");
-		return NULL;
+		goto out;
 	}
 
-	result->val_type = AWK_NUMBER;
-	result->num_value = 1.0;
+	make_number(1.0, result);
 
+out:
 	return result;
 }
 
 /*
-#BEGIN {
-#	n = split("one two three four five six", test_array2)
-#	ret = test_array_elem(test_array2, "3")
-#	printf "test_array_elem() returned %d, test_array2[3] = %g\n", ret, test_array2[3]
-#	if ("5" in test_array2)
-#		printf "error: test_array_elem did not remove element \"5\"\n"
-#	else
-#		printf "test_array_elem did remove element \"5\"\n"
-#}
+BEGIN {
+	n = split("one two three four five six", test_array2)
+	ret = test_array_elem(test_array2, "3")
+	printf "test_array_elem() returned %d, test_array2[3] = %g\n", ret, test_array2[3]
+	if ("5" in test_array2)
+		printf "error: test_array_elem did not remove element \"5\"\n"
+	else
+		printf "test_array_elem did remove element \"5\"\n"
+	if ("7" in test_array2)
+		printf "test_array_elem added element \"7\" --> %s\n", test_array2[7]
+	else
+		printf "test_array_elem did not add element \"7\"\n"
+}
 */
 static awk_value_t *
 test_array_elem(int nargs, awk_value_t *result)
 {
-	if (nargs != 2 || result == NULL) {
-		printf("test_array_elem: nargs not right (%d should be 2) or result == NULL\n", nargs);
-		return NULL;
+	awk_value_t array, index, value;
+	awk_element_t element;
+
+	memset(& element, 0, sizeof(element));
+	make_number(0.0, result);	/* default return until full success */
+
+	assert(result != NULL);
+
+	if (nargs != 2) {
+		printf("test_array_elem: nargs not right (%d should be 2)\n", nargs);
+		goto out;
 	}
+
 	/* look up an array element and print the value */
+	if (! get_argument(0, AWK_ARRAY, & array)) {
+		printf("test_array_elem: get_argument 0 (array) failed\n");
+		goto out;
+	}
+	if (! get_argument(1, AWK_STRING, & index)) {
+		printf("test_array_elem: get_argument 1 (index) failed\n");
+		goto out;
+	}
+	if (! get_array_element(array.array_cookie, & index, & value)) {
+		printf("test_array_elem: get_array_element failed\n");
+		goto out;
+	}
+	printf("test_array_elem: a[\"%.*s\"] = ", (int) index.str_value.len,
+			index.str_value.str);
+	switch (value.val_type) {
+	case AWK_UNDEFINED:
+		printf("<undefined>\n");
+		break;
+	case AWK_ARRAY:
+		printf("<array>\n");
+		break;
+	case AWK_STRING:
+		printf("\"%.*s\"\n", (int) value.str_value.len, value.str_value.str);
+		break;
+	case AWK_NUMBER:
+		printf("%g\n", value.num_value);
+		break;
+	}
+
 	/* change the element - "3" */
+	element.index = index.str_value;
+	(void) make_number(42.0, & element.value);
+	if (! set_array_element(array.array_cookie, & element)) {
+		printf("test_array_elem: set_array_element failed\n");
+		goto out;
+	}
+
 	/* delete another element - "5" */
+	(void) make_string("5", 1, & index);
+	if (! del_array_element(array.array_cookie, & index)) {
+		printf("test_array_elem: del_array_element failed\n");
+		goto out;
+	}
+
+	/* add a new element - "7" */
+	(void) make_string("7", 1, & index);
+	element.index = index.str_value;
+	(void) make_string("seven", 5, & element.value);
+	if (! set_array_element(array.array_cookie, & element)) {
+		printf("test_array_elem: set_array_element failed\n");
+		goto out;
+	}
+
 	/* change and deletion should be reflected in awk script */
+	make_number(1.0, result);
+out:
 	return result;
 }
 
@@ -224,19 +299,86 @@ BEGIN {
 static awk_value_t *
 print_do_lint(int nargs, awk_value_t *result)
 {
-	if (nargs != 0 || result == NULL) {
-		printf("print_do_lint: nargs not right (%d should be 0) or result == NULL\n", nargs);
-		return NULL;
+	assert(result != NULL);
+	make_number(0.0, result);
+
+	if (nargs != 0) {
+		printf("print_do_lint: nargs not right (%d should be 0)\n", nargs);
+		goto out;
 	}
 
 	printf("print_do_lint: lint = %d\n", do_lint);
 
-	result->val_type = AWK_NUMBER;
-	result->num_value = 1.0;
+	make_number(1.0, result);
 
+out:
 	return result;
 }
 
+/*
+#BEGIN {
+#	n = split("one two three four five six", test_array3)
+#	ret = test_array_flatten(test_array3)
+#	printf "test_array_flatten() returned %d\n", ret
+#	if ("3" in test_array3)
+#		printf "error: test_array_flatten() did not remove element \"3\"\n"
+#	else
+#		printf "test_array_flatten() did remove element \"3\"\n"
+#}
+*/
+
+static awk_value_t *
+test_array_flatten(int nargs, awk_value_t *result)
+{
+	assert(result != NULL);
+	make_number(0.0, result);
+
+	if (nargs != 1) {
+		printf("test_array_flatten: nargs not right (%d should be 1)\n", nargs);
+		goto out;
+	}
+
+	/* FIXME: CODE HERE */
+
+	make_number(1.0, result);
+
+out:
+	return result;
+}
+
+static void
+create_new_array()
+{
+	awk_element_t element;
+	awk_array_t a_cookie;
+	awk_value_t index;
+	awk_value_t value;
+
+	a_cookie = create_array();
+
+	(void) make_string("hello", 6, & index);
+	element.index = index.str_value;
+	(void) make_string("world", 5, & element.value);
+	if (! set_array_element(a_cookie, & element)) {
+		printf("create_new_array:%d: set_array_element failed\n", __LINE__);
+		return;
+	}
+
+	(void) make_string("answer", 6, & index);
+	element.index = index.str_value;
+	(void) make_number(42.0, & element.value);
+	if (! set_array_element(a_cookie, & element)) {
+		printf("create_new_array:%d: set_array_element failed\n", __LINE__);
+		return;
+	}
+
+	value.val_type = AWK_ARRAY;
+	value.array_cookie = a_cookie;
+
+	if (! sym_update("new_array", & value))
+		printf("create_new_array: sym_update(\"new_array\") failed!\n");
+}
+
 static void at_exit0(void *data, int exit_status)
 {
 	printf("at_exit0 called (should be third):");
@@ -251,13 +393,15 @@ static void at_exit0(void *data, int exit_status)
 static int data_for_1 = 0xDeadBeef;
 static void at_exit1(void *data, int exit_status)
 {
+	int *data_p = (int *) data;
+
 	printf("at_exit1 called (should be second):");
 	if (data) {
-		printf(" data = %p", data);
 		if (data == & data_for_1)
 			printf(" (data is & data_for_1),");
 		else
 			printf(" (data is NOT & data_for_1),");
+		printf(" data value = %#x,", *data_p);
 	} else
 		printf(" data = NULL,");
 	printf(" exit_status = %d\n", exit_status);
@@ -279,11 +423,10 @@ static awk_ext_func_t func_table[] = {
 	{ "test_errno", test_errno, 0 },
 	{ "test_array_size", test_array_size, 1 },
 	{ "test_array_elem", test_array_elem, 2 },
+	{ "test_array_flatten", test_array_flatten, 1 },
 	{ "print_do_lint", print_do_lint, 0 },
 };
 
-
-
 int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id)
 {
 	size_t i, j;
@@ -321,15 +464,19 @@ int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id)
 BEGIN {
 	printf("answer_num = %g\n", answer_num);
 	printf("message_string = %s\n", message_string);
+	for (i in new_array)
+		printf("new_array[\"%s\"] = \"%s\"\n", i, new_array[i])
 }
 */
 
 	/* install some variables */
 	if (! sym_update("answer_num", make_number(42, & value)))
-			printf("textext: sym_update(\"answer_num\") failed!\n");
+		printf("testext: sym_update(\"answer_num\") failed!\n");
 
 	if (! sym_update("message_string", dup_string(message, strlen(message), & value)))
-			printf("textext: sym_update(\"answer_num\") failed!\n");
+		printf("testext: sym_update(\"answer_num\") failed!\n");
+
+	create_new_array();
 
 	return (errors == 0);
 }
diff --git a/extension/time.c b/extension/time.c
index ba8578c..2024510 100644
--- a/extension/time.c
+++ b/extension/time.c
@@ -26,6 +26,7 @@
  */
 
 #include <stdio.h>
+#include <assert.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
@@ -61,7 +62,9 @@ do_gettimeofday(int nargs, awk_value_t *result)
 {
 	double curtime;
 
-	if  (do_lint && nargs > 0)
+	assert(result != NULL);
+
+	if (do_lint && nargs > 0)
 		lintwarn(ext_id, "gettimeofday: ignoring arguments");
 
 #if defined(HAVE_GETTIMEOFDAY)
@@ -111,7 +114,9 @@ do_sleep(int nargs, awk_value_t *result)
 	double secs;
 	int rc;
 
-	if  (do_lint && nargs > 1)
+	assert(result != NULL);
+
+	if (do_lint && nargs > 1)
 		lintwarn(ext_id, "sleep: called with too many arguments");
 
 	if (! get_argument(0, AWK_NUMBER, &num)) {
diff --git a/gawkapi.c b/gawkapi.c
index 3f9159d..f57f4f5 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -75,7 +75,8 @@ awk_value_to_node(const awk_value_t *retval)
 	} else if (retval->val_type == AWK_NUMBER) {
 		ext_ret_val = make_number(retval->num_value);
 	} else {
-		ext_ret_val = make_string(retval->str_value.str, retval->str_value.len);
+		ext_ret_val = make_string(retval->str_value.str,
+				retval->str_value.len);
 	}
 
 	return ext_ret_val;
@@ -366,36 +367,46 @@ static awk_bool_t
 api_sym_update(awk_ext_id_t id, const char *name, awk_value_t *value)
 {
 	NODE *node;
+	NODE *array_node;
+
+	if (   name == NULL
+	    || *name == '\0'
+	    || is_off_limits_var(name)	/* most built-in vars not allowed */
+	    || value == NULL)
+		return false;
 
 	switch (value->val_type) {
 	case AWK_NUMBER:
 	case AWK_STRING:
 	case AWK_UNDEFINED:
-		break;
-
 	case AWK_ARRAY:
-		return false;
+		break;
 
 	default:
 		/* fatal(_("api_sym_update: invalid value for type of new value (%d)"), value->val_type); */
 		return false;
 	}
 
-	if (   name == NULL
-	    || *name == '\0'
-	    || is_off_limits_var(name)	/* most built-in vars not allowed */
-	    || value == NULL)
-		return false;
-
 	node = lookup(name);
 
 	if (node == NULL) {
 		/* new value to be installed */
-		node = install_symbol((char *) name, Node_var);
+		if (value->val_type == AWK_ARRAY) {
+			array_node = awk_value_to_node(value);
+			node = install_symbol(estrdup((char *) name, strlen(name)),
+					Node_var_array);
+			array_node->vname = node->vname;
+			*node = *array_node;
+			freenode(array_node);
+		} else {
+			/* regular variable */
+			node = install_symbol(estrdup((char *) name, strlen(name)),
+					Node_var);
+			unref(node->var_value);
+			node->var_value = awk_value_to_node(value);
+		}
 	}
-	unref(node->var_value);
-
-	node->var_value = awk_value_to_node(value);
+	/* FIXME: Handle case where it exists already */
 
 	return true;
 }
@@ -407,25 +418,30 @@ api_sym_update(awk_ext_id_t id, const char *name, awk_value_t *value)
  */
 static awk_bool_t
 api_get_array_element(awk_ext_id_t id,
-		awk_array_t a_cookie, const awk_value_t *const index,
-		awk_valtype_t wanted, awk_value_t *result)
+		awk_array_t a_cookie,
+		const awk_value_t *const index,
+		awk_value_t *result)
 {
-	NODE *array;
+	NODE *array = (NODE *) a_cookie;
 	NODE *subscript;
+	NODE **aptr;
 
 	/* don't check for index len zero, null str is ok as index */
-	if (   a_cookie == NULL
+	if (   array == NULL
+	    || array->type != Node_var_array
 	    || result == NULL
 	    || index == NULL
 	    || index->val_type != AWK_STRING
 	    || index->str_value.str == NULL)
 		return false;
 
-	array = (NODE *) a_cookie;
 	subscript = awk_value_to_node(index);
-	/* FIXME: write rest of code */
+	aptr = assoc_lookup(array, subscript);
+	unref(subscript);
+	if (aptr == NULL)
+		return false;
 
-	return true;	/* for now */
+	return node_to_awk_value(*aptr, result, AWK_UNDEFINED);
 }
 
 /*
@@ -441,7 +457,8 @@ api_set_array_element(awk_ext_id_t id, awk_array_t a_cookie,
 	NODE **aptr;
 
 	/* don't check for index len zero, null str is ok as index */
-	if (   a_cookie == NULL
+	if (   array == NULL
+	    || array->type != Node_var_array
 	    || element == NULL
 	    || element->index.str == NULL)
 		return false;
@@ -451,6 +468,7 @@ api_set_array_element(awk_ext_id_t id, awk_array_t a_cookie,
 	unref(tmp);
 	unref(*aptr);
 	*aptr = awk_value_to_node(& element->value);
+
 	return true;
 }
 
@@ -462,7 +480,33 @@ static awk_bool_t
 api_del_array_element(awk_ext_id_t id,
 		awk_array_t a_cookie, const awk_value_t* const index)
 {
-	return true;	/* for now */
+	NODE *array, *sub, *val;
+
+	array = (NODE *) a_cookie;
+	if (   array == NULL
+	    || array->type != Node_var_array
+	    || index == NULL
+	    || index->val_type != AWK_STRING)
+		return false;
+
+	sub = awk_value_to_node(index);
+	val = in_array(array, sub);
+
+	if (val == NULL)
+		return false;
+
+	if (val->type == Node_var_array) {
+		assoc_clear(val);
+		/* cleared a sub-array, free Node_var_array */
+		efree(val->vname);
+		freenode(val);
+	} else
+		unref(val);
+
+	(void) assoc_remove(array, sub);
+	unref(sub);
+
+	return true;
 }
 
 /*
@@ -486,7 +530,13 @@ api_get_element_count(awk_ext_id_t id,
 static awk_array_t
 api_create_array(awk_ext_id_t id)
 {
-	return NULL;	/* for now */
+	NODE *n;
+
+	getnode(n);
+	memset(n, 0, sizeof(NODE));
+	init_array(n);
+
+	return (awk_array_t) n;
 }
 
 /* Clear out an array */
@@ -564,12 +614,13 @@ gawk_api_t api_impl = {
 void
 init_ext_api()
 {
-	api_impl.do_flags[0] = do_lint;
-	api_impl.do_flags[1] = do_traditional;
-	api_impl.do_flags[2] = do_profile;
-	api_impl.do_flags[3] = do_sandbox;
-	api_impl.do_flags[4] = do_debug;
-	api_impl.do_flags[5] = do_mpfr;
+	/* force values to 1 / 0 */
+	api_impl.do_flags[0] = (do_lint ? 1 : 0);
+	api_impl.do_flags[1] = (do_traditional ? 1 : 0);
+	api_impl.do_flags[2] = (do_profile ? 1 : 0);
+	api_impl.do_flags[3] = (do_sandbox ? 1 : 0);
+	api_impl.do_flags[4] = (do_debug ? 1 : 0);
+	api_impl.do_flags[5] = (do_mpfr ? 1 : 0);
 }
 
 /* update_ext_api --- update the variables in the API that can change */
@@ -577,5 +628,5 @@ init_ext_api()
 void
 update_ext_api()
 {
-	api_impl.do_flags[0] = do_lint;
+	api_impl.do_flags[0] = (do_lint ? 1 : 0);
 }
diff --git a/gawkapi.h b/gawkapi.h
index 7e6a66f..ca06cea 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -287,8 +287,8 @@ typedef struct gawk_api {
 	 * and sym_lookup.
 	 */
 	awk_bool_t (*get_array_element)(awk_ext_id_t id,
-			awk_array_t a_cookie, const awk_value_t *const index,
-			awk_valtype_t wanted,
+			awk_array_t a_cookie,
+			const awk_value_t *const index,
 			awk_value_t *result);
 
 	/*
@@ -364,12 +364,12 @@ typedef struct gawk_api {
 #define add_ext_func(func, ns)	(api->add_ext_func(ext_id, func, ns))
 #define awk_atexit(funcp, arg0)	(api->awk_atexit(ext_id, funcp, arg0))
 
-#define sym_lookup(name, result, wanted)	(api->sym_lookup(ext_id, name, result, wanted))
+#define sym_lookup(name, wanted, result)	(api->sym_lookup(ext_id, name, wanted, result))
 #define sym_update(name, value) \
 	(api->sym_update(ext_id, name, value))
 
-#define get_array_element(array, element, result, wanted) \
-	(api->get_array_element(ext_id, array, element, result, wanted))
+#define get_array_element(array, index, result) \
+	(api->get_array_element(ext_id, array, index, result))
 
 #define set_array_element(array, element) \
 	(api->set_array_element(ext_id, array, element))
@@ -401,8 +401,8 @@ typedef struct gawk_api {
 /* r_make_string --- make a string value in result from the passed-in string */
 
 static inline awk_value_t *
-r_make_string(const gawk_api_t *api,
-	      awk_ext_id_t *ext_id,
+r_make_string(const gawk_api_t *api,	/* needed for emalloc */
+	      awk_ext_id_t *ext_id,	/* ditto */
 	      const char *string,
 	      size_t length,
 	      awk_bool_t duplicate,

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |   15 +++
 extension/ChangeLog   |   14 +++
 extension/filefuncs.c |    5 +
 extension/fork.c      |   15 ++-
 extension/ordchr.c    |    9 ++-
 extension/readfile.c  |    5 +-
 extension/testext.c   |  247 ++++++++++++++++++++++++++++++++++++++++---------
 extension/time.c      |    9 ++-
 gawkapi.c             |  113 ++++++++++++++++------
 gawkapi.h             |   14 ++--
 10 files changed, 353 insertions(+), 93 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Mon Jun 18 14:15:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SggTv-0001nt-Nr
	for mharc-gawk-diffs@gnu.org; Mon, 18 Jun 2012 14:15:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40445)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SggTr-0001nY-Rr
	for gawk-diffs@gnu.org; Mon, 18 Jun 2012 14:15:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SggTl-0006KO-RS
	for gawk-diffs@gnu.org; Mon, 18 Jun 2012 14:15:15 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:40440)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SggTl-0006HS-H3
	for gawk-diffs@gnu.org; Mon, 18 Jun 2012 14:15:09 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1SggTi-0007k2-Gt
	for gawk-diffs@gnu.org; Mon, 18 Jun 2012 18:15:09 +0000
Date: Mon, 18 Jun 2012 18:15:08 +0000
Message-Id: <E1SggTi-0007k2-Gt@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 7eaf540145fa9ed1ffb19196f18124b076bae495
X-Git-Newrev: b0f08ac2443e239b0ed9cc4421758f0ed3f7a94f
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. b0f08ac2443e239b0ed9cc4421758f0ed3f7a94f
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Jun 2012 18:15:18 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  b0f08ac2443e239b0ed9cc4421758f0ed3f7a94f (commit)
       via  6311c35dd8984a8516802b3cc111c1f411e098fd (commit)
      from  7eaf540145fa9ed1ffb19196f18124b076bae495 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=b0f08ac2443e239b0ed9cc4421758f0ed3f7a94f

commit b0f08ac2443e239b0ed9cc4421758f0ed3f7a94f
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Mon Jun 18 21:14:33 2012 +0300

    Add testext to list of shared library tests.

diff --git a/test/ChangeLog b/test/ChangeLog
index ac8737d..a171701 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2012-06-18         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* Makefile.am (testext): New test.
+	(clean): Add testext.awk to the list.
+	* testext.ok: New file.
+
 2012-06-12         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* Makefile.am (clean): Add fork.tmp.* to the list.
diff --git a/test/Makefile.am b/test/Makefile.am
index 6b052f1..c520b72 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -757,6 +757,7 @@ EXTRA_DIST = \
 	synerr1.ok \
 	synerr2.awk \
 	synerr2.ok \
+	testext.ok \
 	time.awk \
 	time.ok \
 	tradanch.awk \
@@ -884,7 +885,7 @@ LOCALE_CHARSET_TESTS = \
 	asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \
 	mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc
 
-SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs time
+SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs testext time
 
 # List of the tests which should be run with --lint option:
 NEED_LINT = \
@@ -1580,6 +1581,12 @@ incdupe3::
 	@AWKPATH=$(srcdir) $(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
+testext::
+	@echo $@
+	@$(AWK) '/^(@load|BEGIN)/,/^}/' $(top_srcdir)/extension/testext.c > testext.awk
+	@$(AWK) -f testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ testext.awk
+
 # Targets generated for other tests:
 include Maketests
 
@@ -1588,7 +1595,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests
 	$(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests
 
 clean:
-	rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.*
+	rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* testext.awk
 
 # An attempt to print something that can be grepped for in build logs
 pass-fail:
diff --git a/test/Makefile.in b/test/Makefile.in
index 05f9db1..57ccbd9 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -969,6 +969,7 @@ EXTRA_DIST = \
 	synerr1.ok \
 	synerr2.awk \
 	synerr2.ok \
+	testext.ok \
 	time.awk \
 	time.ok \
 	tradanch.awk \
@@ -1092,7 +1093,7 @@ LOCALE_CHARSET_TESTS = \
 	asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \
 	mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc
 
-SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs time
+SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs testext time
 
 # List of the tests which should be run with --lint option:
 NEED_LINT = \
@@ -1960,6 +1961,12 @@ incdupe3::
 	@echo $@
 	@AWKPATH=$(srcdir) $(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
+testext::
+	@echo $@
+	@$(AWK) '/^(@load|BEGIN)/,/^}/' $(top_srcdir)/extension/testext.c > testext.awk
+	@$(AWK) -f testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ testext.awk
 Gt-dummy:
 # file Maketests, generated from Makefile.am by the Gentests program
 addcomma:
@@ -3195,7 +3202,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests
 	$(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests
 
 clean:
-	rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.*
+	rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* testext.awk
 
 # An attempt to print something that can be grepped for in build logs
 pass-fail:
diff --git a/test/testext.ok b/test/testext.ok
new file mode 100644
index 0000000..9cac57a
--- /dev/null
+++ b/test/testext.ok
@@ -0,0 +1,30 @@
+var_test: sym_lookup of ARGC passed - did not get a value
+var_test: sym_update("testvar") succeeded
+var_test() returned 1, test_var = 42
+
+test_errno() returned 1, ERRNO = No child processes
+
+length of test_array is 10, should be 10
+test_array_size: incoming size is 10
+test_array_size() returned 1, length is now 0
+
+test_array_elem: a["3"] = "three"
+test_array_elem() returned 1, test_array2[3] = 42
+test_array_elem did remove element "5"
+test_array_elem added element "7" --> seven
+
+Initial value of LINT is 0
+print_do_lint: lint = 0
+print_do_lint() returned 1
+Changed value of LINT is 1
+print_do_lint: lint = 1
+print_do_lint() returned 1
+
+answer_num = 42
+message_string = hello, world
+new_array["hello"] = "world"
+new_array["answer"] = "42"
+
+at_exit2 called (should be first): data = NULL, exit_status = 0
+at_exit1 called (should be second): (data is & data_for_1), data value = 0xdeadbeef, exit_status = 0
+at_exit0 called (should be third): data = NULL, exit_status = 0

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=6311c35dd8984a8516802b3cc111c1f411e098fd

commit 6311c35dd8984a8516802b3cc111c1f411e098fd
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Mon Jun 18 21:13:34 2012 +0300

    More API implementation progress.

diff --git a/ChangeLog b/ChangeLog
index a5856ca..dd143a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-06-18         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* gawkapi.h (get_array_element): Restore `wanted' paramater.
+	* gawkapi.c (api_sym_update): Handle case where variable exists already.
+	(api_get_array_element): Restore `wanted' paramater and pass it
+	on to node_to_awk_value.
+
 2012-06-17         Arnold D. Robbins     <arnold@skeeve.com>
 
 	API Work:
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 2a62ff7..4315086 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-18         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* testext.c (test_array_elem): Add AWK_UNDEFINED for `wanted'.
+
 2012-06-17         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* filefuncs.c (do_chdir, do_stat): Add assert(result != NULL).
diff --git a/extension/testext.c b/extension/testext.c
index 2a54295..743a1c2 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -239,7 +239,7 @@ test_array_elem(int nargs, awk_value_t *result)
 		printf("test_array_elem: get_argument 1 (index) failed\n");
 		goto out;
 	}
-	if (! get_array_element(array.array_cookie, & index, & value)) {
+	if (! get_array_element(array.array_cookie, & index, AWK_UNDEFINED, & value)) {
 		printf("test_array_elem: get_array_element failed\n");
 		goto out;
 	}
diff --git a/gawkapi.c b/gawkapi.c
index f57f4f5..b616fbf 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -405,8 +405,25 @@ api_sym_update(awk_ext_id_t id, const char *name, awk_value_t *value)
 			unref(node->var_value);
 			node->var_value = awk_value_to_node(value);
 		}
+		return true;
+	}
+
+	/* if we get here, then it exists already */
+	switch (value->val_type) {
+	case AWK_STRING:
+	case AWK_NUMBER:
+		if (node->type == Node_var || node->type == Node_var_new) {
+			unref(node->var_value);
+			node->var_value = awk_value_to_node(value);
+		} else {
+			return false;
+		}
+		break;
+
+	case AWK_ARRAY:
+	case AWK_UNDEFINED:
+		return false;	/* not allowed */
 	}
-	/* FIXME: Handle case where it exists already */
 
 	return true;
 }
@@ -420,6 +437,7 @@ static awk_bool_t
 api_get_array_element(awk_ext_id_t id,
 		awk_array_t a_cookie,
 		const awk_value_t *const index,
+		awk_valtype_t wanted,
 		awk_value_t *result)
 {
 	NODE *array = (NODE *) a_cookie;
@@ -441,7 +459,7 @@ api_get_array_element(awk_ext_id_t id,
 	if (aptr == NULL)
 		return false;
 
-	return node_to_awk_value(*aptr, result, AWK_UNDEFINED);
+	return node_to_awk_value(*aptr, result, wanted);
 }
 
 /*
diff --git a/gawkapi.h b/gawkapi.h
index ca06cea..7fdd763 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -289,6 +289,7 @@ typedef struct gawk_api {
 	awk_bool_t (*get_array_element)(awk_ext_id_t id,
 			awk_array_t a_cookie,
 			const awk_value_t *const index,
+			awk_valtype_t wanted,
 			awk_value_t *result);
 
 	/*
@@ -368,8 +369,8 @@ typedef struct gawk_api {
 #define sym_update(name, value) \
 	(api->sym_update(ext_id, name, value))
 
-#define get_array_element(array, index, result) \
-	(api->get_array_element(ext_id, array, index, result))
+#define get_array_element(array, index, wanted, result) \
+	(api->get_array_element(ext_id, array, index, wanted, result))
 
 #define set_array_element(array, element) \
 	(api->set_array_element(ext_id, array, element))

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    7 +++++++
 extension/ChangeLog |    4 ++++
 extension/testext.c |    2 +-
 gawkapi.c           |   22 ++++++++++++++++++++--
 gawkapi.h           |    5 +++--
 test/ChangeLog      |    6 ++++++
 test/Makefile.am    |   11 +++++++++--
 test/Makefile.in    |   11 +++++++++--
 test/testext.ok     |   30 ++++++++++++++++++++++++++++++
 9 files changed, 89 insertions(+), 9 deletions(-)
 create mode 100644 test/testext.ok


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Mon Jun 18 16:02:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sgi9T-0007BP-9G
	for mharc-gawk-diffs@gnu.org; Mon, 18 Jun 2012 16:02:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57344)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sgi9L-0007B2-M7
	for gawk-diffs@gnu.org; Mon, 18 Jun 2012 16:02:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sgi9I-0000i7-J8
	for gawk-diffs@gnu.org; Mon, 18 Jun 2012 16:02:11 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:45223)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sgi9I-0000hz-Ej
	for gawk-diffs@gnu.org; Mon, 18 Jun 2012 16:02:08 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1Sgi8l-0005ez-QG
	for gawk-diffs@gnu.org; Mon, 18 Jun 2012 20:02:01 +0000
Date: Mon, 18 Jun 2012 20:01:49 +0000
Message-Id: <E1Sgi8l-0005ez-QG@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: b0f08ac2443e239b0ed9cc4421758f0ed3f7a94f
X-Git-Newrev: 1e3ac8a49caeeb991d8163042a576a66db51c74b
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 1e3ac8a49caeeb991d8163042a576a66db51c74b
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Jun 2012 20:02:17 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  1e3ac8a49caeeb991d8163042a576a66db51c74b (commit)
      from  b0f08ac2443e239b0ed9cc4421758f0ed3f7a94f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=1e3ac8a49caeeb991d8163042a576a66db51c74b

commit 1e3ac8a49caeeb991d8163042a576a66db51c74b
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Mon Jun 18 23:00:58 2012 +0300

    Get most of array flattening done.

diff --git a/ChangeLog b/ChangeLog
index dd143a8..2e4c8cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,15 @@
 2012-06-18         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* gawkapi.h (get_array_element): Restore `wanted' paramater.
+	(awk_element_t): Use awk_value_t for index. Add awk_flat_array_t.
+	(flatten_array): Change signature to use awk_flat_array_t;
+	(release_flattened_array): Change signature to use awk_flat_array_t;
 	* gawkapi.c (api_sym_update): Handle case where variable exists already.
 	(api_get_array_element): Restore `wanted' paramater and pass it
 	on to node_to_awk_value.
+	(api_set_array_element): Revisse to match changed element type.
+	(api_flatten_array): Revise signature, implement.
+	(api_release_flattened_array): Revise signature, implement.
 
 2012-06-17         Arnold D. Robbins     <arnold@skeeve.com>
 
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 4315086..54bf3f8 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,6 +1,12 @@
 2012-06-18         Arnold D. Robbins     <arnold@skeeve.com>
 
-	* testext.c (test_array_elem): Add AWK_UNDEFINED for `wanted'.
+	* filefuncs.c (do_chdir): Change element use to match change types.
+	* fork.c (array_set_numeric): Ditto.
+	* testext.c (valrep2str): New function.
+	(test_array_elem): Add AWK_UNDEFINED for `wanted'. Use valrep2str.
+	Adjust use of element index.
+	(dump_array): Renamed from `dump_procinfo' and implemented.
+	(func_table): Updated.
 
 2012-06-17         Arnold D. Robbins     <arnold@skeeve.com>
 
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index 433a0ea..d4e1b57 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -216,7 +216,7 @@ array_set(awk_array_t array, const char *sub, awk_value_t *value)
 
 	memset(& element, 0, sizeof(element));
 
-	element.index = dup_string(sub, strlen(sub), & tmp)->str_value;
+	element.index = *make_string(sub, strlen(sub), & tmp);
 	element.value = *value;
 
 	set_array_element(array, & element);
diff --git a/extension/fork.c b/extension/fork.c
index 21a4145..58089d5 100644
--- a/extension/fork.c
+++ b/extension/fork.c
@@ -55,7 +55,7 @@ array_set_numeric(awk_array_t array, const char *sub, double num)
 
 	memset(& element, 0, sizeof(element));
 
-	element.index = dup_string(sub, strlen(sub), & tmp)->str_value;
+	element.index = *make_string(sub, strlen(sub), & tmp);
 	make_number(num, &element.value);
 
 	set_array_element(array, & element);
diff --git a/extension/testext.c b/extension/testext.c
index 743a1c2..f5e16ba 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -42,6 +42,35 @@ static awk_ext_id_t *ext_id;
 
 int plugin_is_GPL_compatible;
 
+/* valrep2str --- turn a value into a string */
+
+static const char *
+valrep2str(const awk_value_t *value)
+{
+	static char buf[BUFSIZ];
+	int size = BUFSIZ - 3;
+
+	switch (value->val_type) {
+	case AWK_UNDEFINED:
+		strcpy(buf, "<undefined>");
+		break;
+	case AWK_ARRAY:
+		strcpy(buf, "<array>");
+		break;
+	case AWK_STRING:
+		if (value->str_value.len < size)
+			size = value->str_value.len;
+		sprintf(buf, "\"%.*s\"",
+				size,
+				value->str_value.str);
+		break;
+	case AWK_NUMBER:
+		sprintf(buf, "%g", value->num_value);
+		break;
+	}
+	return buf;
+}
+
 /*
  * The awk code for these tests is embedded in this file and then extracted
  * dynamically to create the script that is run together with this extension.
@@ -51,22 +80,84 @@ int plugin_is_GPL_compatible;
  */
 
 /*
-#@load "testext"
-#BEGIN {
-#	dump_procinfo()
-#	print ""
-#}
+@load "testext"
+BEGIN {
+	n = split("blacky rusty sophie raincloud lucky", pets)
+	printf "pets has %d elements\n", length(pets)
+	ret = dump_array("pets")
+	printf "dump_array(pets) returned %d\n", ret
+	print ""
+}
 */
 static awk_value_t *
-dump_procinfo(int nargs, awk_value_t *result)
+dump_array(int nargs, awk_value_t *result)
 {
+	awk_value_t value, value2;
+	awk_flat_array_t *flat_array;
+	size_t count;
+	int i;
+	char *name;
+
 	assert(result != NULL);
-	/* get PROCINFO as flat array and print it */
+	make_number(0.0, result);
+
+	if (nargs != 1) {
+		printf("dump_array: nargs not right (%d should be 1)\n", nargs);
+		goto out;
+	}
+
+	/* get argument named array as flat array and print it */
+	if (get_argument(0, AWK_STRING, & value)) {
+		name = value.str_value.str;
+		if (sym_lookup(name, AWK_ARRAY, & value2))
+			printf("dump_array: sym_lookup of %s passed\n", name);
+		else {
+			printf("dump_array: sym_lookup of %s failed\n", name);
+			goto out;
+		}
+	} else {
+		printf("dump_array: get_argument(0) failed\n");
+		goto out;
+	}
+
+	if (! get_element_count(value2.array_cookie, & count)) {
+		printf("dump_array: get_element_count failed\n");
+		goto out;
+	}
+
+	printf("dump_array: incoming size is %lu\n", (unsigned long) count);
+
+	if (! flatten_array(value2.array_cookie, & flat_array)) {
+		printf("dump_array: could not flatten array\n");
+		goto out;
+	}
+
+	if (flat_array->count != count) {
+		printf("dump_array: flat_array->count (%lu) != count (%lu)\n",
+				(unsigned long) flat_array->count,
+				(unsigned long) count);
+		goto out;
+	}
+
+	for (i = 0; i < flat_array->count; i++) {
+		printf("\t%s[\"%.*s\"] = %s\n",
+			name,
+			(int) flat_array->elements[i].index.str_value.len,
+			flat_array->elements[i].index.str_value.str,
+			valrep2str(& flat_array->elements[i].value));
+	}
+
+	if (! release_flattened_array(value2.array_cookie, flat_array)) {
+		printf("dump_array: could not release flattened array\n");
+		goto out;
+	}
+
+	make_number(1.0, result);
+out:
 	return result;
 }
 
 /*
-@load "testext"
 BEGIN {
 	testvar = "One Adam Twelve"
 	ret = var_test("testvar")
@@ -243,25 +334,13 @@ test_array_elem(int nargs, awk_value_t *result)
 		printf("test_array_elem: get_array_element failed\n");
 		goto out;
 	}
-	printf("test_array_elem: a[\"%.*s\"] = ", (int) index.str_value.len,
-			index.str_value.str);
-	switch (value.val_type) {
-	case AWK_UNDEFINED:
-		printf("<undefined>\n");
-		break;
-	case AWK_ARRAY:
-		printf("<array>\n");
-		break;
-	case AWK_STRING:
-		printf("\"%.*s\"\n", (int) value.str_value.len, value.str_value.str);
-		break;
-	case AWK_NUMBER:
-		printf("%g\n", value.num_value);
-		break;
-	}
+	printf("test_array_elem: a[\"%.*s\"] = %s\n",
+			(int) index.str_value.len,
+			index.str_value.str,
+			valrep2str(& value));
 
 	/* change the element - "3" */
-	element.index = index.str_value;
+	element.index = index;
 	(void) make_number(42.0, & element.value);
 	if (! set_array_element(array.array_cookie, & element)) {
 		printf("test_array_elem: set_array_element failed\n");
@@ -277,7 +356,7 @@ test_array_elem(int nargs, awk_value_t *result)
 
 	/* add a new element - "7" */
 	(void) make_string("7", 1, & index);
-	element.index = index.str_value;
+	element.index = index;
 	(void) make_string("seven", 5, & element.value);
 	if (! set_array_element(array.array_cookie, & element)) {
 		printf("test_array_elem: set_array_element failed\n");
@@ -364,7 +443,7 @@ create_new_array()
 	a_cookie = create_array();
 
 	(void) make_string("hello", 5, & index);
-	element.index = index.str_value;
+	element.index = index;
 	(void) make_string("world", 5, & element.value);
 	if (! set_array_element(a_cookie, & element)) {
 		printf("create_new_array:%d: set_array_element failed\n", __LINE__);
@@ -372,7 +451,7 @@ create_new_array()
 	}
 
 	(void) make_string("answer", 6, & index);
-	element.index = index.str_value;
+	element.index = index;
 	(void) make_number(42.0, & element.value);
 	if (! set_array_element(a_cookie, & element)) {
 		printf("create_new_array:%d: set_array_element failed\n", __LINE__);
@@ -425,7 +504,7 @@ static void at_exit2(void *data, int exit_status)
 }
 
 static awk_ext_func_t func_table[] = {
-	{ "dump_procinfo", dump_procinfo, 0 },
+	{ "dump_array", dump_array, 1 },
 	{ "var_test", var_test, 1 },
 	{ "test_errno", test_errno, 0 },
 	{ "test_array_size", test_array_size, 1 },
diff --git a/gawkapi.c b/gawkapi.c
index b616fbf..b1fba48 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -478,10 +478,11 @@ api_set_array_element(awk_ext_id_t id, awk_array_t a_cookie,
 	if (   array == NULL
 	    || array->type != Node_var_array
 	    || element == NULL
-	    || element->index.str == NULL)
+	    || element->index.str_value.str == NULL)
 		return false;
 
-	tmp = make_string(element->index.str, element->index.len);
+	tmp = make_string(element->index.str_value.str,
+			element->index.str_value.len);
 	aptr = assoc_lookup(array, tmp);
 	unref(tmp);
 	unref(*aptr);
@@ -570,14 +571,56 @@ api_clear_array(awk_ext_id_t id, awk_array_t a_cookie)
 	return true;
 }
 
-/* Flatten out an array so that it can be looped over easily. */
+/* api_flatten_array --- flatten out an array so that it can be looped over easily. */
+
 static awk_bool_t
 api_flatten_array(awk_ext_id_t id,
 		awk_array_t a_cookie,
-		size_t *count,
-		awk_element_t **data)
+		awk_flat_array_t **data)
 {
-	return true;	/* for now */
+	NODE **list;
+	size_t i, j;
+	NODE *array = (NODE *) a_cookie;
+	size_t alloc_size;
+
+	if (   array == NULL
+	    || array->type != Node_var_array
+	    || array->table_size == 0
+	    || data == NULL)
+		return false;
+
+	alloc_size = sizeof(awk_flat_array_t) +
+			(array->table_size - 1) * sizeof(awk_element_t);
+
+	emalloc(*data, awk_flat_array_t *, alloc_size,
+			"api_flatten_array");
+	memset(*data, 0, alloc_size);
+
+	list = assoc_list(array, "@unsorted", ASORTI);
+
+	(*data)->opaque1 = array;
+	(*data)->opaque2 = list;
+	(*data)->count = array->table_size;
+
+	for (i = j = 0; i < 2 * array->table_size; i += 2, j++) {
+		NODE *index, *value;
+
+		index = force_string(list[i]);
+		value = list[i + 1]; /* number or string or subarray */
+
+		/* convert index and value to ext types */
+		if (! node_to_awk_value(index,
+				& (*data)->elements[j].index, AWK_UNDEFINED)) {
+			fatal(_("api_flatten_array: could not convert index %d\n"),
+						(int) i);
+		}
+		if (! node_to_awk_value(value,
+				& (*data)->elements[j].value, AWK_UNDEFINED)) {
+			fatal(_("api_flatten_array: could not convert value %d\n"),
+						(int) i);
+		}
+	}
+	return true;
 }
 
 /*
@@ -587,9 +630,30 @@ api_flatten_array(awk_ext_id_t id,
 static awk_bool_t
 api_release_flattened_array(awk_ext_id_t id,
 		awk_array_t a_cookie,
-		size_t count,
-		awk_element_t *data)
+		awk_flat_array_t *data)
 {
+	NODE *array = a_cookie;
+	NODE **list;
+	size_t i;
+
+	if (   array == NULL
+	    || array->type != Node_var_array
+	    || data == NULL
+	    || array != (NODE *) data->opaque1
+	    || data->count != array->table_size
+	    || data->opaque2 == NULL)
+		return false;
+
+	list = (NODE **) data->opaque2;
+
+	/* FIXME: Delete items flagged for delete. */
+
+	/* free index nodes */
+	for (i = 0; i < 2 * array->table_size; i += 2)
+		unref(list[i]);
+
+	efree(list);
+
 	return true;	/* for now */
 }
 
diff --git a/gawkapi.h b/gawkapi.h
index 7fdd763..8102f70 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -145,10 +145,23 @@ typedef struct awk_element {
 		AWK_ELEMENT_DELETE = 1		/* set by extension if
 						   should be deleted */
 	} flags;
-	awk_string_t	index;
+	awk_value_t	index;
 	awk_value_t	value;
 } awk_element_t;
 
+#ifdef GAWK
+#define awk_const
+#else
+#define awk_const const
+#endif
+
+typedef struct awk_flat_array {
+	void *opaque1;			/* private data for use by gawk */
+	void *opaque2;			/* private data for use by gawk */
+	awk_const size_t count;		/* how many elements */
+	awk_element_t elements[1];	/* will be extended */
+} awk_flat_array_t;
+
 /*
  * A record describing an extension function. Upon being
  * loaded, the extension should pass in one of these for
@@ -222,6 +235,11 @@ typedef struct gawk_api {
 					  awk_valtype_t wanted,
 					  awk_value_t *result);
 
+	/*
+	 * FIXME: Missing update_argument to convert an undefined
+	 * argument into an array or scalar.
+	 */
+
 	/* Functions to print messages */
 	void (*api_fatal)(awk_ext_id_t id, const char *format, ...);
 	void (*api_warning)(awk_ext_id_t id, const char *format, ...);
@@ -257,7 +275,8 @@ typedef struct gawk_api {
 	 * returned. Returns false if the variable doesn't exist
 	 * or the wrong type was requested.
 	 * In the latter case, fills in vaule->val_type with the real type.
-	 * Built-in variables (except PROCINFO) may not be accessed by an extension.
+	 * Built-in variables (except PROCINFO) may not be accessed by an
+	 * extension.
 	 *
 	 * 	awk_value_t val;
 	 * 	if (! api->sym_lookup(id, name, wanted, & val))
@@ -322,8 +341,7 @@ typedef struct gawk_api {
 	/* Flatten out an array so that it can be looped over easily. */
 	awk_bool_t (*flatten_array)(awk_ext_id_t id,
 			awk_array_t a_cookie,
-			size_t *count,
-			awk_element_t **data);
+			awk_flat_array_t **data);
 
 	/*
 	 * When done, delete any marked elements, release the memory.
@@ -332,8 +350,7 @@ typedef struct gawk_api {
 	 */
 	awk_bool_t (*release_flattened_array)(awk_ext_id_t id,
 			awk_array_t a_cookie,
-			size_t count,
-			awk_element_t *data);
+			awk_flat_array_t *data);
 } gawk_api_t;
 
 #ifndef GAWK	/* these are not for the gawk code itself! */
@@ -385,11 +402,11 @@ typedef struct gawk_api {
 
 #define clear_array(array)	(api->clear_array(ext_id, array))
 
-#define flatten_array(array, count, data) \
-	(api->flatten_array(ext_id, array, count, data))
+#define flatten_array(array, data) \
+	(api->flatten_array(ext_id, array, data))
 
-#define release_flattened_array(array, count, data) \
-	(api->release_flattened_array(ext_id, array, count, data))
+#define release_flattened_array(array, data) \
+	(api->release_flattened_array(ext_id, array, data))
 
 #define emalloc(pointer, type, size, message) \
 	do { \
diff --git a/test/ChangeLog b/test/ChangeLog
index a171701..f8fc382 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,6 +1,8 @@
 2012-06-18         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* Makefile.am (testext): New test.
+	(EXTRA_DIST): Add new file testext.ok.
+	(SHLIB_TESTS): Add testext.
 	(clean): Add testext.awk to the list.
 	* testext.ok: New file.
 
diff --git a/test/testext.ok b/test/testext.ok
index 9cac57a..83711a7 100644
--- a/test/testext.ok
+++ b/test/testext.ok
@@ -1,3 +1,13 @@
+pets has 5 elements
+dump_array: sym_lookup of pets passed
+dump_array: incoming size is 5
+	pets["1"] = "blacky"
+	pets["2"] = "rusty"
+	pets["3"] = "sophie"
+	pets["4"] = "raincloud"
+	pets["5"] = "lucky"
+dump_array(pets) returned 1
+
 var_test: sym_lookup of ARGC passed - did not get a value
 var_test: sym_update("testvar") succeeded
 var_test() returned 1, test_var = 42

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |    6 ++
 extension/ChangeLog   |    8 +++-
 extension/filefuncs.c |    2 +-
 extension/fork.c      |    2 +-
 extension/testext.c   |  137 ++++++++++++++++++++++++++++++++++++++----------
 gawkapi.c             |   80 ++++++++++++++++++++++++++---
 gawkapi.h             |   37 ++++++++++----
 test/ChangeLog        |    2 +
 test/testext.ok       |   10 ++++
 9 files changed, 234 insertions(+), 50 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Tue Jun 19 14:26:36 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sh38O-0002rs-Rz
	for mharc-gawk-diffs@gnu.org; Tue, 19 Jun 2012 14:26:36 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60162)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sh38J-0002qf-VL
	for gawk-diffs@gnu.org; Tue, 19 Jun 2012 14:26:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sh38D-0006b1-Oh
	for gawk-diffs@gnu.org; Tue, 19 Jun 2012 14:26:31 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:54767)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sh38D-0006an-M5
	for gawk-diffs@gnu.org; Tue, 19 Jun 2012 14:26:25 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1Sh38B-0007vi-QO
	for gawk-diffs@gnu.org; Tue, 19 Jun 2012 18:26:25 +0000
Date: Tue, 19 Jun 2012 18:26:24 +0000
Message-Id: <E1Sh38B-0007vi-QO@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 1e3ac8a49caeeb991d8163042a576a66db51c74b
X-Git-Newrev: 1ab61e1508bb2c35d536717868d9dbe5ea20fa93
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 1ab61e1508bb2c35d536717868d9dbe5ea20fa93
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Jun 2012 18:26:34 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  1ab61e1508bb2c35d536717868d9dbe5ea20fa93 (commit)
       via  fd3c1195711270a001d860770098b8c0d9118c10 (commit)
       via  3a40be8a79f9d4e4bb205cca4eb15b1ee811f60c (commit)
      from  1e3ac8a49caeeb991d8163042a576a66db51c74b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=1ab61e1508bb2c35d536717868d9dbe5ea20fa93

commit 1ab61e1508bb2c35d536717868d9dbe5ea20fa93
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 19 20:57:22 2012 +0300

    Additional debugging flags at compile time.

diff --git a/ChangeLog b/ChangeLog
index 0b6f7b4..77f59ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,11 @@
 	* gawkapi.c (release_flattened_array): Delete elements flagged
 	for deletion. Free the flattened array also.
 
+	Add additional debugging when developing:
+
+	* configure.ac: Add additional debugging flags.
+	* configure: Regenerated.
+
 2012-06-18         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* gawkapi.h (get_array_element): Restore `wanted' paramater.
diff --git a/configure b/configure
index 44116db..633ca99 100755
--- a/configure
+++ b/configure
@@ -5535,7 +5535,7 @@ $as_echo_n "checking for special development options... " >&6; }
 if test -f $srcdir/.developing
 then
 	# add other debug flags as appropriate, save GAWKDEBUG for emergencies
-	CFLAGS="$CFLAGS -DARRAYDEBUG"
+	CFLAGS="$CFLAGS -DARRAYDEBUG -DYYDEBUG"
 	if grep dbug $srcdir/.developing
 	then
 		CFLAGS="$CFLAGS -DDBUG"
@@ -5545,7 +5545,7 @@ then
 	# enable debugging using macros also
 	if test "$GCC" = yes
 	then
-		CFLAGS="$CFLAGS -Wall"
+		CFLAGS="$CFLAGS -Wall -fno-builtin -g3 -gdwarf-2"
 	fi
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
diff --git a/configure.ac b/configure.ac
index 55bf0ba..90ad44b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,7 +80,7 @@ AC_MSG_CHECKING([for special development options])
 if test -f $srcdir/.developing
 then
 	# add other debug flags as appropriate, save GAWKDEBUG for emergencies
-	CFLAGS="$CFLAGS -DARRAYDEBUG"
+	CFLAGS="$CFLAGS -DARRAYDEBUG -DYYDEBUG"
 	if grep dbug $srcdir/.developing
 	then
 		CFLAGS="$CFLAGS -DDBUG"
@@ -90,7 +90,7 @@ then
 	# enable debugging using macros also
 	if test "$GCC" = yes
 	then
-		CFLAGS="$CFLAGS -Wall"
+		CFLAGS="$CFLAGS -Wall -fno-builtin -g3 -gdwarf-2"
 	fi
 	AC_MSG_RESULT([yes])
 else

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=fd3c1195711270a001d860770098b8c0d9118c10

commit fd3c1195711270a001d860770098b8c0d9118c10
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 19 20:54:19 2012 +0300

    Delete marked elements from flattened array.

diff --git a/ChangeLog b/ChangeLog
index 820e1cb..0b6f7b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,22 @@
 2012-06-19         Arnold D. Robbins     <arnold@skeeve.com>
 
+	Remove code duplication in gawkapi.c from msg.c:
+
 	* awk.h (err): Add `isfatal' first parameter.
 	* awkgram.y (err): Adjust all calls.
 	* msg.c (err): Adjust all calls. Move fatal code to here ...
 	(r_fatal): From here.
 	* gawkapi.c: Remove code duplication and adjust calls to `err'.
 
+	Handle deleting elements of flattened array:
+
+	* awk.h (get_argument): Remove declaration.
+	* ext.c (get_argument): Make static.
+	* gawkapi.h (awk_flat_array_t): Make opaque fields const. Add
+	more descriptive comments.
+	* gawkapi.c (release_flattened_array): Delete elements flagged
+	for deletion. Free the flattened array also.
+
 2012-06-18         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* gawkapi.h (get_array_element): Restore `wanted' paramater.
diff --git a/awk.h b/awk.h
index 4f120d3..eb512f2 100644
--- a/awk.h
+++ b/awk.h
@@ -1506,7 +1506,6 @@ NODE *do_ext(int nargs);
 NODE *load_ext(const char *lib_name, const char *init_func);
 #ifdef DYNAMIC
 awk_bool_t make_builtin(const awk_ext_func_t *);
-NODE *get_argument(int);
 NODE *get_actual_argument(int, bool, bool);
 #define get_scalar_argument(i, opt)  get_actual_argument((i), (opt), false)
 #define get_array_argument(i, opt)   get_actual_argument((i), (opt), true)
@@ -1605,7 +1604,7 @@ extern int mpg_strtoui(mpz_ptr, char *, size_t, char **, int);
 /* msg.c */
 extern void gawk_exit(int status);
 extern void final_exit(int status) ATTRIBUTE_NORETURN;
-extern void err(bool isfatal, const char *s, const char *emsg, va_list argp) ATTRIBUTE_PRINTF(2, 0);
+extern void err(bool isfatal, const char *s, const char *emsg, va_list argp) ATTRIBUTE_PRINTF(3, 0);
 extern void msg (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
 extern void error (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
 extern void warning (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
diff --git a/ext.c b/ext.c
index d0755cc..4945c7c 100644
--- a/ext.c
+++ b/ext.c
@@ -152,7 +152,7 @@ make_builtin(const awk_ext_func_t *funcinfo)
 
 /* get_argument --- get the i'th argument of a dynamically linked function */
 
-NODE *
+static NODE *
 get_argument(int i)
 {
 	NODE *t;
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 54bf3f8..8d8cf2b 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-19         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* testext.c (dump_array_and_delete): Renamed from dump_array.
+	Get second parameter which is index to delete. Update awk test.
+
 2012-06-18         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* filefuncs.c (do_chdir): Change element use to match change types.
diff --git a/extension/testext.c b/extension/testext.c
index f5e16ba..0a7594a 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -84,25 +84,29 @@ valrep2str(const awk_value_t *value)
 BEGIN {
 	n = split("blacky rusty sophie raincloud lucky", pets)
 	printf "pets has %d elements\n", length(pets)
-	ret = dump_array("pets")
-	printf "dump_array(pets) returned %d\n", ret
+	ret = dump_array_and_delete("pets", "3")
+	printf "dump_array_and_delete(pets) returned %d\n", ret
+	if ("3" in pets)
+		printf("dump_array_and_delete() did NOT remove index \"3\"!\n")
+	else
+		printf("dump_array_and_delete() did remove index \"3\"!\n")
 	print ""
 }
 */
 static awk_value_t *
-dump_array(int nargs, awk_value_t *result)
+dump_array_and_delete(int nargs, awk_value_t *result)
 {
-	awk_value_t value, value2;
+	awk_value_t value, value2, value3;
 	awk_flat_array_t *flat_array;
 	size_t count;
-	int i;
 	char *name;
+	int i;
 
 	assert(result != NULL);
 	make_number(0.0, result);
 
-	if (nargs != 1) {
-		printf("dump_array: nargs not right (%d should be 1)\n", nargs);
+	if (nargs != 2) {
+		printf("dump_array_and_delete: nargs not right (%d should be 2)\n", nargs);
 		goto out;
 	}
 
@@ -110,45 +114,56 @@ dump_array(int nargs, awk_value_t *result)
 	if (get_argument(0, AWK_STRING, & value)) {
 		name = value.str_value.str;
 		if (sym_lookup(name, AWK_ARRAY, & value2))
-			printf("dump_array: sym_lookup of %s passed\n", name);
+			printf("dump_array_and_delete: sym_lookup of %s passed\n", name);
 		else {
-			printf("dump_array: sym_lookup of %s failed\n", name);
+			printf("dump_array_and_delete: sym_lookup of %s failed\n", name);
 			goto out;
 		}
 	} else {
-		printf("dump_array: get_argument(0) failed\n");
+		printf("dump_array_and_delete: get_argument(0) failed\n");
 		goto out;
 	}
 
 	if (! get_element_count(value2.array_cookie, & count)) {
-		printf("dump_array: get_element_count failed\n");
+		printf("dump_array_and_delete: get_element_count failed\n");
 		goto out;
 	}
 
-	printf("dump_array: incoming size is %lu\n", (unsigned long) count);
+	printf("dump_array_and_delete: incoming size is %lu\n", (unsigned long) count);
 
 	if (! flatten_array(value2.array_cookie, & flat_array)) {
-		printf("dump_array: could not flatten array\n");
+		printf("dump_array_and_delete: could not flatten array\n");
 		goto out;
 	}
 
 	if (flat_array->count != count) {
-		printf("dump_array: flat_array->count (%lu) != count (%lu)\n",
+		printf("dump_array_and_delete: flat_array->count (%lu) != count (%lu)\n",
 				(unsigned long) flat_array->count,
 				(unsigned long) count);
 		goto out;
 	}
 
+	if (! get_argument(1, AWK_STRING, & value3)) {
+		printf("dump_array_and_delete: get_argument(1) failed\n");
+		goto out;
+	}
+
 	for (i = 0; i < flat_array->count; i++) {
 		printf("\t%s[\"%.*s\"] = %s\n",
 			name,
 			(int) flat_array->elements[i].index.str_value.len,
 			flat_array->elements[i].index.str_value.str,
 			valrep2str(& flat_array->elements[i].value));
+
+		if (strcmp(value3.str_value.str, flat_array->elements[i].index.str_value.str) == 0) {
+			flat_array->elements[i].flags |= AWK_ELEMENT_DELETE;
+			printf("dump_array_and_delete: marking element \"%s\" for deletion\n",
+				flat_array->elements[i].index.str_value.str);
+		}
 	}
 
 	if (! release_flattened_array(value2.array_cookie, flat_array)) {
-		printf("dump_array: could not release flattened array\n");
+		printf("dump_array_and_delete: could not release flattened array\n");
 		goto out;
 	}
 
@@ -504,7 +519,7 @@ static void at_exit2(void *data, int exit_status)
 }
 
 static awk_ext_func_t func_table[] = {
-	{ "dump_array", dump_array, 1 },
+	{ "dump_array_and_delete", dump_array_and_delete, 2 },
 	{ "var_test", var_test, 1 },
 	{ "test_errno", test_errno, 0 },
 	{ "test_array_size", test_array_size, 1 },
diff --git a/gawkapi.c b/gawkapi.c
index 92403dc..5eb1688 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -637,15 +637,24 @@ api_release_flattened_array(awk_ext_id_t id,
 
 	list = (NODE **) data->opaque2;
 
-	/* FIXME: Delete items flagged for delete. */
+	/* Delete items flagged for delete. */
+	for (i = 0; i < data->count; i++) {
+		if ((data->elements[i].flags & AWK_ELEMENT_DELETE) != 0) {
+			/* let the other guy do the work */
+			(void) api_del_array_element(id, a_cookie,
+					& data->elements[i].index);
+		}
+	}
 
 	/* free index nodes */
-	for (i = 0; i < 2 * array->table_size; i += 2)
+	for (i = 0; i < 2 * array->table_size; i += 2) {
 		unref(list[i]);
+	}
 
 	efree(list);
+	efree(data);
 
-	return true;	/* for now */
+	return true;
 }
 
 gawk_api_t api_impl = {
diff --git a/gawkapi.h b/gawkapi.h
index 8102f70..7973d7a 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -131,7 +131,8 @@ typedef struct {
 } awk_value_t;
 
 /*
- * A "flattened" array element. Gawk produces an array of these.
+ * A "flattened" array element. Gawk produces an array of these
+ * inside the awk_flattened_array_t.
  * ALL memory pointed to belongs to gawk. Individual elements may
  * be marked for deletion. New elements must be added individually,
  * one at a time, using the separate API for that purpose.
@@ -149,15 +150,20 @@ typedef struct awk_element {
 	awk_value_t	value;
 } awk_element_t;
 
+/* This is used to keep the extension from modifying certain fields. */
 #ifdef GAWK
 #define awk_const
 #else
 #define awk_const const
 #endif
 
+/*
+ * A "flattened" array. See the description above for how
+ * to use the elements contained herein.
+ */
 typedef struct awk_flat_array {
-	void *opaque1;			/* private data for use by gawk */
-	void *opaque2;			/* private data for use by gawk */
+	awk_const void *opaque1;	/* private data for use by gawk */
+	awk_const void *opaque2;	/* private data for use by gawk */
 	awk_const size_t count;		/* how many elements */
 	awk_element_t elements[1];	/* will be extended */
 } awk_flat_array_t;
diff --git a/test/ChangeLog b/test/ChangeLog
index f8fc382..44af605 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-19         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* testext.ok: Update contents.
+
 2012-06-18         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* Makefile.am (testext): New test.
diff --git a/test/testext.ok b/test/testext.ok
index 83711a7..2f54668 100644
--- a/test/testext.ok
+++ b/test/testext.ok
@@ -1,12 +1,14 @@
 pets has 5 elements
-dump_array: sym_lookup of pets passed
-dump_array: incoming size is 5
+dump_array_and_delete: sym_lookup of pets passed
+dump_array_and_delete: incoming size is 5
 	pets["1"] = "blacky"
 	pets["2"] = "rusty"
 	pets["3"] = "sophie"
+dump_array_and_delete: marking element "3" for deletion
 	pets["4"] = "raincloud"
 	pets["5"] = "lucky"
-dump_array(pets) returned 1
+dump_array_and_delete(pets) returned 1
+dump_array_and_delete() did remove index "3"!
 
 var_test: sym_lookup of ARGC passed - did not get a value
 var_test: sym_update("testvar") succeeded

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=3a40be8a79f9d4e4bb205cca4eb15b1ee811f60c

commit 3a40be8a79f9d4e4bb205cca4eb15b1ee811f60c
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 19 20:42:51 2012 +0300

    Fix code duplication in gawkapi.c from msg.c.

diff --git a/ChangeLog b/ChangeLog
index 2e4c8cb..820e1cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-06-19         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* awk.h (err): Add `isfatal' first parameter.
+	* awkgram.y (err): Adjust all calls.
+	* msg.c (err): Adjust all calls. Move fatal code to here ...
+	(r_fatal): From here.
+	* gawkapi.c: Remove code duplication and adjust calls to `err'.
+
 2012-06-18         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* gawkapi.h (get_array_element): Restore `wanted' paramater.
diff --git a/awk.h b/awk.h
index 6c1e706..4f120d3 100644
--- a/awk.h
+++ b/awk.h
@@ -1605,7 +1605,7 @@ extern int mpg_strtoui(mpz_ptr, char *, size_t, char **, int);
 /* msg.c */
 extern void gawk_exit(int status);
 extern void final_exit(int status) ATTRIBUTE_NORETURN;
-extern void err(const char *s, const char *emsg, va_list argp) ATTRIBUTE_PRINTF(2, 0);
+extern void err(bool isfatal, const char *s, const char *emsg, va_list argp) ATTRIBUTE_PRINTF(2, 0);
 extern void msg (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
 extern void error (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
 extern void warning (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
diff --git a/awkgram.c b/awkgram.c
index 7836dbe..bef9a30 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -4704,7 +4704,7 @@ warning_ln(int line, const char *mesg, ...)
 	sourceline = line;
 	print_included_from();
 	va_start(args, mesg);
-	err(_("warning: "), mesg, args);
+	err(false, _("warning: "), mesg, args);
 	va_end(args);
 	sourceline = saveline;
 }
@@ -4722,9 +4722,9 @@ lintwarn_ln(int line, const char *mesg, ...)
 	print_included_from();
 	va_start(args, mesg);
 	if (lintfunc == r_fatal)
-		err(_("fatal: "), mesg, args);
+		err(true, _("fatal: "), mesg, args);
 	else
-		err(_("warning: "), mesg, args);
+		err(false, _("warning: "), mesg, args);
 	va_end(args);
 	sourceline = saveline;
 	if (lintfunc == r_fatal)
@@ -4744,7 +4744,7 @@ error_ln(int line, const char *m, ...)
 	print_included_from();
 	errcount++;
 	va_start(args, m);
-	err("error: ", m, args);
+	err(false, "error: ", m, args);
 	va_end(args);
 	sourceline = saveline;
 }
@@ -4822,7 +4822,7 @@ yyerror(const char *m, ...)
 		*bp++ = ' ';
 	}
 	strcpy(bp, mesg);
-	err("", buf, args);
+	err(false, "", buf, args);
 	va_end(args);
 	efree(buf);
 }
diff --git a/awkgram.y b/awkgram.y
index f7ea5d4..dceca6d 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -1984,7 +1984,7 @@ warning_ln(int line, const char *mesg, ...)
 	sourceline = line;
 	print_included_from();
 	va_start(args, mesg);
-	err(_("warning: "), mesg, args);
+	err(false, _("warning: "), mesg, args);
 	va_end(args);
 	sourceline = saveline;
 }
@@ -2002,9 +2002,9 @@ lintwarn_ln(int line, const char *mesg, ...)
 	print_included_from();
 	va_start(args, mesg);
 	if (lintfunc == r_fatal)
-		err(_("fatal: "), mesg, args);
+		err(true, _("fatal: "), mesg, args);
 	else
-		err(_("warning: "), mesg, args);
+		err(false, _("warning: "), mesg, args);
 	va_end(args);
 	sourceline = saveline;
 	if (lintfunc == r_fatal)
@@ -2024,7 +2024,7 @@ error_ln(int line, const char *m, ...)
 	print_included_from();
 	errcount++;
 	va_start(args, m);
-	err("error: ", m, args);
+	err(false, "error: ", m, args);
 	va_end(args);
 	sourceline = saveline;
 }
@@ -2102,7 +2102,7 @@ yyerror(const char *m, ...)
 		*bp++ = ' ';
 	}
 	strcpy(bp, mesg);
-	err("", buf, args);
+	err(false, "", buf, args);
 	va_end(args);
 	efree(buf);
 }
diff --git a/gawkapi.c b/gawkapi.c
index b1fba48..92403dc 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -83,7 +83,6 @@ awk_value_to_node(const awk_value_t *retval)
 }
 
 /* Functions to print messages */
-/* FIXME: Code duplicate from msg.c. Fix this. */
 
 /* api_fatal --- print a fatal message and exit */
 
@@ -95,12 +94,8 @@ api_fatal(awk_ext_id_t id, const char *format, ...)
 	(void) id;
 
 	va_start(args, format);
-	err(_("fatal: "), format, args);
+	err(true, _("fatal: "), format, args);
 	va_end(args);
-#ifdef GAWKDEBUG
-	abort();
-#endif
-	gawk_exit(EXIT_FATAL);
 }
 
 /* api_warning --- print a warning message and exit */
@@ -113,7 +108,7 @@ api_warning(awk_ext_id_t id, const char *format, ...)
 	(void) id;
 
 	va_start(args, format);
-	err(_("warning: "), format, args);
+	err(false, _("warning: "), format, args);
 	va_end(args);
 }
 
@@ -128,14 +123,10 @@ api_lintwarn(awk_ext_id_t id, const char *format, ...)
 
 	va_start(args, format);
 	if (lintwarn == r_fatal) {
-		err(_("fatal: "), format, args);
+		err(true, _("fatal: "), format, args);
 		va_end(args);
-#ifdef GAWKDEBUG
-		abort();
-#endif
-		gawk_exit(EXIT_FATAL);
 	} else {
-		err(_("warning: "), format, args);
+		err(false, _("warning: "), format, args);
 		va_end(args);
 	}
 }
diff --git a/msg.c b/msg.c
index b94e840..bc446a1 100644
--- a/msg.c
+++ b/msg.c
@@ -39,7 +39,7 @@ bool fatal_tag_valid = false;
 
 /* VARARGS2 */
 void
-err(const char *s, const char *emsg, va_list argp)
+err(bool isfatal, const char *s, const char *emsg, va_list argp)
 {
 	char *file;
 	const char *me;
@@ -89,6 +89,13 @@ err(const char *s, const char *emsg, va_list argp)
 	vfprintf(stderr, emsg, argp);
 	(void) fprintf(stderr, "\n");
 	(void) fflush(stderr);
+
+	if (isfatal) {
+#ifdef GAWKDEBUG
+		abort();
+#endif
+		gawk_exit(EXIT_FATAL);
+	}
 }
 
 /* msg --- take a varargs error message and print it */
@@ -98,7 +105,7 @@ msg(const char *mesg, ...)
 {
 	va_list args;
 	va_start(args, mesg);
-	err("", mesg, args);
+	err(false, "", mesg, args);
 	va_end(args);
 }
 
@@ -109,7 +116,7 @@ warning(const char *mesg, ...)
 {
 	va_list args;
 	va_start(args, mesg);
-	err(_("warning: "), mesg, args);
+	err(false, _("warning: "), mesg, args);
 	va_end(args);
 }
 
@@ -118,7 +125,7 @@ error(const char *mesg, ...)
 {
 	va_list args;
 	va_start(args, mesg);
-	err(_("error: "), mesg, args);
+	err(false, _("error: "), mesg, args);
 	va_end(args);
 }
 
@@ -141,12 +148,8 @@ r_fatal(const char *mesg, ...)
 {
 	va_list args;
 	va_start(args, mesg);
-	err(_("fatal: "), mesg, args);
+	err(true, _("fatal: "), mesg, args);
 	va_end(args);
-#ifdef GAWKDEBUG
-	abort();
-#endif
-	gawk_exit(EXIT_FATAL);
 }
 
 /* gawk_exit --- longjmp out if necessary */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |   24 ++++++++++++++++++++++++
 awk.h               |    3 +--
 awkgram.c           |   10 +++++-----
 awkgram.y           |   10 +++++-----
 configure           |    4 ++--
 configure.ac        |    4 ++--
 ext.c               |    2 +-
 extension/ChangeLog |    5 +++++
 extension/testext.c |   47 +++++++++++++++++++++++++++++++----------------
 gawkapi.c           |   32 ++++++++++++++++----------------
 gawkapi.h           |   12 +++++++++---
 msg.c               |   21 ++++++++++++---------
 test/ChangeLog      |    4 ++++
 test/testext.ok     |    8 +++++---
 14 files changed, 122 insertions(+), 64 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Tue Jun 19 14:26:47 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sh38Y-0002uZ-W5
	for mharc-gawk-diffs@gnu.org; Tue, 19 Jun 2012 14:26:47 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60182)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sh38N-0002rU-ER
	for gawk-diffs@gnu.org; Tue, 19 Jun 2012 14:26:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sh38F-0006bD-AJ
	for gawk-diffs@gnu.org; Tue, 19 Jun 2012 14:26:34 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:54769)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Sh38F-0006b6-1D
	for gawk-diffs@gnu.org; Tue, 19 Jun 2012 14:26:27 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1Sh38D-0007wg-Et
	for gawk-diffs@gnu.org; Tue, 19 Jun 2012 18:26:26 +0000
Date: Tue, 19 Jun 2012 18:26:25 +0000
Message-Id: <E1Sh38D-0007wg-Et@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/gawk-4.0-stable
X-Git-Reftype: branch
X-Git-Oldrev: f8ec28a30e98cad325d18478a3d054b8c30a3129
X-Git-Newrev: 0b9dc23236f49d3e23a14900b1f34bb027fc3ba0
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.0-stable,
	updated. 0b9dc23236f49d3e23a14900b1f34bb027fc3ba0
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Jun 2012 18:26:45 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-4.0-stable has been updated
       via  0b9dc23236f49d3e23a14900b1f34bb027fc3ba0 (commit)
       via  91cdc24dc028b758e409ac6e92759b52b2a079d6 (commit)
       via  09a6e6fecf9691ea9a0ceb2aef26197f821868cd (commit)
      from  f8ec28a30e98cad325d18478a3d054b8c30a3129 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=0b9dc23236f49d3e23a14900b1f34bb027fc3ba0

commit 0b9dc23236f49d3e23a14900b1f34bb027fc3ba0
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 19 21:26:00 2012 +0300

    Redo it.po/it.gmo.

diff --git a/po/it.gmo b/po/it.gmo
index 7d524ad..195280f 100644
Binary files a/po/it.gmo and b/po/it.gmo differ
diff --git a/po/it.po b/po/it.po
index 6c74d5a..f022412 100644
--- a/po/it.po
+++ b/po/it.po
@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gawk 3.1.81\n"
 "Report-Msgid-Bugs-To: arnold@skeeve.com\n"
-"POT-Creation-Date: 2012-04-27 10:06+0300\n"
+"POT-Creation-Date: 2012-03-28 22:03+0200\n"
 "PO-Revision-Date: 2012-05-08 16:11+0100\n"
 "Last-Translator: Antonio Colombo <azc100@gmail.com>\n"
 "Language-Team: Italian <it@li.org>\n"
@@ -15,462 +15,513 @@ msgstr ""
 "Content-Type: text/plain; charset=ISO-8859-1\n"
 "Content-Transfer-Encoding: 8-bit\n"
 
-#: array.c:266
+#: array.c:140
 #, c-format
 msgid "from %s"
 msgstr "da %s"
 
-#: array.c:366
+#: array.c:248
 msgid "attempt to use a scalar value as array"
 msgstr "tentativo di usare valore scalare come vettore"
 
-#: array.c:368
+#: array.c:251
+#, fuzzy, c-format
+msgid "attempt to use function `%s' as an array"
+msgstr "tentativo di usare scalare '%s' come vettore"
+
+#: array.c:254
 #, c-format
 msgid "attempt to use scalar parameter `%s' as an array"
 msgstr "tentativo di usare il parametro scalare `%s' come un vettore"
 
-#: array.c:371
+#: array.c:257
 #, c-format
 msgid "attempt to use scalar `%s' as an array"
 msgstr "tentativo di usare scalare '%s' come vettore"
 
-#: array.c:418 array.c:584 builtin.c:85 builtin.c:1560 builtin.c:1602
-#: builtin.c:1615 builtin.c:2041 builtin.c:2053 eval.c:1109 eval.c:1113
-#: eval.c:1508
+#: array.c:302 array.c:707 builtin.c:84 builtin.c:1385 builtin.c:1427
+#: builtin.c:1440 builtin.c:1859 builtin.c:1871 eval.c:1135 eval.c:1139
+#: eval.c:1495 eval.c:1812
 #, c-format
 msgid "attempt to use array `%s' in a scalar context"
 msgstr "tentativo di usare vettore `%s' in un contesto scalare"
 
-#: array.c:591
+#: array.c:513
+#, fuzzy, c-format
+msgid "reference to uninitialized element `%s[\"%.*s\"]'"
+msgstr "riferimento ad argomento non inizializzato `%s'"
+
+#: array.c:519
+#, c-format
+msgid "subscript of array `%s' is null string"
+msgstr ""
+
+#: array.c:723
 #, c-format
 msgid "delete: index `%s' not in array `%s'"
 msgstr "delete: indice `%s' non presente nel vettore `%s'"
 
-#: array.c:605
+#: array.c:734 eval.c:1865
 #, c-format
 msgid "attempt to use scalar `%s[\"%.*s\"]' as an array"
 msgstr "tentativo di usare scalare`%s[\"%.*s\"]' come vettore"
 
-#: array.c:784
-msgid "adump: first argument not an array"
+#: array.c:910
+#, c-format
+msgid "%s: empty (null)\n"
+msgstr ""
+
+#: array.c:915
+#, c-format
+msgid "%s: empty (zero)\n"
+msgstr ""
+
+#: array.c:919
+#, c-format
+msgid "%s: table_size = %d, array_size = %d\n"
+msgstr ""
+
+#: array.c:954
+#, c-format
+msgid "%s: is parameter\n"
+msgstr ""
+
+#: array.c:958
+#, c-format
+msgid "%s: array_ref to %s\n"
+msgstr ""
+
+#: array.c:963
+#, fuzzy
+msgid "adump: argument not an array"
 msgstr "adump: il primo argomento non è un vettore"
 
-#: array.c:823
+#: array.c:1086
 msgid "asort: second argument not an array"
 msgstr "asort: il secondo argomento non è un vettore"
 
-#: array.c:824
+#: array.c:1087
 msgid "asorti: second argument not an array"
 msgstr "asorti: il secondo argomento non è un vettore"
 
-#: array.c:831
+#: array.c:1094
 msgid "asort: first argument not an array"
 msgstr "asort: il primo argomento non è un vettore"
 
-#: array.c:832
+#: array.c:1095
 msgid "asorti: first argument not an array"
 msgstr "asorti: il primo argomento non è un vettore"
 
-#: array.c:839
+#: array.c:1102
 msgid "asort: cannot use a subarray of first arg for second arg"
 msgstr ""
-"asort: non permesso un secondo argomento che sia un sottovettore del primo argomento"
+"asort: non permesso un secondo argomento che sia un sottovettore del primo "
+"argomento"
 
-#: array.c:840
+#: array.c:1103
 msgid "asorti: cannot use a subarray of first arg for second arg"
 msgstr ""
-"asorti: non permesso un secondo argomento che sia un sottovettore del primo argomento"
+"asorti: non permesso un secondo argomento che sia un sottovettore del primo "
+"argomento"
 
-#: array.c:845
+#: array.c:1108
 msgid "asort: cannot use a subarray of second arg for first arg"
 msgstr ""
-"asort: non permesso un primo argomento che sia un sottovettore del secondo argomento"
+"asort: non permesso un primo argomento che sia un sottovettore del secondo "
+"argomento"
 
-#: array.c:846
+#: array.c:1109
 msgid "asorti: cannot use a subarray of second arg for first arg"
 msgstr ""
-"asorti: non permesso un primo argomento che sia un sottovettore del secondo argomento"
+"asorti: non permesso un primo argomento che sia un sottovettore del secondo "
+"argomento"
 
-#: array.c:1314
+#: array.c:1655
+#, c-format
 msgid "`%s' is invalid as a function name"
 msgstr "`%s' non è un nome funzione valido"
 
-#: array.c:1318
+#: array.c:1659
+#, c-format
 msgid "sort comparison function `%s' is not defined"
 msgstr "funzione di confronto del sort `%s' non definita"
 
-#: awkgram.y:223
+#: awkgram.y:249
 #, c-format
 msgid "%s blocks must have an action part"
 msgstr "blocchi %s richiedono una 'azione'"
 
-#: awkgram.y:226
+#: awkgram.y:252
 msgid "each rule must have a pattern or an action part"
 msgstr "ogni regola deve avere una parte 'espressione' o una parte 'azione'"
 
-#: awkgram.y:295 awkgram.y:306
+#: awkgram.y:323 awkgram.y:334
 msgid "old awk does not support multiple `BEGIN' or `END' rules"
 msgstr "il vecchio awk non supporta più di una regola `BEGIN' o `END'"
 
-#: awkgram.y:343
+#: awkgram.y:371
 #, c-format
 msgid "`%s' is a built-in function, it cannot be redefined"
 msgstr "`%s' è una funzione interna, non si può ridefinire"
 
-#: awkgram.y:389
+#: awkgram.y:432
 msgid "regexp constant `//' looks like a C++ comment, but is not"
 msgstr "espressione regolare costante `//' sembra un commento C++, ma non lo è"
 
-#: awkgram.y:393
+#: awkgram.y:436
 #, c-format
 msgid "regexp constant `/%s/' looks like a C comment, but is not"
 msgstr "espressione regolare costante `/%s/' sembra un commento C, ma non lo è"
 
-#: awkgram.y:485
+#: awkgram.y:528
 #, c-format
 msgid "duplicate case values in switch body: %s"
 msgstr "valori di 'case' doppi all'interno di uno 'switch': %s"
 
-#: awkgram.y:506
+#: awkgram.y:549
 msgid "duplicate `default' detected in switch body"
 msgstr "valori di default doppi all'interno di uno 'switch'"
 
-#: awkgram.y:766
+#: awkgram.y:809
 msgid "`break' is not allowed outside a loop or switch"
 msgstr "`break' non permesso fuori da un ciclo o da uno 'switch'"
 
-#: awkgram.y:775
+#: awkgram.y:818
 msgid "`continue' is not allowed outside a loop"
 msgstr "`continue' non permesso fuori da un un ciclo"
 
-#: awkgram.y:785
+#: awkgram.y:828
 #, c-format
 msgid "`next' used in %s action"
 msgstr "`next' usato in 'azione' %s"
 
-#: awkgram.y:793
+#: awkgram.y:836
 msgid "`nextfile' is a gawk extension"
 msgstr "`nextfile' è un'estensione gawk"
 
-#: awkgram.y:798
+#: awkgram.y:841
 #, c-format
 msgid "`nextfile' used in %s action"
 msgstr "`nextfile' usato in 'azione' %s"
 
-#: awkgram.y:822
+#: awkgram.y:865
 msgid "`return' used outside function context"
 msgstr "`return' usato fuori da una funzione"
 
-#: awkgram.y:896
+#: awkgram.y:925
 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'"
 msgstr "`print' da solo in BEGIN o END dovrebbe forse essere `print \"\"'"
 
-#: awkgram.y:966 awkgram.y:970 awkgram.y:994
+#: awkgram.y:995 awkgram.y:999 awkgram.y:1023
 msgid "`delete array' is a gawk extension"
 msgstr "`delete array' è un'estensione gawk"
 
-#: awkgram.y:990
+#: awkgram.y:1019
 msgid "`delete(array)' is a non-portable tawk extension"
 msgstr "`delete(array)' è un'estensione tawk non-portabile"
 
-#: awkgram.y:1108
+#: awkgram.y:1135
 msgid "multistage two-way pipelines don't work"
 msgstr "'pipeline' multistadio bidirezionali non funzionano"
 
-#: awkgram.y:1211
+#: awkgram.y:1238
 msgid "regular expression on right of assignment"
 msgstr "espressione regolare usata per assegnare un valore"
 
-#: awkgram.y:1222
+#: awkgram.y:1249
 msgid "regular expression on left of `~' or `!~' operator"
 msgstr "espressione regolare prima di operatore `~' o `!~'"
 
-#: awkgram.y:1238 awkgram.y:1389
+#: awkgram.y:1265 awkgram.y:1419
 msgid "old awk does not support the keyword `in' except after `for'"
 msgstr "il vecchio awk non supporta la parola-chiave `in' se non dopo `for'"
 
-#: awkgram.y:1248
+#: awkgram.y:1275
 msgid "regular expression on right of comparison"
 msgstr "espressione regolare a destra in un confronto"
 
-#: awkgram.y:1364
+#: awkgram.y:1394
 #, c-format
 msgid "`getline var' invalid inside `%s' rule"
 msgstr "`getline var' invalida all'interno della regola `%s'"
 
-#: awkgram.y:1367
+#: awkgram.y:1397 eval.c:2504
 #, c-format
 msgid "`getline' invalid inside `%s' rule"
 msgstr "`getline' invalida all'interno della regola `%s'"
 
-#: awkgram.y:1372
+#: awkgram.y:1402
 msgid "non-redirected `getline' undefined inside END action"
 msgstr "`getline' non re-diretta indefinita dentro 'azione' END"
 
-#: awkgram.y:1391
+#: awkgram.y:1421
 msgid "old awk does not support multidimensional arrays"
 msgstr "il vecchio awk non supporta vettori multidimensionali"
 
-#: awkgram.y:1488
+#: awkgram.y:1517
 msgid "call of `length' without parentheses is not portable"
 msgstr "chiamata a `length' senza parentesi non portabile"
 
-#: awkgram.y:1554
+#: awkgram.y:1580
 msgid "indirect function calls are a gawk extension"
 msgstr "chiamate a funzione indirette sono un'estensione gawk"
 
-#: awkgram.y:1567
+#: awkgram.y:1593
 #, c-format
 msgid "can not use special variable `%s' for indirect function call"
 msgstr ""
 "non posso usare la variabile speciale `%s' come parametro indiretto di "
 "funzione "
 
-#: awkgram.y:1645
+#: awkgram.y:1671
 msgid "invalid subscript expression"
 msgstr "espressione indice invalida"
 
-#: awkgram.y:1966 awkgram.y:1986 msg.c:112
+#: awkgram.y:1711
+msgid "use of non-array as array"
+msgstr ""
+
+#: awkgram.y:1975 awkgram.y:1995 msg.c:98
 msgid "warning: "
 msgstr "attenzione: "
 
-#: awkgram.y:1984 msg.c:144
+#: awkgram.y:1993 msg.c:130
 msgid "fatal: "
 msgstr "fatale: "
 
-#: awkgram.y:2034
+#: awkgram.y:2043
 msgid "unexpected newline or end of string"
 msgstr "carattere 'a capo' o fine stringa inaspettati"
 
-#: awkgram.y:2299 awkgram.y:2357 awkgram.y:2545
+#: awkgram.y:2300 awkgram.y:2358 awkgram.y:2542
 #, c-format
 msgid "can't open source file `%s' for reading (%s)"
 msgstr "non riesco ad aprire file sorgente `%s' in lettura (%s)"
 
-#: awkgram.y:2300 awkgram.y:2358 builtin.c:124
+#: awkgram.y:2301 awkgram.y:2359 builtin.c:122
 msgid "reason unknown"
 msgstr "ragione indeterminata"
 
-#: awkgram.y:2316
+#: awkgram.y:2317
 #, c-format
 msgid "already included source file `%s'"
 msgstr "file sorgente `%s' già incluso"
 
-#: awkgram.y:2342
+#: awkgram.y:2343
 msgid "@include is a gawk extension"
 msgstr "@include è un'estensione gawk"
 
-#: awkgram.y:2348
+#: awkgram.y:2349
 msgid "empty filename after @include"
 msgstr "nome-file mancante dopo @include"
 
-#: awkgram.y:2497
+#: awkgram.y:2494
 msgid "empty program text on command line"
 msgstr "programma nullo sulla linea comandi"
 
-#: awkgram.y:2612
+#: awkgram.y:2609
 #, c-format
 msgid "can't read sourcefile `%s' (%s)"
 msgstr "non riesco a leggere file sorgente `%s' (%s)"
 
-#: awkgram.y:2623
+#: awkgram.y:2620
 #, c-format
 msgid "source file `%s' is empty"
 msgstr "file sorgente `%s' vuoto"
 
-#: awkgram.y:2800
+#: awkgram.y:2797
 msgid "source file does not end in newline"
 msgstr "file sorgente non termina con carattere 'a capo'"
 
-#: awkgram.y:2905
+#: awkgram.y:2900
 msgid "unterminated regexp ends with `\\' at end of file"
 msgstr "espressione regolare non completata termina con `\\' a fine file"
 
-#: awkgram.y:2929
+#: awkgram.y:2924
 #, c-format
 msgid "%s: %d: tawk regex modifier `/.../%c' doesn't work in gawk"
 msgstr ""
 "%s: %d: modificatore di espressione regolare tawk `/.../%c' non valido in "
 "gawk"
 
-#: awkgram.y:2933
+#: awkgram.y:2928
 #, c-format
 msgid "tawk regex modifier `/.../%c' doesn't work in gawk"
 msgstr "modificatore di espressione regolare tawk `/.../%c' non valido in gawk"
 
-#: awkgram.y:2940
+#: awkgram.y:2935
 msgid "unterminated regexp"
 msgstr "espressione regolare non completata"
 
-#: awkgram.y:2944
+#: awkgram.y:2939
 msgid "unterminated regexp at end of file"
 msgstr "espressione regolare non completata a fine file"
 
-#: awkgram.y:3003
+#: awkgram.y:2998
 msgid "use of `\\ #...' line continuation is not portable"
 msgstr "uso di `\\ #...' continuazione linea non portabile"
 
-#: awkgram.y:3019
+#: awkgram.y:3014
 msgid "backslash not last character on line"
 msgstr "'\\' non è l'ultimo carattere della linea"
 
-#: awkgram.y:3080
+#: awkgram.y:3075
 msgid "POSIX does not allow operator `**='"
 msgstr "POSIX non permette l'operatore `**='"
 
-#: awkgram.y:3082
+#: awkgram.y:3077
 msgid "old awk does not support operator `**='"
 msgstr "il vecchio awk non supporta l'operatore `**='"
 
-#: awkgram.y:3091
+#: awkgram.y:3086
 msgid "POSIX does not allow operator `**'"
 msgstr "POSIX non permette l'operatore `**'"
 
-#: awkgram.y:3093
+#: awkgram.y:3088
 msgid "old awk does not support operator `**'"
 msgstr "il vecchio awk non supporta l'operatore `**'"
 
-#: awkgram.y:3128
+#: awkgram.y:3123
 msgid "operator `^=' is not supported in old awk"
 msgstr "l'operatore `^=' non è supportato nel vecchio awk"
 
-#: awkgram.y:3136
+#: awkgram.y:3131
 msgid "operator `^' is not supported in old awk"
 msgstr "l'operatore `^' non è supportato nel vecchio awk"
 
-#: awkgram.y:3229 awkgram.y:3245
+#: awkgram.y:3224 awkgram.y:3240
 msgid "unterminated string"
 msgstr "stringa non terminata"
 
-#: awkgram.y:3466
+#: awkgram.y:3436
 #, c-format
 msgid "invalid char '%c' in expression"
 msgstr "carattere '%c' non valido in un'espressione"
 
-#: awkgram.y:3513
+#: awkgram.y:3483
 #, c-format
 msgid "`%s' is a gawk extension"
 msgstr "`%s' è un'estensione gawk"
 
-#: awkgram.y:3518
+#: awkgram.y:3488
 #, c-format
 msgid "`%s' is a Bell Labs extension"
 msgstr "`%s' è un'estensione Bell Labs"
 
-#: awkgram.y:3523
+#: awkgram.y:3493
 #, c-format
 msgid "POSIX does not allow `%s'"
 msgstr "POSIX non permette `%s'"
 
-#: awkgram.y:3531
+#: awkgram.y:3501
 #, c-format
 msgid "`%s' is not supported in old awk"
 msgstr "`%s' non è supportato nel vecchio awk"
 
-#: awkgram.y:3598
+#: awkgram.y:3568
 msgid "`goto' considered harmful!\n"
 msgstr "`goto' considerato pericoloso!\n"
 
-#: awkgram.y:3632
+#: awkgram.y:3619
 #, c-format
 msgid "%d is invalid as number of arguments for %s"
 msgstr "%d non valido come numero di argomenti per %s"
 
-#: awkgram.y:3667
+#: awkgram.y:3654
 #, c-format
 msgid "%s: string literal as last arg of substitute has no effect"
 msgstr "%s: una stringa come ultimo argomento di 'substitute' non ha effetto"
 
-#: awkgram.y:3672
+#: awkgram.y:3659
 #, c-format
 msgid "%s third parameter is not a changeable object"
 msgstr "il terzo parametro di '%s'  non è un oggetto modificabile"
 
-#: awkgram.y:3751 awkgram.y:3754
+#: awkgram.y:3732 awkgram.y:3735
 msgid "match: third argument is a gawk extension"
 msgstr "match: il terzo argomento è un'estensione gawk"
 
-#: awkgram.y:3808 awkgram.y:3811
+#: awkgram.y:3789 awkgram.y:3792
 msgid "close: second argument is a gawk extension"
 msgstr "close: il secondo argomento è un'estensione gawk"
 
-#: awkgram.y:3823
+#: awkgram.y:3804
 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore"
 msgstr ""
 "uso scorretto di dcgettext(_\"...\"): togliere il carattere '_' iniziale"
 
-#: awkgram.y:3838
+#: awkgram.y:3819
 msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore"
 msgstr ""
 "uso scorretto di dcngettext(_\"...\"): togliere il carattere '_' iniziale"
 
-#: awkgram.y:3904
+#: awkgram.y:3911
+#, c-format
+msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d"
+msgstr "funzione `%s': parametro #%d, `%s', duplica parametro #%d"
+
+#: awkgram.y:3953
 #, c-format
 msgid "function `%s': parameter `%s' shadows global variable"
 msgstr "funzione `%s': parametro `%s' nasconde variabile globale"
 
-#: awkgram.y:3961
+#: awkgram.y:4111
 #, c-format
 msgid "could not open `%s' for writing (%s)"
 msgstr "non riesco ad aprire `%s' in scrittura (%s)"
 
-#: awkgram.y:3962
+#: awkgram.y:4112
 msgid "sending variable list to standard error"
 msgstr "mando lista variabili a 'standard error'"
 
-#: awkgram.y:3970
+#: awkgram.y:4118
 #, c-format
 msgid "%s: close failed (%s)"
 msgstr "%s: 'close' fallita (%s)"
 
-#: awkgram.y:3995
+#: awkgram.y:4170
 msgid "shadow_funcs() called twice!"
 msgstr "shadow_funcs() chiamata due volte!"
 
-#: awkgram.y:4003
+#: awkgram.y:4176
 msgid "there were shadowed variables."
 msgstr "c'erano variabili nascoste."
 
-#: awkgram.y:4074
-#, c-format
-msgid "function name `%s' previously defined"
-msgstr "funzione di nome `%s' definita in precedenza"
-
-#: awkgram.y:4120
+#: awkgram.y:4206
 #, c-format
 msgid "function `%s': can't use function name as parameter name"
 msgstr "funzione `%s': non posso usare nome della funzione come nome parametro"
 
-#: awkgram.y:4123
+#: awkgram.y:4210
 #, c-format
 msgid "function `%s': can't use special variable `%s' as a function parameter"
 msgstr ""
 "funzione `%s': non posso usare la variabile speciale `%s' come parametro di "
 "funzione"
 
-#: awkgram.y:4131
+#: awkgram.y:4226
 #, c-format
-msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d"
-msgstr "funzione `%s': parametro #%d, `%s', duplica parametro #%d"
+msgid "function name `%s' previously defined"
+msgstr "funzione di nome `%s' definita in precedenza"
 
-#: awkgram.y:4210 awkgram.y:4216
+#: awkgram.y:4394 awkgram.y:4400
 #, c-format
 msgid "function `%s' called but never defined"
 msgstr "funzione `%s' chiamata ma mai definita"
 
-#: awkgram.y:4219
+#: awkgram.y:4403
 #, c-format
 msgid "function `%s' defined but never called directly"
 msgstr "funzione `%s' definita ma mai chiamata direttamente"
 
-#: awkgram.y:4251
+#: awkgram.y:4435
 #, c-format
 msgid "regexp constant for parameter #%d yields boolean value"
 msgstr ""
 "espressione regolare di valore costante per parametro #%d genera valore "
 "booleano"
 
-#: awkgram.y:4297
+#: awkgram.y:4544
 #, c-format
 msgid ""
 "function `%s' called with space between name and `(',\n"
@@ -479,226 +530,229 @@ msgstr ""
 "funzione `%s' chiamata con spazio tra il nome e `(',\n"
 "o usata come variabile o vettore"
 
-#: awkgram.y:4505
+#: awkgram.y:4791 eval.c:2056
 msgid "division by zero attempted"
 msgstr "tentativo di dividere per zero"
 
-#: awkgram.y:4514
+#: awkgram.y:4800 eval.c:2072
 #, c-format
 msgid "division by zero attempted in `%%'"
 msgstr "tentativo di dividere per zero in `%%'"
 
-#: builtin.c:122
+#: builtin.c:120
 #, c-format
 msgid "%s to \"%s\" failed (%s)"
 msgstr "%s a \"%s\" fallita (%s)"
 
-#: builtin.c:123
+#: builtin.c:121
 msgid "standard output"
 msgstr "standard output"
 
-#: builtin.c:137
+#: builtin.c:135
 msgid "exp: received non-numeric argument"
 msgstr "exp: argomento non numerico"
 
-#: builtin.c:143
+#: builtin.c:141
 #, c-format
 msgid "exp: argument %g is out of range"
 msgstr "exp: argomento %g fuori dai limiti ammessi"
 
-#: builtin.c:202
+#: builtin.c:200
 #, c-format
 msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing"
 msgstr ""
 "fflush: non posso scaricare: 'pipe' `%s' aperta in lettura, non in scrittura"
 
-#: builtin.c:205
+#: builtin.c:203
 #, c-format
 msgid "fflush: cannot flush: file `%s' opened for reading, not writing"
 msgstr ""
 "fflush: non posso scaricare: file `%s' aperto in lettura, non in scrittura"
 
-#: builtin.c:217
+#: builtin.c:215
 #, c-format
 msgid "fflush: `%s' is not an open file, pipe or co-process"
 msgstr "fflush: `%s' non è un file aperto, una 'pipe' o un co-processo"
 
-#: builtin.c:335
+#: builtin.c:333
 msgid "index: received non-string first argument"
 msgstr "index: il primo argomento non è una stringa"
 
-#: builtin.c:337
+#: builtin.c:335
 msgid "index: received non-string second argument"
 msgstr "index: il secondo argomento non è una stringa"
 
-#: builtin.c:461
+#: builtin.c:457
 msgid "int: received non-numeric argument"
 msgstr "int: argomento non numerico"
 
-#: builtin.c:497
+#: builtin.c:493
 msgid "length: received array argument"
 msgstr "length: l'argomento fornito è un vettore"
 
-#: builtin.c:500
+#: builtin.c:496
 msgid "`length(array)' is a gawk extension"
 msgstr "`length(array)' è un'estensione gawk"
 
-#: builtin.c:508
+#: builtin.c:504
 msgid "length: received non-string argument"
 msgstr "length: l'argomento non è una stringa"
 
-#: builtin.c:539
+#: builtin.c:535
 msgid "log: received non-numeric argument"
 msgstr "log: argomento non numerico"
 
-#: builtin.c:542
+#: builtin.c:538
 #, c-format
 msgid "log: received negative argument %g"
 msgstr "log: argomento negativo %g"
 
-#: builtin.c:740 builtin.c:745
+#: builtin.c:694 builtin.c:699
 msgid "fatal: must use `count$' on all formats or none"
 msgstr "fatale: `count$' va usato per ogni 'format' o per nessuno"
 
-#: builtin.c:815
+#: builtin.c:762
 #, c-format
 msgid "field width is ignored for `%%' specifier"
 msgstr "larghezza campo ignorata per la specifica `%%'"
 
-#: builtin.c:817
+#: builtin.c:764
 #, c-format
 msgid "precision is ignored for `%%' specifier"
 msgstr "precisione ignorata per la specifica `%%'"
 
-#: builtin.c:819
+#: builtin.c:766
 #, c-format
 msgid "field width and precision are ignored for `%%' specifier"
 msgstr "larghezza campo e precisone ignorate per la specifica `%%'"
 
-#: builtin.c:870
+#: builtin.c:817
 msgid "fatal: `$' is not permitted in awk formats"
 msgstr "fatale: operatore `$' non consentito nei 'format' awk"
 
-#: builtin.c:879
+#: builtin.c:826
 msgid "fatal: arg count with `$' must be > 0"
 msgstr "fatale: numero argomenti con `$' dev'essere > 0"
 
-#: builtin.c:883
+#: builtin.c:830
 #, c-format
 msgid "fatal: arg count %ld greater than total number of supplied arguments"
 msgstr "fatale: numero argomenti %ld > del numero totale argomenti specificati"
 
-#: builtin.c:887
+#: builtin.c:834
 msgid "fatal: `$' not permitted after period in format"
 msgstr "fatale: `$' non permesso dopo il punto in un 'format'"
 
-#: builtin.c:903
+#: builtin.c:850
 msgid "fatal: no `$' supplied for positional field width or precision"
 msgstr "fatale: manca `$' per i campi posizionali larghezza o precisione"
 
-#: builtin.c:975
+#: builtin.c:921
 msgid "`l' is meaningless in awk formats; ignored"
 msgstr "`l' non ha senso nei 'format' awk; ignorato"
 
-#: builtin.c:979
+#: builtin.c:925
 msgid "fatal: `l' is not permitted in POSIX awk formats"
 msgstr "fatale: `l' non permesso nei 'format' POSIX awk"
 
-#: builtin.c:992
+#: builtin.c:938
 msgid "`L' is meaningless in awk formats; ignored"
 msgstr "`L' non ha senso nei 'format' awk; ignorato"
 
-#: builtin.c:996
+#: builtin.c:942
 msgid "fatal: `L' is not permitted in POSIX awk formats"
 msgstr "`L' non ha senso nei 'format' awk; ignorato"
 
-#: builtin.c:1009
+#: builtin.c:955
 msgid "`h' is meaningless in awk formats; ignored"
 msgstr "`h' non ha senso nei 'format' awk; ignorato"
 
-#: builtin.c:1013
+#: builtin.c:959
 msgid "fatal: `h' is not permitted in POSIX awk formats"
 msgstr "fatale: `h' non permesso nei 'format' POSIX awk"
 
-#: builtin.c:1408
+#: builtin.c:1272
 #, c-format
 msgid "[s]printf: value %g is out of range for `%%%c' format"
 msgstr "[s]printf: valore %g fuori dai limiti ammessi per il 'format' `%%%c'"
 
-#: builtin.c:1506
+#: builtin.c:1332
 #, c-format
 msgid "ignoring unknown format specifier character `%c': no argument converted"
-msgstr "carattere di 'format' sconosciuto `%c' ignorato: nessun argomento convertito"
+msgstr ""
+"carattere di 'format' sconosciuto `%c' ignorato: nessun argomento convertito"
 
-#: builtin.c:1511
+#: builtin.c:1337
 msgid "fatal: not enough arguments to satisfy format string"
-msgstr "fatale: argomenti in numero minore di quelli richiesti dalla stringa di 'format'"
+msgstr ""
+"fatale: argomenti in numero minore di quelli richiesti dalla stringa di "
+"'format'"
 
-#: builtin.c:1513
+#: builtin.c:1339
 msgid "^ ran out for this one"
 msgstr "^ esauriti a questo punto"
 
-#: builtin.c:1520
+#: builtin.c:1346
 msgid "[s]printf: format specifier does not have control letter"
 msgstr "[s]printf: specifica di 'format' senza un carattere di controllo"
 
-#: builtin.c:1523
+#: builtin.c:1349
 msgid "too many arguments supplied for format string"
 msgstr "troppi argomenti specificati per questa stringa di 'format'"
 
-#: builtin.c:1598 builtin.c:1609
+#: builtin.c:1423 builtin.c:1434
 msgid "printf: no arguments"
 msgstr "printf: mancano argomenti"
 
-#: builtin.c:1650
+#: builtin.c:1475
 msgid "sqrt: received non-numeric argument"
 msgstr "sqrt: argomento non numerico"
 
-#: builtin.c:1654
+#: builtin.c:1479
 #, c-format
 msgid "sqrt: called with negative argument %g"
 msgstr "sqrt: chiamata con argomento negativo %g"
 
-#: builtin.c:1685
+#: builtin.c:1503
 #, c-format
 msgid "substr: length %g is not >= 1"
 msgstr "substr: lunghezza %g non >= 1"
 
-#: builtin.c:1687
+#: builtin.c:1505
 #, c-format
 msgid "substr: length %g is not >= 0"
 msgstr "substr: lunghezza %g non >= 0"
 
-#: builtin.c:1694
+#: builtin.c:1512
 #, c-format
 msgid "substr: non-integer length %g will be truncated"
 msgstr "substr: lunghezza non intera %g: sarà troncata"
 
-#: builtin.c:1699
+#: builtin.c:1517
 #, c-format
 msgid "substr: length %g too big for string indexing, truncating to %g"
 msgstr "substr: lunghezza %g troppo elevata per indice stringa, tronco a %g"
 
-#: builtin.c:1711
+#: builtin.c:1529
 #, c-format
 msgid "substr: start index %g is invalid, using 1"
 msgstr "substr: indice di partenza %g non valido, uso 1"
 
-#: builtin.c:1716
+#: builtin.c:1534
 #, c-format
 msgid "substr: non-integer start index %g will be truncated"
 msgstr "substr: indice di partenza non intero %g: sarà troncato"
 
-#: builtin.c:1741
+#: builtin.c:1559
 msgid "substr: source string is zero length"
 msgstr "substr: stringa di partenza lunga zero"
 
-#: builtin.c:1757
+#: builtin.c:1575
 #, c-format
 msgid "substr: start index %g is past end of string"
 msgstr "substr: indice di partenza %g oltre la fine della stringa"
 
-#: builtin.c:1765
+#: builtin.c:1583
 #, c-format
 msgid ""
 "substr: length %g at start index %g exceeds length of first argument (%lu)"
@@ -706,223 +760,228 @@ msgstr ""
 "substr: lunghezza %g all'indice di partenza %g supera la lunghezza del primo "
 "argomento (%lu)"
 
-#: builtin.c:1839
+#: builtin.c:1657
 msgid "strftime: format value in PROCINFO[\"strftime\"] has numeric type"
 msgstr ""
 "strftime: il valore del 'format' in PROCINFO[\"strftime\"] è di tipo numerico"
 
-#: builtin.c:1862
+#: builtin.c:1680
 msgid "strftime: received non-numeric second argument"
 msgstr "strftime: il secondo argomento non è numerico"
 
-#: builtin.c:1866
+#: builtin.c:1683
 msgid "strftime: second argument less than 0 or too big for time_t"
 msgstr "strftime: secondo argomento < 0 o troppo elevato per time_t"
 
-#: builtin.c:1873
+#: builtin.c:1690
 msgid "strftime: received non-string first argument"
 msgstr "strftime: il primo argomento non è una stringa"
 
-#: builtin.c:1880
+#: builtin.c:1696
 msgid "strftime: received empty format string"
 msgstr "strftime: 'format' è una stringa nulla"
 
-#: builtin.c:1946
+#: builtin.c:1762
 msgid "mktime: received non-string argument"
 msgstr "mktime: l'argomento non è una stringa"
 
-#: builtin.c:1963
+#: builtin.c:1779
 msgid "mktime: at least one of the values is out of the default range"
 msgstr "mktime: almeno un valore è fuori dall'intervallo di default"
 
-#: builtin.c:1998
+#: builtin.c:1814
 msgid "'system' function not allowed in sandbox mode"
 msgstr "la funzione 'system' non è permessa in modo 'sandbox'"
 
-#: builtin.c:2003
+#: builtin.c:1819
 msgid "system: received non-string argument"
 msgstr "system: l'argomento non è una stringa"
 
-#: builtin.c:2121
+#: builtin.c:1874 eval.c:1159 eval.c:1790 eval.c:1803
+#, c-format
+msgid "reference to uninitialized variable `%s'"
+msgstr "riferimento a variabile non inizializzata `%s'"
+
+#: builtin.c:1941
 #, c-format
 msgid "reference to uninitialized field `$%d'"
 msgstr "riferimento a variabile non inizializzata `$%d'"
 
-#: builtin.c:2208
+#: builtin.c:2028
 msgid "tolower: received non-string argument"
 msgstr "tolower: l'argomento non è una stringa"
 
-#: builtin.c:2242
+#: builtin.c:2062
 msgid "toupper: received non-string argument"
 msgstr "toupper: l'argomento non è una stringa"
 
-#: builtin.c:2278
+#: builtin.c:2098
 msgid "atan2: received non-numeric first argument"
 msgstr "atan2: il primo argomento non è numerico"
 
-#: builtin.c:2280
+#: builtin.c:2100
 msgid "atan2: received non-numeric second argument"
 msgstr "atan2: il secondo argomento non è numerico"
 
-#: builtin.c:2299
+#: builtin.c:2119
 msgid "sin: received non-numeric argument"
 msgstr "sin: l'argomento non è numerico"
 
-#: builtin.c:2315
+#: builtin.c:2135
 msgid "cos: received non-numeric argument"
 msgstr "cos: l'argomento non è numerico"
 
-#: builtin.c:2368
+#: builtin.c:2188
 msgid "srand: received non-numeric argument"
 msgstr "srand: l'argomento non è numerico"
 
-#: builtin.c:2399
+#: builtin.c:2219
 msgid "match: third argument is not an array"
 msgstr "match: il terzo argomento non è un vettore"
 
-#: builtin.c:2664
+#: builtin.c:2483
 msgid "gensub: third argument of 0 treated as 1"
 msgstr "gensub: il terzo argomento è 0, trattato come 1"
 
-#: builtin.c:2957
+#: builtin.c:2776
 msgid "lshift: received non-numeric first argument"
 msgstr "lshift: il primo argomento non è numerico"
 
-#: builtin.c:2959
+#: builtin.c:2778
 msgid "lshift: received non-numeric second argument"
 msgstr "lshift: il secondo argomento non è numerico"
 
-#: builtin.c:2965
+#: builtin.c:2784
 #, c-format
 msgid "lshift(%lf, %lf): negative values will give strange results"
 msgstr "lshift(%lf, %lf): valori negativi daranno risultati strani"
 
-#: builtin.c:2967
+#: builtin.c:2786
 #, c-format
 msgid "lshift(%lf, %lf): fractional values will be truncated"
 msgstr "lshift(%lf, %lf): valori con decimali verranno troncati"
 
-#: builtin.c:2969
+#: builtin.c:2788
 #, c-format
 msgid "lshift(%lf, %lf): too large shift value will give strange results"
 msgstr "lshift(%lf, %lf): valori troppo alti daranno risultati strani"
 
-#: builtin.c:2994
+#: builtin.c:2813
 msgid "rshift: received non-numeric first argument"
 msgstr "rshift: il primo argomento non è numerico"
 
-#: builtin.c:2996
+#: builtin.c:2815
 msgid "rshift: received non-numeric second argument"
 msgstr "rshift: il secondo argomento non è numerico"
 
-#: builtin.c:3002
+#: builtin.c:2821
 #, c-format
 msgid "rshift(%lf, %lf): negative values will give strange results"
 msgstr "rshift(%lf, %lf): valori negativi daranno risultati strani"
 
-#: builtin.c:3004
+#: builtin.c:2823
 #, c-format
 msgid "rshift(%lf, %lf): fractional values will be truncated"
 msgstr "rshift(%lf, %lf): valori con decimali verranno troncati"
 
-#: builtin.c:3006
+#: builtin.c:2825
 #, c-format
 msgid "rshift(%lf, %lf): too large shift value will give strange results"
 msgstr "rshift(%lf, %lf): valori troppo alti daranno risultati strani"
 
-#: builtin.c:3031
+#: builtin.c:2850
 msgid "and: received non-numeric first argument"
 msgstr "and: il primo argomento non è numerico"
 
-#: builtin.c:3033
+#: builtin.c:2852
 msgid "and: received non-numeric second argument"
 msgstr "and: il secondo argomento non è numerico"
 
-#: builtin.c:3039
+#: builtin.c:2858
 #, c-format
 msgid "and(%lf, %lf): negative values will give strange results"
 msgstr "and(%lf, %lf): valori negativi daranno risultati strani"
 
-#: builtin.c:3041
+#: builtin.c:2860
 #, c-format
 msgid "and(%lf, %lf): fractional values will be truncated"
 msgstr "and(%lf, %lf): valori con decimali verranno troncati"
 
-#: builtin.c:3066
+#: builtin.c:2885
 msgid "or: received non-numeric first argument"
 msgstr "or: il primo argomento non è numerico"
 
-#: builtin.c:3068
+#: builtin.c:2887
 msgid "or: received non-numeric second argument"
 msgstr "or: il secondo argomento non è numerico"
 
-#: builtin.c:3074
+#: builtin.c:2893
 #, c-format
 msgid "or(%lf, %lf): negative values will give strange results"
 msgstr "or(%lf, %lf): valori negativi daranno risultati strani"
 
-#: builtin.c:3076
+#: builtin.c:2895
 #, c-format
 msgid "or(%lf, %lf): fractional values will be truncated"
 msgstr "or(%lf, %lf): valori con decimali verranno troncati"
 
-#: builtin.c:3102
+#: builtin.c:2923
 msgid "xor: received non-numeric first argument"
 msgstr "xor: il primo argomento non è numerico"
 
-#: builtin.c:3104
+#: builtin.c:2925
 msgid "xor: received non-numeric second argument"
 msgstr "xor: il secondo argomento non è numerico"
 
-#: builtin.c:3110
+#: builtin.c:2931
 #, c-format
 msgid "xor(%lf, %lf): negative values will give strange results"
 msgstr "xor(%lf, %lf): valori negativi daranno risultati strani"
 
-#: builtin.c:3112
+#: builtin.c:2933
 #, c-format
 msgid "xor(%lf, %lf): fractional values will be truncated"
 msgstr "xor(%lf, %lf): valori con decimali verranno troncati"
 
-#: builtin.c:3136
+#: builtin.c:2957 builtin.c:2963
 msgid "compl: received non-numeric argument"
 msgstr "compl: l'argomento non è numerico"
 
-#: builtin.c:3142
+#: builtin.c:2965
 #, c-format
 msgid "compl(%lf): negative value will give strange results"
 msgstr "compl(%lf): valore negativo darà risultati strani"
 
-#: builtin.c:3144
+#: builtin.c:2967
 #, c-format
 msgid "compl(%lf): fractional value will be truncated"
 msgstr "compl(%lf): valore con decimali verrà troncato"
 
-#: builtin.c:3313
+#: builtin.c:3136
 #, c-format
 msgid "dcgettext: `%s' is not a valid locale category"
 msgstr "dcgettext: `%s' non è una categoria 'locale' valida"
 
-#: eval.c:395
+#: eval.c:412
 #, c-format
 msgid "unknown nodetype %d"
 msgstr "tipo nodo sconosciuto %d"
 
-#: eval.c:406 eval.c:420
+#: eval.c:423 eval.c:437
 #, c-format
 msgid "unknown opcode %d"
 msgstr "codice operativo sconosciuto %d"
 
-#: eval.c:417
+#: eval.c:434
 #, c-format
 msgid "opcode %s not an operator or keyword"
 msgstr "codice operativo %s non è un operatore o una parola chiave"
 
-#: eval.c:472
+#: eval.c:488
 msgid "buffer overflow in genflags2str"
 msgstr "superamento limiti buffer in 'genflags2str'"
 
-#: eval.c:675
+#: eval.c:698
 #, c-format
 msgid ""
 "\n"
@@ -933,246 +992,307 @@ msgstr ""
 "\t# 'Stack' (Pila) Chiamate Funzione:\n"
 "\n"
 
-#: eval.c:704
+#: eval.c:725
 msgid "`IGNORECASE' is a gawk extension"
 msgstr "`IGNORECASE' è un'estensione gawk"
 
-#: eval.c:736
+#: eval.c:754
 msgid "`BINMODE' is a gawk extension"
 msgstr "`BINMODE' è un'estensione gawk"
 
-#: eval.c:793
+#: eval.c:812
 #, c-format
 msgid "BINMODE value `%s' is invalid, treated as 3"
 msgstr "valore di BINMODE `%s' non valido, considerato come 3"
 
-#: eval.c:885
+#: eval.c:902
 #, c-format
 msgid "bad `%sFMT' specification `%s'"
 msgstr "specificazione invalida `%sFMT' `%s'"
 
-#: eval.c:969
+#: eval.c:980
 msgid "turning off `--lint' due to assignment to `LINT'"
 msgstr "disabilito `--lint' a causa di assegnamento a `LINT'"
 
-#: eval.c:1132
+#: eval.c:1127 eval.c:1777
+#, fuzzy, c-format
+msgid "can't use function name `%s' as variable or array"
+msgstr "non posso usare nome di funzione `%s' come nome di variabile"
+
+#: eval.c:1158 eval.c:1789 eval.c:1802
 #, c-format
 msgid "reference to uninitialized argument `%s'"
 msgstr "riferimento ad argomento non inizializzato `%s'"
 
-#: eval.c:1133
-#, c-format
-msgid "reference to uninitialized variable `%s'"
-msgstr "riferimento a variabile non inizializzata `%s'"
-
-#: eval.c:1151
+#: eval.c:1177
 msgid "attempt to field reference from non-numeric value"
 msgstr "tentativo di riferimento a un campo da valore non numerico"
 
-#: eval.c:1153
+#: eval.c:1179
 msgid "attempt to field reference from null string"
 msgstr "tentativo di riferimento a un campo da una stringa nulla"
 
-#: eval.c:1161
+#: eval.c:1185
 #, c-format
 msgid "attempt to access field %ld"
 msgstr "tentativo di accedere al campo %ld"
 
-#: eval.c:1170
+#: eval.c:1194
 #, c-format
 msgid "reference to uninitialized field `$%ld'"
 msgstr "riferimento a campo non inizializzato `$%ld'"
 
-#: eval.c:1257
+#: eval.c:1256
 #, c-format
 msgid "function `%s' called with more arguments than declared"
 msgstr "funzione `%s' chiamata con più argomenti di quelli previsti"
 
-#: eval.c:1452
+#: eval.c:1437
 #, c-format
 msgid "unwind_stack: unexpected type `%s'"
 msgstr "unwind_stack: tipo non previsto `%s'"
 
-#: eval.c:1546
+#: eval.c:1532
 msgid "division by zero attempted in `/='"
 msgstr "divisione per zero tentata in `/='"
 
-#: eval.c:1553
+#: eval.c:1539
 #, c-format
 msgid "division by zero attempted in `%%='"
 msgstr "divisione per zero tentata in `%%='"
 
-#: ext.c:70
+#: eval.c:1876 eval.c:2122
+#, fuzzy, c-format
+msgid "attempt to use array `%s[\"%.*s\"]' in a scalar context"
+msgstr "tentativo di usare vettore `%s' in un contesto scalare"
+
+#: eval.c:1907
+#, fuzzy
+msgid "assignment used in conditional context"
+msgstr "`return' usato fuori da una funzione"
+
+#: eval.c:1911
+msgid "statement has no effect"
+msgstr ""
+
+#: eval.c:2343
+#, c-format
+msgid "for loop: array `%s' changed size from %ld to %ld during loop execution"
+msgstr ""
+
+#: eval.c:2458
+#, c-format
+msgid "function called indirectly through `%s' does not exist"
+msgstr ""
+
+#: eval.c:2470
+#, fuzzy, c-format
+msgid "function `%s' not defined"
+msgstr "funzione di nome `%s' definita in precedenza"
+
+#: eval.c:2511
+#, fuzzy, c-format
+msgid "non-redirected `getline' invalid inside `%s' rule"
+msgstr "`getline' invalida all'interno della regola `%s'"
+
+#: eval.c:2600
+#, c-format
+msgid "error reading input file `%s': %s"
+msgstr ""
+
+#: eval.c:2614
+#, c-format
+msgid "`nextfile' cannot be called from a `%s' rule"
+msgstr ""
+
+#: eval.c:2661
+msgid "`exit' cannot be called in the current context"
+msgstr ""
+
+#: eval.c:2700
+#, c-format
+msgid "`next' cannot be called from a `%s' rule"
+msgstr ""
+
+#: eval.c:2766
+#, c-format
+msgid "Sorry, don't know how to interpret `%s'"
+msgstr ""
+
+#: ext.c:54
 msgid "extensions are not allowed in sandbox mode"
 msgstr "le estensioni non sono permesse in modo 'sandbox'"
 
-#: ext.c:73
+#: ext.c:60 ext.c:65
 msgid "`extension' is a gawk extension"
 msgstr "`extension' è un'estensione gawk"
 
-#: ext.c:80
-msgid "extension: cannot open library `%s' (%s)\n"
+#: ext.c:75
+#, fuzzy, c-format
+msgid "fatal: extension: cannot open `%s' (%s)\n"
 msgstr "estensione: non riesco ad aprire libreria `%s' (%s)\n"
 
-#: ext.c:86
+#: ext.c:84
+#, fuzzy, c-format
 msgid ""
-"extension: library `%s': does not define `plugin_is_GPL_compatible' (%s)\n"
-msgstr ""
-"estensione: libreria `%s': non definisce "
+"fatal: extension: library `%s': does not define "
 "`plugin_is_GPL_compatible' (%s)\n"
-
-#: ext.c:90
-msgid "extension: library `%s': cannot call function `%s' (%s)\n"
 msgstr ""
-"estensione: libreria `%s': non riesco a chiamare funzione `%s' (%s)\n"
+"estensione: libreria `%s': non definisce `plugin_is_GPL_compatible' (%s)\n"
 
-#: ext.c:118
+#: ext.c:93
+#, fuzzy, c-format
+msgid "fatal: extension: library `%s': cannot call function `%s' (%s)\n"
+msgstr "estensione: libreria `%s': non riesco a chiamare funzione `%s' (%s)\n"
+
+#: ext.c:127
 msgid "extension: missing function name"
 msgstr "estensione: manca nome di funzione"
 
-#: ext.c:123
+#: ext.c:132
 #, c-format
 msgid "extension: illegal character `%c' in function name `%s'"
 msgstr "estensione: carattere non ammesso `%c' nel nome di funzione `%s'"
 
-#: ext.c:131
+#: ext.c:141
 #, c-format
 msgid "extension: can't redefine function `%s'"
 msgstr "estensione: non riesco a ridefinire funzione `%s'"
 
-#: ext.c:135
+#: ext.c:145
 #, c-format
 msgid "extension: function `%s' already defined"
 msgstr "estensione: funzione `%s' già definita"
 
-#: ext.c:139
+#: ext.c:150
 #, c-format
 msgid "extension: function name `%s' previously defined"
 msgstr "estensione: funzione di nome `%s' definita in precedenza"
 
-#: ext.c:141
+#: ext.c:152
 #, c-format
 msgid "extension: can't use gawk built-in `%s' as function name"
 msgstr ""
 "estensione: nome funzione interna gawk `%s' non ammesso come nome funzione"
 
-#: ext.c:144
+#: ext.c:156
 #, c-format
 msgid "make_builtin: negative argument count for function `%s'"
 msgstr "make_builtin: contatore argomenti negativo per la funzione `%s'"
 
-#: ext.c:206
+#: ext.c:259
 #, c-format
 msgid "function `%s' defined to take no more than %d argument(s)"
 msgstr "funzione `%s' definita per avere al massimo %d argomenti(o)"
 
-#: ext.c:209
+#: ext.c:262
 #, c-format
 msgid "function `%s': missing argument #%d"
 msgstr "funzione `%s': manca argomento #%d"
 
-#: ext.c:226
+#: ext.c:279
 #, c-format
 msgid "function `%s': argument #%d: attempt to use scalar as an array"
 msgstr "funzione `%s': argomento #%d: tentativo di usare scalare come vettore"
 
-#: ext.c:230
+#: ext.c:283
 #, c-format
 msgid "function `%s': argument #%d: attempt to use array as a scalar"
 msgstr "funzione `%s': argomento #%d: tentativo di usare vettore come scalare"
 
-#: ext.c:244
+#: ext.c:296
 msgid "Operation Not Supported"
 msgstr "Operazione Non Supportata"
 
-#: ext.c:256
-msgid "dynamic loading of library not supported"
-msgstr "caricamento dinamico di libreria non supportato"
-
-#: field.c:339
+#: field.c:328
 msgid "NF set to negative value"
 msgstr "NF impostato a un valore negativo"
 
-#: field.c:962 field.c:969 field.c:973
+#: field.c:951 field.c:958 field.c:962
 msgid "split: fourth argument is a gawk extension"
 msgstr "split: il quarto argomento è un'estensione gawk"
 
-#: field.c:966
+#: field.c:955
 msgid "split: fourth argument is not an array"
 msgstr "split: il quarto argomento non è un vettore"
 
-#: field.c:980
+#: field.c:969
 msgid "split: second argument is not an array"
 msgstr "split: il secondo argomento non è un vettore"
 
-#: field.c:984
+#: field.c:973
 msgid "split: cannot use the same array for second and fourth args"
 msgstr ""
 "split: non si può usare un unico vettore come secondo e quarto argomento"
 
-#: field.c:989
+#: field.c:978
 msgid "split: cannot use a subarray of second arg for fourth arg"
 msgstr ""
-"split: non permesso un quarto argomento che sia un sottovettore del secondo argomento"
+"split: non permesso un quarto argomento che sia un sottovettore del secondo "
+"argomento"
 
-#: field.c:992
+#: field.c:981
 msgid "split: cannot use a subarray of fourth arg for second arg"
 msgstr ""
-"split: non permesso un secondo argomento che sia un sottovettore del quarto argomento"
+"split: non permesso un secondo argomento che sia un sottovettore del quarto "
+"argomento"
 
-#: field.c:1021
+#: field.c:1010
 msgid "split: null string for third arg is a gawk extension"
 msgstr "split: la stringa nulla come terzo arg. è un'estensione gawk"
 
-#: field.c:1061
+#: field.c:1050
 msgid "patsplit: fourth argument is not an array"
 msgstr "patsplit: il secondo argomento non è un vettore"
 
-#: field.c:1066
+#: field.c:1055
 msgid "patsplit: second argument is not an array"
 msgstr "patsplit: il secondo argomento non è un vettore"
 
-#: field.c:1072
+#: field.c:1061
 msgid "patsplit: third argument must be non-null"
 msgstr "patsplit: il terzo argomento non può essere nullo"
 
-#: field.c:1076
+#: field.c:1065
 msgid "patsplit: cannot use the same array for second and fourth args"
 msgstr ""
 "patsplit: non si può usare un unico vettore come secondo e quarto argomento"
 
-#: field.c:1081
+#: field.c:1070
 msgid "patsplit: cannot use a subarray of second arg for fourth arg"
 msgstr ""
-"patsplit: non permesso un quarto argomento che sia un sottovettore del secondo argomento"
+"patsplit: non permesso un quarto argomento che sia un sottovettore del "
+"secondo argomento"
 
-#: field.c:1084
+#: field.c:1073
 msgid "patsplit: cannot use a subarray of fourth arg for second arg"
 msgstr ""
-"patsplit: non permesso un secondo argomento che sia un sottovettore del quarto argomento"
+"patsplit: non permesso un secondo argomento che sia un sottovettore del "
+"quarto argomento"
 
-#: field.c:1122
+#: field.c:1110
 msgid "`FIELDWIDTHS' is a gawk extension"
 msgstr "`FIELDWIDTHS' è un'estensione gawk"
 
-#: field.c:1186
+#: field.c:1173
 #, c-format
 msgid "invalid FIELDWIDTHS value, near `%s'"
 msgstr "valore di FIELDWIDTHS non valido, vicino a `%s'"
 
-#: field.c:1259
+#: field.c:1246
 msgid "null string for `FS' is a gawk extension"
 msgstr "la stringa nulla usata come `FS' è un'estensione gawk"
 
-#: field.c:1263
+#: field.c:1250
 msgid "old awk does not support regexps as value of `FS'"
 msgstr "il vecchio awk non supporta espressioni come valori di `FS'"
 
-#: field.c:1382
+#: field.c:1369
 msgid "`FPAT' is a gawk extension"
 msgstr "`FPAT' è un'estensione gawk"
 
 #: getopt.c:604 getopt.c:633
+#, c-format
 msgid "%s: option '%s' is ambiguous; possibilities:"
 msgstr "%s: opzione '%s' ambigua; possibilità:"
 
@@ -1226,471 +1346,460 @@ msgstr "%s: l'opzione '-W %s' non ammette un argomento\n"
 msgid "%s: option '-W %s' requires an argument\n"
 msgstr "%s: l'opzione '-W %s' richiede un argomento\n"
 
-#: io.c:326
+#: io.c:280
 #, c-format
 msgid "command line argument `%s' is a directory: skipped"
 msgstr "l'argomento in linea comando `%s' è una directory: saltato"
 
-#: io.c:329 io.c:438
+#: io.c:283 io.c:385
 #, c-format
 msgid "cannot open file `%s' for reading (%s)"
 msgstr "non riesco ad aprire file `%s' in lettura (%s)"
 
-#: io.c:568
+#: io.c:501
 #, c-format
 msgid "close of fd %d (`%s') failed (%s)"
 msgstr "chiusura di fd %d (`%s') fallita (%s)"
 
-#: io.c:645
+#: io.c:578
 msgid "redirection not allowed in sandbox mode"
 msgstr "re-direzione non permessa in modo 'sandbox'"
 
-#: io.c:679
+#: io.c:612
 #, c-format
 msgid "expression in `%s' redirection only has numeric value"
 msgstr "espressione nella re-direzione `%s' ha solo un valore numerico"
 
-#: io.c:685
+#: io.c:618
 #, c-format
 msgid "expression for `%s' redirection has null string value"
 msgstr "espressione nella re-direzione `%s' ha per valore la stringa nulla"
 
-#: io.c:690
+#: io.c:623
 #, c-format
 msgid "filename `%s' for `%s' redirection may be result of logical expression"
 msgstr ""
 "nome-file `%s' per la re-direzione `%s' può essere il risultato di una "
 "espressione logica"
 
-#: io.c:733
+#: io.c:666
 #, c-format
 msgid "unnecessary mixing of `>' and `>>' for file `%.*s'"
 msgstr "mistura non necessaria di `>' e `>>' per il file `%.*s'"
 
-#: io.c:786
+#: io.c:719
 #, c-format
 msgid "can't open pipe `%s' for output (%s)"
 msgstr "non posso aprire 'pipe' `%s' in scrittura (%s)"
 
-#: io.c:796
+#: io.c:729
 #, c-format
 msgid "can't open pipe `%s' for input (%s)"
 msgstr "non posso aprire 'pipe' `%s' in lettura (%s)"
 
-#: io.c:819
+#: io.c:752
 #, c-format
 msgid "can't open two way pipe `%s' for input/output (%s)"
 msgstr "non posso aprire 'pipe' bidirezionale `%s' per lettura/scrittura (%s)"
 
-#: io.c:900
+#: io.c:834
 #, c-format
 msgid "can't redirect from `%s' (%s)"
 msgstr "non posso re-dirigere da `%s' (%s)"
 
-#: io.c:903
+#: io.c:837
 #, c-format
 msgid "can't redirect to `%s' (%s)"
 msgstr "non posso re-dirigere a `%s' (%s)"
 
-#: io.c:954
+#: io.c:888
 msgid ""
 "reached system limit for open files: starting to multiplex file descriptors"
 msgstr ""
 "numero massimo consentito di file aperti raggiunto: comincio a riutilizzare "
 "i descrittori di file"
 
-#: io.c:970
+#: io.c:904
 #, c-format
 msgid "close of `%s' failed (%s)."
 msgstr "chiusura di `%s' fallita (%s)."
 
-#: io.c:978
+#: io.c:912
 msgid "too many pipes or input files open"
 msgstr "troppe 'pipe' o file di input aperti"
 
-#: io.c:1000
+#: io.c:934
 msgid "close: second argument must be `to' or `from'"
 msgstr "close: il secondo argomento deve essere `a' o `da'"
 
-#: io.c:1017
+#: io.c:951
 #, c-format
 msgid "close: `%.*s' is not an open file, pipe or co-process"
 msgstr "close: `%.*s' non è un file aperto, una 'pipe' o un co-processo"
 
-#: io.c:1022
+#: io.c:956
 msgid "close of redirection that was never opened"
 msgstr "chiusura di una re-direzione mai aperta"
 
-#: io.c:1120
+#: io.c:1053
 #, c-format
 msgid "close: redirection `%s' not opened with `|&', second argument ignored"
 msgstr "close: re-direzione `%s' non aperta con `|&', ignoro secondo argomento"
 
-#: io.c:1137
+#: io.c:1069
 #, c-format
 msgid "failure status (%d) on pipe close of `%s' (%s)"
 msgstr "errore ritornato (%d) dalla chiusura della 'pipe' `%s' (%s)"
 
-#: io.c:1140
+#: io.c:1072
 #, c-format
 msgid "failure status (%d) on file close of `%s' (%s)"
 msgstr "errore ritornato (%d) dalla chiusura del file `%s' (%s)"
 
-#: io.c:1160
+#: io.c:1092
 #, c-format
 msgid "no explicit close of socket `%s' provided"
 msgstr "nessuna chiusura esplicita richiesta per 'socket' `%s'"
 
-#: io.c:1163
+#: io.c:1095
 #, c-format
 msgid "no explicit close of co-process `%s' provided"
 msgstr "nessuna chiusura esplicita richiesta per co-processo `%s'"
 
-#: io.c:1166
+#: io.c:1098
 #, c-format
 msgid "no explicit close of pipe `%s' provided"
 msgstr "nessuna chiusura esplicita richiesta per 'pipe' `%s'"
 
-#: io.c:1169
+#: io.c:1101
 #, c-format
 msgid "no explicit close of file `%s' provided"
 msgstr "nessuna chiusura esplicita richiesta per file `%s'"
 
-#: io.c:1197 io.c:1252 main.c:825 main.c:862
+#: io.c:1129 io.c:1184 main.c:794 main.c:831
 #, c-format
 msgid "error writing standard output (%s)"
 msgstr "errore scrivendo 'standard output' (%s)"
 
-#: io.c:1201 io.c:1257
+#: io.c:1133 io.c:1189
 #, c-format
 msgid "error writing standard error (%s)"
 msgstr "errore scrivendo 'standard error' (%s)"
 
-#: io.c:1209
+#: io.c:1141
 #, c-format
 msgid "pipe flush of `%s' failed (%s)."
 msgstr "scaricamento di 'pipe' `%s' fallita (%s)."
 
-#: io.c:1212
+#: io.c:1144
 #, c-format
 msgid "co-process flush of pipe to `%s' failed (%s)."
 msgstr "scaricamento da co-processo di 'pipe' a `%s' fallita (%s)."
 
-#: io.c:1215
+#: io.c:1147
 #, c-format
 msgid "file flush of `%s' failed (%s)."
 msgstr "scaricamento di file `%s' fallita (%s)."
 
-#: io.c:1329
+#: io.c:1262
 #, c-format
 msgid "local port %s invalid in `/inet'"
 msgstr "porta locale %s invalida in `/inet'"
 
-#: io.c:1347
+#: io.c:1279
 #, c-format
 msgid "remote host and port information (%s, %s) invalid"
 msgstr "host remoto e informazione di porta (%s, %s) invalidi"
 
-#: io.c:1499
+#: io.c:1431
 #, c-format
 msgid "no (known) protocol supplied in special filename `%s'"
 msgstr "nessuno protocollo (noto) specificato nel filename speciale `%s'"
 
-#: io.c:1513
+#: io.c:1445
 #, c-format
 msgid "special file name `%s' is incomplete"
 msgstr "nome-file speciale `%s' incompleto"
 
-#: io.c:1530
+#: io.c:1462
 msgid "must supply a remote hostname to `/inet'"
 msgstr "va fornito nome di 'host' remoto a `/inet'"
 
-#: io.c:1548
+#: io.c:1480
 msgid "must supply a remote port to `/inet'"
 msgstr "va fornita porta remota a `/inet'"
 
-#: io.c:1594
+#: io.c:1526
 msgid "TCP/IP communications are not supported"
 msgstr "comunicazioni TCP/IP non supportate"
 
-#: io.c:1764
+#: io.c:1693
 #, c-format
 msgid "could not open `%s', mode `%s'"
 msgstr "non riesco ad aprire `%s', modo `%s'"
 
-#: io.c:1814
+#: io.c:1747
 #, c-format
 msgid "close of master pty failed (%s)"
 msgstr "fallita chiusura di 'pty' principale (%s)"
 
-#: io.c:1816 io.c:1984 io.c:2145
+#: io.c:1749 io.c:1917 io.c:2074
 #, c-format
 msgid "close of stdout in child failed (%s)"
 msgstr "fallita chiusura di 'stdout' nel processo-figlio (%s)"
 
-#: io.c:1819
+#: io.c:1752
 #, c-format
 msgid "moving slave pty to stdout in child failed (dup: %s)"
 msgstr ""
 "fallito trasferimento di 'pty' secondaria a 'stdout' nel processo-figlio "
 "(dup: %s)"
 
-#: io.c:1821 io.c:1989
+#: io.c:1754 io.c:1922
 #, c-format
 msgid "close of stdin in child failed (%s)"
 msgstr "fallita chiusura di 'stdin' nel processo-figlio (%s)"
 
-#: io.c:1824
+#: io.c:1757
 #, c-format
 msgid "moving slave pty to stdin in child failed (dup: %s)"
 msgstr ""
 "fallito trasferimento di 'pty' secondaria a 'stdin' nel processo-figlio "
 "(dup: %s)"
 
-#: io.c:1826 io.c:1847
+#: io.c:1759 io.c:1780
 #, c-format
 msgid "close of slave pty failed (%s)"
 msgstr "fallita chiusura di 'pty' secondaria (%s)"
 
-#: io.c:1925 io.c:1987 io.c:2122 io.c:2148
+#: io.c:1858 io.c:1920 io.c:2052 io.c:2077
 #, c-format
 msgid "moving pipe to stdout in child failed (dup: %s)"
 msgstr "fallito passaggio di 'pipe' a 'stdout' nel processo-figlio (dup: %s)"
 
-#: io.c:1932 io.c:1992
+#: io.c:1865 io.c:1925
 #, c-format
 msgid "moving pipe to stdin in child failed (dup: %s)"
 msgstr "fallito passaggio di pipe a 'stdin' nel processo-figlio (dup: %s)"
 
-#: io.c:1952 io.c:2138
+#: io.c:1885 io.c:2067
 msgid "restoring stdout in parent process failed\n"
 msgstr "fallito ripristino di 'stdout' nel processo-padre\n"
 
-#: io.c:1960
+#: io.c:1893
 msgid "restoring stdin in parent process failed\n"
 msgstr "fallito ripristino di 'stdin' nel processo-padre\n"
 
-#: io.c:1995 io.c:2150 io.c:2164
+#: io.c:1928 io.c:2079 io.c:2093
 #, c-format
 msgid "close of pipe failed (%s)"
 msgstr "fallita chiusura di 'pipe' (%s)"
 
-#: io.c:2040
+#: io.c:1973
 msgid "`|&' not supported"
 msgstr "`|&' non supportato"
 
-#: io.c:2107
+#: io.c:2039
 #, c-format
 msgid "cannot open pipe `%s' (%s)"
 msgstr "non riesco ad aprire 'pipe' `%s' (%s)"
 
-#: io.c:2158
+#: io.c:2087
 #, c-format
 msgid "cannot create child process for `%s' (fork: %s)"
 msgstr "non riesco a creare processo-figlio per `%s' (fork: %s)"
 
-#: io.c:2637
+#: io.c:2520
 #, c-format
 msgid "data file `%s' is empty"
 msgstr "file dati `%s' vuoto"
 
-#: io.c:2678 io.c:2686
+#: io.c:2561 io.c:2569
 msgid "could not allocate more input memory"
 msgstr "non riesco ad allocare ulteriore memoria per l'input"
 
-#: io.c:3236
+#: io.c:3127
 msgid "multicharacter value of `RS' is a gawk extension"
 msgstr "valore multicarattere per `RS' è un'estensione gawk"
 
-#: io.c:3326
+#: io.c:3232
 msgid "IPv6 communication is not supported"
 msgstr "comunicazioni IPv6 non supportate"
 
-#: main.c:355
+#: main.c:366
 msgid "`-m[fr]' option irrelevant in gawk"
 msgstr "`-m[fr]' opzione irrilevante per gawk"
 
-#: main.c:357
+#: main.c:368
 msgid "-m option usage: `-m[fr] nnn'"
 msgstr "-m uso opzione: `-m[fr] nnn'"
 
-#: main.c:386
+#: main.c:391
 msgid "empty argument to `-e/--source' ignored"
 msgstr "argomento di `-e/--source' nullo, ignorato"
 
-#: main.c:472
+#: main.c:462
 #, c-format
 msgid "%s: option `-W %s' unrecognized, ignored\n"
 msgstr "%s: opzione `-W %s' non riconosciuta, ignorata\n"
 
-#: main.c:518
+#: main.c:515
 #, c-format
 msgid "%s: option requires an argument -- %c\n"
 msgstr "%s: l'opzione richiede un argomento -- %c\n"
 
-#: main.c:539
+#: main.c:536
 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'"
 msgstr "variable d'ambiente `POSIXLY_CORRECT' impostata: attivo `--posix'"
 
-#: main.c:545
+#: main.c:542
 msgid "`--posix' overrides `--traditional'"
 msgstr "`--posix' annulla `--traditional'"
 
-#: main.c:556
+#: main.c:553
 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'"
 msgstr "`--posix'/`--traditional' annulla `--non-decimal-data'"
 
-#: main.c:560
+#: main.c:557
 #, c-format
 msgid "running %s setuid root may be a security problem"
 msgstr "eseguire %s con 'setuid' root può essere un rischio per la sicurezza"
 
-#: main.c:565
+#: main.c:562
 msgid "`--posix' overrides `--binary'"
 msgstr "`--posix' annulla `--binary"
 
-#: main.c:623
+#: main.c:613
 #, c-format
 msgid "can't set binary mode on stdin (%s)"
 msgstr "non posso impostare modalità binaria su 'stdin'(%s)"
 
-#: main.c:626
+#: main.c:616
 #, c-format
 msgid "can't set binary mode on stdout (%s)"
 msgstr "non posso impostare modalità binaria su 'stdout'(%s)"
 
-#: main.c:628
+#: main.c:618
 #, c-format
 msgid "can't set binary mode on stderr (%s)"
 msgstr "non posso impostare modalità binaria su 'stderr'(%s)"
 
-#: main.c:679
+#: main.c:657
 msgid "no program text at all!"
 msgstr "manca del tutto il testo del programma!"
 
-#: main.c:763
+#: main.c:734
 #, c-format
 msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n"
 msgstr "Uso: %s [opzioni in stile POSIX o GNU] -f file-prog. [--] file ...\n"
 
-#: main.c:765
+#: main.c:736
 #, c-format
 msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n"
 msgstr "Usage: %s [opzioni in stile POSIX o GNU] [--] %cprogramma%c file ...\n"
 
-#: main.c:770
+#: main.c:741
 msgid "POSIX options:\t\tGNU long options: (standard)\n"
 msgstr "Opzioni POSIX:\t\topzioni lunghe GNU: (standard)\n"
 
-#: main.c:771
+#: main.c:742
 msgid "\t-f progfile\t\t--file=progfile\n"
 msgstr "\t-f fileprog\t\t--file=file-prog.\n"
 
-#: main.c:772
+#: main.c:743
 msgid "\t-F fs\t\t\t--field-separator=fs\n"
 msgstr "\t-F fs\t\t\t--field-separator=fs\n"
 
-#: main.c:773
+#: main.c:744
 msgid "\t-v var=val\t\t--assign=var=val\n"
 msgstr "\t-v var=valore\t\t--assign=var=valore\n"
 
-#: main.c:774
+#: main.c:745
 msgid "Short options:\t\tGNU long options: (extensions)\n"
 msgstr "Opzioni brevi:\t\topzioni lunghe GNU: (estensioni)\n"
 
-#: main.c:775
+#: main.c:746
 msgid "\t-b\t\t\t--characters-as-bytes\n"
 msgstr "\t-b\t\t\t--characters-as-bytes\n"
 
-#: main.c:776
+#: main.c:747
 msgid "\t-c\t\t\t--traditional\n"
 msgstr "\t-c\t\t\t--traditional\n"
 
-#: main.c:777
+#: main.c:748
 msgid "\t-C\t\t\t--copyright\n"
 msgstr "\t-C\t\t\t--copyright\n"
 
-#: main.c:778
+#: main.c:749
 msgid "\t-d[file]\t\t--dump-variables[=file]\n"
 msgstr "\t-d[file]\t\t--dump-variables[=file]\n"
 
-#: main.c:779
-msgid "\t-D[file]\t\t--debug[=file]\n"
-msgstr "\t-D[file]\t\t--debug[=file]\n"
-
-#: main.c:780
+#: main.c:750
 msgid "\t-e 'program-text'\t--source='program-text'\n"
 msgstr "\t-e 'testo-del-programma'\t--source='testo-del-programma'\n"
 
-#: main.c:781
+#: main.c:751
 msgid "\t-E file\t\t\t--exec=file\n"
 msgstr "\t-E file\t\t\t--exec=file\n"
 
-#: main.c:782
+#: main.c:752
 msgid "\t-g\t\t\t--gen-pot\n"
 msgstr "\t-g\t\t\t--gen-pot\n"
 
-#: main.c:783
+#: main.c:753
 msgid "\t-h\t\t\t--help\n"
 msgstr "\t-h\t\t\t--help\n"
 
-#: main.c:784
-msgid "\t-l library\t\t--load=library\n"
-msgstr "\t-l libreria\t\t--load=libreria\n"
-
-#: main.c:785
+#: main.c:754
 msgid "\t-L [fatal]\t\t--lint[=fatal]\n"
 msgstr "\t-L [fatal]\t\t--lint[=fatal]\n"
 
-#: main.c:786
+#: main.c:755
 msgid "\t-n\t\t\t--non-decimal-data\n"
 msgstr "\t-n\t\t\t--non-decimal-data\n"
 
-#: main.c:787
-msgid "\t-M\t\t\t--bignum\n"
-msgstr "\t-M\t\t\t--bignum\n"
-
-#: main.c:788
+#: main.c:756
 msgid "\t-N\t\t\t--use-lc-numeric\n"
 msgstr "\t-N\t\t\t--use-lc-numeric\n"
 
-#: main.c:789
-msgid "\t-o[file]\t\t--pretty-print[=file]\n"
-msgstr "\t-o[file]\t\t--pretty-print[=file]\n"
-
-#: main.c:790
+#: main.c:757
 msgid "\t-O\t\t\t--optimize\n"
 msgstr "\t-O\t\t\t--optimize\n"
 
-#: main.c:791
+#: main.c:758
 msgid "\t-p[file]\t\t--profile[=file]\n"
 msgstr "\t-p[file]\t\t--profile[=file]\n"
 
-#: main.c:792
+#: main.c:759
 msgid "\t-P\t\t\t--posix\n"
 msgstr "\t-P\t\t\t--posix\n"
 
-#: main.c:793
+#: main.c:760
 msgid "\t-r\t\t\t--re-interval\n"
 msgstr "\t-r\t\t\t--re-interval\n"
 
-#: main.c:794
+#: main.c:762
+#, fuzzy
+msgid "\t-R file\t\t\t--command=file\n"
+msgstr "\t-E file\t\t\t--exec=file\n"
+
+#: main.c:763
 msgid "\t-S\t\t\t--sandbox\n"
 msgstr "\t-S\t\t\t--sandbox\n"
 
-#: main.c:795
+#: main.c:764
 msgid "\t-t\t\t\t--lint-old\n"
 msgstr "\t-t\t\t\t--lint-old\n"
 
-#: main.c:796
+#: main.c:765
 msgid "\t-V\t\t\t--version\n"
 msgstr "\t-V\t\t\t--version\n"
 
-#: main.c:798
+#: main.c:767
 msgid "\t-W nostalgia\t\t--nostalgia\n"
 msgstr "\t-W nostalgia\t\t--nostalgia\n"
 
-#: main.c:801
+#: main.c:770
 msgid "\t-Y\t\t--parsedebug\n"
 msgstr "\t-Y\t\t--parsedebug\n"
 
@@ -1699,7 +1808,7 @@ msgstr "\t-Y\t\t--parsedebug\n"
 #. for this application.  Please add _another line_ with the
 #. address for translation bugs.
 #. no-wrap
-#: main.c:810
+#: main.c:779
 msgid ""
 "\n"
 "To report bugs, see node `Bugs' in `gawk.info', which is\n"
@@ -1712,7 +1821,7 @@ msgstr ""
 "Problemi di traduzione, segnalare ad: azc100@gmail.com.\n"
 "\n"
 
-#: main.c:814
+#: main.c:783
 msgid ""
 "gawk is a pattern scanning and processing language.\n"
 "By default it reads standard input and writes standard output.\n"
@@ -1722,7 +1831,7 @@ msgstr ""
 "Senza parametri, legge da 'standard input' e scrive su 'standard output'.\n"
 "\n"
 
-#: main.c:818
+#: main.c:787
 msgid ""
 "Examples:\n"
 "\tgawk '{ sum += $1 }; END { print sum }' file\n"
@@ -1732,7 +1841,7 @@ msgstr ""
 "\tgawk '{ sum += $1 }; END { print sum }' file\n"
 "\tgawk -F: '{ print $1 }' /etc/passwd\n"
 
-#: main.c:838
+#: main.c:807
 #, c-format
 msgid ""
 "Copyright (C) 1989, 1991-%d Free Software Foundation.\n"
@@ -1751,7 +1860,7 @@ msgstr ""
 "Licenza, o (a tua scelta) a una qualsiasi versione successiva.\n"
 "\n"
 
-#: main.c:846
+#: main.c:815
 msgid ""
 "This program is distributed in the hope that it will be useful,\n"
 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
@@ -1765,7 +1874,7 @@ msgstr ""
 "Vedi la 'GNU General Public License' per ulteriori dettagli.\n"
 "\n"
 
-#: main.c:852
+#: main.c:821
 msgid ""
 "You should have received a copy of the GNU General Public License\n"
 "along with this program. If not, see http://www.gnu.org/licenses/.\n"
@@ -1774,16 +1883,16 @@ msgstr ""
 "assieme a questo programma; se non è così, vedi http://www.gnu.org/"
 "licenses/.\n"
 
-#: main.c:887
+#: main.c:856
 msgid "-Ft does not set FS to tab in POSIX awk"
 msgstr "-Ft non imposta FS a 'tab' nell'awk POSIX"
 
-#: main.c:1133
+#: main.c:1090
 #, c-format
 msgid "unknown value for field spec: %d\n"
 msgstr "valore non noto per specifica campo: %d\n"
 
-#: main.c:1214
+#: main.c:1171
 #, c-format
 msgid ""
 "%s: `%s' argument to `-v' not in `var=value' form\n"
@@ -1792,78 +1901,79 @@ msgstr ""
 "%s: `%s' argomento di `-v' non in forma `var=valore'\n"
 "\n"
 
-#: main.c:1240
+#: main.c:1197
 #, c-format
 msgid "`%s' is not a legal variable name"
 msgstr "`%s' non è un nome di variabile ammesso"
 
-#: main.c:1243
+#: main.c:1200
 #, c-format
 msgid "`%s' is not a variable name, looking for file `%s=%s'"
 msgstr "`%s' non è un nome di variabile, cerco il file `%s=%s'"
 
-#: main.c:1247
+#: main.c:1204
+#, c-format
 msgid "cannot use gawk builtin `%s' as variable name"
-msgstr ""
-"nome funzione interna gawk `%s' non ammesso come nome variabile"
+msgstr "nome funzione interna gawk `%s' non ammesso come nome variabile"
 
-#: main.c:1252
+#: main.c:1209
+#, c-format
 msgid "cannot use function `%s' as variable name"
 msgstr "non posso usare nome di funzione `%s' come nome di variabile"
 
-#: main.c:1305
+#: main.c:1262
 msgid "floating point exception"
 msgstr "eccezione floating point"
 
-#: main.c:1312
+#: main.c:1269
 msgid "fatal error: internal error"
 msgstr "errore fatale: errore interno"
 
-#: main.c:1327
+#: main.c:1284
 msgid "fatal error: internal error: segfault"
 msgstr "errore fatale: errore interno: segfault"
 
-#: main.c:1339
+#: main.c:1296
 msgid "fatal error: internal error: stack overflow"
 msgstr "errore fatale: errore interno: stack overflow"
 
-#: main.c:1393
+#: main.c:1346
 #, c-format
 msgid "no pre-opened fd %d"
 msgstr "manca 'fd' pre-aperta %d"
 
-#: main.c:1400
+#: main.c:1353
 #, c-format
 msgid "could not pre-open /dev/null for fd %d"
 msgstr "non riesco a pre-aprire /dev/null per 'fd' %d"
 
-#: msg.c:61
+#: msg.c:63
 #, c-format
 msgid "cmd. line:"
 msgstr "linea com.:"
 
-#: msg.c:121
+#: msg.c:107
 msgid "error: "
 msgstr "errore: "
 
-#: node.c:436
+#: node.c:406
 msgid "backslash at end of string"
 msgstr "'\\' a fine stringa"
 
-#: node.c:520
+#: node.c:517
 #, c-format
 msgid "old awk does not support the `\\%c' escape sequence"
 msgstr "il vecchio awk non supporta la sequenza di escape '\\%c'"
 
-#: node.c:571
+#: node.c:568
 msgid "POSIX does not allow `\\x' escapes"
 msgstr "POSIX non permette escape `\\x'"
 
-#: node.c:577
+#: node.c:574
 msgid "no hex digits in `\\x' escape sequence"
 msgstr "niente cifre esadecimali nella sequenza di escape `\\x'"
 
-#: node.c:599
+#: node.c:596
 #, c-format
 msgid ""
 "hex escape \\x%.*s of %d characters probably not interpreted the way you "
@@ -1872,12 +1982,12 @@ msgstr ""
 "sequenza di escape esadec.\\x%.*s di %d caratteri probabilmente non "
 "interpretata nel modo previsto"
 
-#: node.c:614
+#: node.c:611
 #, c-format
 msgid "escape sequence `\\%c' treated as plain `%c'"
 msgstr "sequenza di escape `\\%c' considerata come semplice `%c'"
 
-#: node.c:759
+#: node.c:750
 msgid ""
 "Invalid multibyte data detected. There may be a mismatch between your data "
 "and your locale."
@@ -1896,16 +2006,16 @@ msgid "%s %s `%s': could not set close-on-exec: (fcntl F_SETFD: %s)"
 msgstr ""
 "%s %s `%s': non riesco a impostare 'close-on-exec': (fcntl F_SETFD: %s)"
 
-#: profile.c:69
+#: profile.c:83
 #, c-format
 msgid "could not open `%s' for writing: %s"
 msgstr "non riesco ad aprire `%s' in scrittura: %s"
 
-#: profile.c:71
+#: profile.c:85
 msgid "sending profile to standard error"
 msgstr "mando profilo a 'standard error'"
 
-#: profile.c:187
+#: profile.c:203
 #, c-format
 msgid ""
 "\t# %s block(s)\n"
@@ -1914,7 +2024,7 @@ msgstr ""
 "\t# blocco(hi) %s\n"
 "\n"
 
-#: profile.c:192
+#: profile.c:208
 #, c-format
 msgid ""
 "\t# Rule(s)\n"
@@ -1923,21 +2033,17 @@ msgstr ""
 "\t# Regola(e)\n"
 "\n"
 
-#: profile.c:266
+#: profile.c:279
 #, c-format
 msgid "internal error: %s with null vname"
 msgstr "errore interno: %s con 'vname' nullo"
 
-#: profile.c:528
-msgid "internal error: builtin with null fname"
-msgstr "errore interno: funzione interna con 'fname' nullo"
-
-#: profile.c:943
+#: profile.c:952
 #, c-format
 msgid "\t# gawk profile, created %s\n"
 msgstr "\t# profilo gawk, creato %s\n"
 
-#: profile.c:1328
+#: profile.c:1331
 #, c-format
 msgid ""
 "\n"
@@ -1946,16 +2052,17 @@ msgstr ""
 "\n"
 "\t# Funzioni, in ordine alfabetico\n"
 
-#: profile.c:1366
+#: profile.c:1370
 #, c-format
 msgid "redir2str: unknown redirection type %d"
 msgstr "redir2str: tipo di re-direzione non noto %d"
 
-#: re.c:571
+#: re.c:573
+#, c-format
 msgid "range of the form `[%c-%c]' is locale dependent"
 msgstr "intervallo della forma `[%c-%c]' dipende da 'locale'"
 
-#: re.c:598
+#: re.c:600
 #, c-format
 msgid "regexp component `%.*s' should probably be `[%.*s]'"
 msgstr ""
@@ -2033,3 +2140,20 @@ msgstr ") o \\) non aperta"
 msgid "No previous regular expression"
 msgstr "Nessuna espressione regolare precedente"
 
+#~ msgid "dynamic loading of library not supported"
+#~ msgstr "caricamento dinamico di libreria non supportato"
+
+#~ msgid "\t-D[file]\t\t--debug[=file]\n"
+#~ msgstr "\t-D[file]\t\t--debug[=file]\n"
+
+#~ msgid "\t-l library\t\t--load=library\n"
+#~ msgstr "\t-l libreria\t\t--load=libreria\n"
+
+#~ msgid "\t-M\t\t\t--bignum\n"
+#~ msgstr "\t-M\t\t\t--bignum\n"
+
+#~ msgid "\t-o[file]\t\t--pretty-print[=file]\n"
+#~ msgstr "\t-o[file]\t\t--pretty-print[=file]\n"
+
+#~ msgid "internal error: builtin with null fname"
+#~ msgstr "errore interno: funzione interna con 'fname' nullo"

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=91cdc24dc028b758e409ac6e92759b52b2a079d6

commit 91cdc24dc028b758e409ac6e92759b52b2a079d6
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 19 21:25:32 2012 +0300

    Add new test files for characters-as-bytes fix.

diff --git a/test/charasbytes.awk b/test/charasbytes.awk
new file mode 100755
index 0000000..feb195c
--- /dev/null
+++ b/test/charasbytes.awk
@@ -0,0 +1 @@
+{ print gensub(/\xE2\x80./, "ZZZ", "g", $0) }
diff --git a/test/charasbytes.in b/test/charasbytes.in
new file mode 100644
index 0000000..4a8d4a1
--- /dev/null
+++ b/test/charasbytes.in
@@ -0,0 +1 @@
+â€“
diff --git a/test/charasbytes.ok b/test/charasbytes.ok
new file mode 100644
index 0000000..a1702e6
--- /dev/null
+++ b/test/charasbytes.ok
@@ -0,0 +1,3 @@
+0000000   Z   Z   Z  \n
+         5a  5a  5a  0a
+0000004

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=09a6e6fecf9691ea9a0ceb2aef26197f821868cd

commit 09a6e6fecf9691ea9a0ceb2aef26197f821868cd
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 19 21:24:19 2012 +0300

    Fix bug with --characters-as-bytes.

diff --git a/ChangeLog b/ChangeLog
index 2a1373f..d6afeb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-19         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* main.c (main): Do setlocale to "C" if --characters-as-bytes.
+	Thanks to "SP" <sp0sp0sp@gmail.com> for the bug report.
+
 2012-05-09         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* configure.ac: Added AC_HEADER_STDBOOL
diff --git a/main.c b/main.c
index 3680e3f..2bb0b01 100644
--- a/main.c
+++ b/main.c
@@ -559,9 +559,12 @@ out:
 #if MBS_SUPPORT
 	if (do_binary) {
 		if (do_posix)
-			warning(_("`--posix' overrides `--binary'"));
+			warning(_("`--posix' overrides `--characters-as-bytes'"));
 		else
 			gawk_mb_cur_max = 1;	/* hands off my data! */
+#if defined(LC_ALL)
+		setlocale(LC_ALL, "C");
+#endif
 	}
 #endif
 
diff --git a/test/ChangeLog b/test/ChangeLog
index 06d9020..272e7cf 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-19         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* Makefile.am (charasbytes): New test.
+	* charasbytes.awk, charasbytes.in, charasbytes.ok: New files.
+
 2012-05-20         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* jarebug.sh: New file. Handles Mac OS X also.
diff --git a/test/Makefile.am b/test/Makefile.am
index 5ff3501..43cc8f9 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -119,6 +119,9 @@ EXTRA_DIST = \
 	beginfile2.ok \
 	beginfile2.sh \
 	binmode1.ok \
+	charasbytes.awk \
+	charasbytes.in \
+	charasbytes.ok \
 	childin.awk \
 	childin.in \
 	childin.ok \
@@ -831,7 +834,7 @@ UNIX_TESTS = \
 
 GAWK_EXT_TESTS = \
 	aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
-	backw badargs beginfile1 beginfile2  binmode1 \
+	backw badargs beginfile1 beginfile2 binmode1 charasbytes \
 	clos1way delsub devfd devfd1 devfd2 dumpvars exit \
 	fieldwdth fpat1 fpat2 fpat3  fpatnull fsfwfs funlen \
 	fwtest fwtest2 fwtest3 \
@@ -1459,6 +1462,12 @@ jarebug::
 	@$(srcdir)/$@.sh "$(AWKPROG)" "$(srcdir)/$@.awk" "$(srcdir)/$@.in" "_$@"
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
+charasbytes:
+	@echo $@
+	@[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \
+	AWKPATH=$(srcdir) $(AWK) -b -f $@.awk $(srcdir)/$@.in | \
+	od -c -t x1 >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
 # Targets generated for other tests:
 include Maketests
diff --git a/test/Makefile.in b/test/Makefile.in
index 171428b..0e4cc75 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -324,6 +324,9 @@ EXTRA_DIST = \
 	beginfile2.ok \
 	beginfile2.sh \
 	binmode1.ok \
+	charasbytes.awk \
+	charasbytes.in \
+	charasbytes.ok \
 	childin.awk \
 	childin.in \
 	childin.ok \
@@ -1036,7 +1039,7 @@ UNIX_TESTS = \
 
 GAWK_EXT_TESTS = \
 	aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
-	backw badargs beginfile1 beginfile2  binmode1 \
+	backw badargs beginfile1 beginfile2 binmode1 charasbytes \
 	clos1way delsub devfd devfd1 devfd2 dumpvars exit \
 	fieldwdth fpat1 fpat2 fpat3  fpatnull fsfwfs funlen \
 	fwtest fwtest2 fwtest3 \
@@ -1836,6 +1839,13 @@ jarebug::
 	@echo $@
 	@$(srcdir)/$@.sh "$(AWKPROG)" "$(srcdir)/$@.awk" "$(srcdir)/$@.in" "_$@"
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
+charasbytes:
+	@echo $@
+	@[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \
+	AWKPATH=$(srcdir) $(AWK) -b -f $@.awk $(srcdir)/$@.in | \
+	od -c -t x1 >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 Gt-dummy:
 # file Maketests, generated from Makefile.am by the Gentests program
 addcomma:

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog            |    5 +
 main.c               |    5 +-
 po/it.gmo            |  Bin 47961 -> 46912 bytes
 po/it.po             | 1014 ++++++++++++++++++++++++++++----------------------
 test/ChangeLog       |    5 +
 test/Makefile.am     |   11 +-
 test/Makefile.in     |   12 +-
 test/charasbytes.awk |    1 +
 test/charasbytes.in  |    1 +
 test/charasbytes.ok  |    3 +
 10 files changed, 609 insertions(+), 448 deletions(-)
 create mode 100755 test/charasbytes.awk
 create mode 100644 test/charasbytes.in
 create mode 100644 test/charasbytes.ok


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Wed Jun 20 14:41:52 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ShPqi-0006WY-Gq
	for mharc-gawk-diffs@gnu.org; Wed, 20 Jun 2012 14:41:52 -0400
Received: from eggs.gnu.org ([208.118.235.92]:36388)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ShPqd-0006Vb-Pz
	for gawk-diffs@gnu.org; Wed, 20 Jun 2012 14:41:50 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ShPqX-0000P6-Qk
	for gawk-diffs@gnu.org; Wed, 20 Jun 2012 14:41:47 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:49886)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ShPqX-0000Oy-Mt
	for gawk-diffs@gnu.org; Wed, 20 Jun 2012 14:41:41 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1ShPqW-0001Im-1W
	for gawk-diffs@gnu.org; Wed, 20 Jun 2012 18:41:41 +0000
Date: Wed, 20 Jun 2012 18:41:40 +0000
Message-Id: <E1ShPqW-0001Im-1W@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 1ab61e1508bb2c35d536717868d9dbe5ea20fa93
X-Git-Newrev: d66f3c9922e36bb2e760e0ac36364c1a5aa11442
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. d66f3c9922e36bb2e760e0ac36364c1a5aa11442
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 20 Jun 2012 18:41:50 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  d66f3c9922e36bb2e760e0ac36364c1a5aa11442 (commit)
       via  cd380faebed56979c993ec46daa8c9d927c2d1dd (commit)
      from  1ab61e1508bb2c35d536717868d9dbe5ea20fa93 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=d66f3c9922e36bb2e760e0ac36364c1a5aa11442

commit d66f3c9922e36bb2e760e0ac36364c1a5aa11442
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Jun 20 21:41:15 2012 +0300

    API: Add set_parameter function and test.

diff --git a/ChangeLog b/ChangeLog
index 8ae6d3f..beb8f36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,17 @@
 2012-06-20         Arnold D. Robbins     <arnold@skeeve.com>
 
-	* awgram.y (stopme): Restore long lost debugging function.
-	* awgram.y (stopme): Add declaration.
+	Restore lost debugging function:
+
+	* awkgram.y (stopme): Restore long lost debugging function.
+	* awk.h (stopme): Add declaration.
+
+	API work:
+
+	* ext.c (get_argument): Make extern.
+	* awk.h (get_argument): Declare it.
+	* gawkapi.c (api_set_argument): Call it. Finish off the logic.
+	(api_get_argument): Refine logic to use get_argument.
+	* gawkapi.h (set_argument): New API.
 
 2012-06-19         Arnold D. Robbins     <arnold@skeeve.com>
 
diff --git a/awk.h b/awk.h
index 77aa111..4bfaef4 100644
--- a/awk.h
+++ b/awk.h
@@ -1507,6 +1507,7 @@ NODE *do_ext(int nargs);
 NODE *load_ext(const char *lib_name, const char *init_func);
 #ifdef DYNAMIC
 awk_bool_t make_builtin(const awk_ext_func_t *);
+NODE *get_argument(int);
 NODE *get_actual_argument(int, bool, bool);
 #define get_scalar_argument(i, opt)  get_actual_argument((i), (opt), false)
 #define get_array_argument(i, opt)   get_actual_argument((i), (opt), true)
diff --git a/ext.c b/ext.c
index 4945c7c..d0755cc 100644
--- a/ext.c
+++ b/ext.c
@@ -152,7 +152,7 @@ make_builtin(const awk_ext_func_t *funcinfo)
 
 /* get_argument --- get the i'th argument of a dynamically linked function */
 
-static NODE *
+NODE *
 get_argument(int i)
 {
 	NODE *t;
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 8d8cf2b..a134e00 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,9 @@
+2012-06-20         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* testext.c (fill_in_array): New function.
+	(create_new_array): Most code moved into fill_in_array.
+	(test_array_param): New function.
+
 2012-06-19         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* testext.c (dump_array_and_delete): Renamed from dump_array.
diff --git a/extension/testext.c b/extension/testext.c
index 0a7594a..963a563 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -42,6 +42,8 @@ static awk_ext_id_t *ext_id;
 
 int plugin_is_GPL_compatible;
 
+static void fill_in_array(awk_value_t *value);
+
 /* valrep2str --- turn a value into a string */
 
 static const char *
@@ -386,6 +388,54 @@ out:
 
 /*
 BEGIN {
+	ret = test_array_param(a_new_array)
+	printf "test_array_param() returned %d\n", ret
+	printf "isarray(a_new_array) = %d\n", isarray(a_new_array)
+	if (isarray(a_new_array))
+		for (i in a_new_array)
+			printf("a_new_array[\"%s\"] = %s\n",
+				i, a_new_array[i])
+
+	a_scalar = 42
+	ret = test_array_param(a_scalar)
+	printf "test_array_param() returned %d\n", ret
+	printf "isarray(a_scalar) = %d\n", isarray(a_scalar)
+	print ""
+}
+*/
+
+static awk_value_t *
+test_array_param(int nargs, awk_value_t *result)
+{
+	awk_value_t new_array;
+	awk_value_t arg0;
+
+	make_number(0.0, result);
+
+	if (! get_argument(0, AWK_UNDEFINED, & arg0)) {
+		printf("test_array_param: could not get argument\n");
+		goto out;
+	}
+
+	if (arg0.val_type != AWK_UNDEFINED) {
+		printf("test_array_param: argument is not undefined (%d)\n",
+				arg0.val_type);
+		goto out;
+	}
+
+	fill_in_array(& new_array);
+	if (! set_argument(0, new_array.array_cookie)) {
+		printf("test_array_param: could not change type of argument\n");
+		goto out;
+	}
+
+	make_number(1.0, result);
+out:
+	return result;	/* for now */
+}
+
+/*
+BEGIN {
 	printf "Initial value of LINT is %d\n", LINT
 	ret = print_do_lint();
 	printf "print_do_lint() returned %d\n", ret
@@ -448,12 +498,11 @@ out:
 }
 
 static void
-create_new_array()
+fill_in_array(awk_value_t *value)
 {
 	awk_element_t element;
 	awk_array_t a_cookie;
 	awk_value_t index;
-	awk_value_t value;
 
 	a_cookie = create_array();
 
@@ -461,7 +510,7 @@ create_new_array()
 	element.index = index;
 	(void) make_string("world", 5, & element.value);
 	if (! set_array_element(a_cookie, & element)) {
-		printf("create_new_array:%d: set_array_element failed\n", __LINE__);
+		printf("fill_in_array:%d: set_array_element failed\n", __LINE__);
 		return;
 	}
 
@@ -469,13 +518,21 @@ create_new_array()
 	element.index = index;
 	(void) make_number(42.0, & element.value);
 	if (! set_array_element(a_cookie, & element)) {
-		printf("create_new_array:%d: set_array_element failed\n", __LINE__);
+		printf("fill_in_array:%d: set_array_element failed\n", __LINE__);
 		return;
 	}
 
-	value.val_type = AWK_ARRAY;
-	value.array_cookie = a_cookie;
+	value->val_type = AWK_ARRAY;
+	value->array_cookie = a_cookie;
+
+}
+
+static void
+create_new_array()
+{
+	awk_value_t value;
 
+	fill_in_array(& value);
 	if (! sym_update("new_array", & value))
 		printf("create_new_array: sym_update(\"new_array\") failed!\n");
 }
@@ -524,6 +581,7 @@ static awk_ext_func_t func_table[] = {
 	{ "test_errno", test_errno, 0 },
 	{ "test_array_size", test_array_size, 1 },
 	{ "test_array_elem", test_array_elem, 2 },
+	{ "test_array_param", test_array_param, 1 },
 	{ "test_array_flatten", test_array_flatten, 1 },
 	{ "print_do_lint", print_do_lint, 0 },
 };
diff --git a/gawkapi.c b/gawkapi.c
index 5eb1688..ad7e68f 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -44,17 +44,83 @@ api_get_argument(awk_ext_id_t id, size_t count,
 
 	(void) id;
 
-	arg = (wanted == AWK_ARRAY
-			? get_array_argument(count, false)
-			: get_scalar_argument(count, false) );
-
-	if (arg == NULL) {
-		memset(result, 0, sizeof(*result));
-		result->val_type = AWK_UNDEFINED;
+	/* set up default result */
+	memset(result, 0, sizeof(*result));
+	result->val_type = AWK_UNDEFINED;
+
+	/*
+	 * Song and dance here.  get_array_argument() and get_scalar_argument()
+	 * will force a change in type of a parameter that is Node_var_new.
+	 *
+	 * Start by looking at the unadulterated argument as it was passed.
+	 */
+	arg = get_argument(count);
+	if (arg == NULL)
 		return false;
+
+	/* if type is undefined */
+	if (arg->type == Node_var_new) {
+		if (wanted == AWK_UNDEFINED)
+			return true;
+		else if (wanted == AWK_ARRAY) {
+			goto array;
+		} else {
+			goto scalar;
+		}
 	}
+	
+	/* at this point, we have real type */
+	if (arg->type == Node_var_array || arg->type == Node_array_ref) {
+		if (wanted != AWK_ARRAY && wanted != AWK_UNDEFINED)
+			return false;
+		goto array;
+	} else
+		goto scalar;
+
+array:
+	/* get the array here */
+	arg = get_array_argument(count, false);
+	if (arg == NULL)
+		return false;
 
 	return node_to_awk_value(arg, result, wanted);
+
+scalar:
+	/* at this point we have a real type that is not an array */
+	arg = get_scalar_argument(count, false);
+	if (arg == NULL)
+		return false;
+
+	return node_to_awk_value(arg, result, wanted);
+}
+
+static awk_bool_t
+api_set_argument(awk_ext_id_t id,
+		size_t count,
+		awk_array_t new_array)
+{
+	NODE *arg;
+	NODE *array = (NODE *) new_array;
+	awk_valtype_t valtype;
+
+	(void) id;
+
+	if (array == NULL || array->type != Node_var_array)
+		return false;
+
+	if (   (arg = get_argument(count)) == NULL
+	    || arg->type != Node_var_new)
+		return false;
+
+	arg = get_array_argument(count, false);
+	if (arg == NULL)
+		return false;
+
+	array->vname = arg->vname;
+	*arg = *array;
+	freenode(array);
+
+	return true;
 }
 
 /* awk_value_to_node --- convert a value into a NODE */
@@ -663,6 +729,7 @@ gawk_api_t api_impl = {
 	{ 0 },			/* do_flags */
 
 	api_get_argument,
+	api_set_argument,
 
 	api_fatal,
 	api_warning,
diff --git a/gawkapi.h b/gawkapi.h
index 7973d7a..3325c45 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -242,9 +242,14 @@ typedef struct gawk_api {
 					  awk_value_t *result);
 
 	/*
-	 * FIXME: Missing update_argument to convert an undefined
-	 * argument into an array or scalar.
+	 * Convert a paramter that was undefined into an array
+	 * (provide call-by-reference for arrays).  Returns false
+	 * if count is too big, or if the argument's type is
+	 * not undefined.
 	 */
+	awk_bool_t (*set_argument)(awk_ext_id_t id,
+					size_t count,
+					awk_array_t array);
 
 	/* Functions to print messages */
 	void (*api_fatal)(awk_ext_id_t id, const char *format, ...);
@@ -373,6 +378,8 @@ typedef struct gawk_api {
 
 #define get_argument(count, wanted, result) \
 	(api->get_argument(ext_id, count, wanted, result))
+#define set_argument(count, new_array) \
+	(api->set_argument(ext_id, count, new_array))
 
 #define fatal		api->api_fatal
 #define warning		api->api_warning
diff --git a/test/ChangeLog b/test/ChangeLog
index 44af605..71edf19 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-20         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* testext.ok: Update contents.
+
 2012-06-19         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* testext.ok: Update contents.
diff --git a/test/testext.ok b/test/testext.ok
index 2f54668..08e272d 100644
--- a/test/testext.ok
+++ b/test/testext.ok
@@ -25,6 +25,14 @@ test_array_elem() returned 1, test_array2[3] = 42
 test_array_elem did remove element "5"
 test_array_elem added element "7" --> seven
 
+test_array_param() returned 1
+isarray(a_new_array) = 1
+a_new_array["hello"] = world
+a_new_array["answer"] = 42
+test_array_param: argument is not undefined (1)
+test_array_param() returned 0
+isarray(a_scalar) = 0
+
 Initial value of LINT is 0
 print_do_lint: lint = 0
 print_do_lint() returned 1

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=cd380faebed56979c993ec46daa8c9d927c2d1dd

commit cd380faebed56979c993ec46daa8c9d927c2d1dd
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Jun 20 20:03:04 2012 +0300

    Restore stopme() debugging function.

diff --git a/ChangeLog b/ChangeLog
index 77f59ec..8ae6d3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-20         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* awgram.y (stopme): Restore long lost debugging function.
+	* awgram.y (stopme): Add declaration.
+
 2012-06-19         Arnold D. Robbins     <arnold@skeeve.com>
 
 	Remove code duplication in gawkapi.c from msg.c:
diff --git a/awk.h b/awk.h
index eb512f2..77aa111 100644
--- a/awk.h
+++ b/awk.h
@@ -1416,6 +1416,7 @@ extern int parse_program(INSTRUCTION **pcode);
 extern void dump_funcs(void);
 extern void dump_vars(const char *fname);
 extern const char *getfname(NODE *(*)(int));
+extern NODE *stopme(NODE *tree);
 extern void shadow_funcs(void);
 extern int check_special(const char *name);
 extern SRCFILE *add_srcfile(int stype, char *src, SRCFILE *curr, bool *already_included, int *errcode);
diff --git a/awkgram.c b/awkgram.c
index bef9a30..ffdf95b 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -4596,6 +4596,9 @@ static const struct token tokentab[] = {
 {"sprintf",	Op_builtin,	 LEX_BUILTIN,	0,		do_sprintf,	0},
 {"sqrt",	Op_builtin,	 LEX_BUILTIN,	A(1),		do_sqrt,	MPF(sqrt)},
 {"srand",	Op_builtin,	 LEX_BUILTIN,	NOT_OLD|A(0)|A(1), do_srand,	MPF(srand)},
+#if defined(GAWKDEBUG) || defined(ARRAYDEBUG) /* || ... */
+{"stopme",	Op_builtin,	LEX_BUILTIN,	GAWKX|A(0),	stopme,		0},
+#endif
 {"strftime",	Op_builtin,	 LEX_BUILTIN,	GAWKX|A(0)|A(1)|A(2)|A(3), do_strftime,	0},
 {"strtonum",	Op_builtin,    LEX_BUILTIN,	GAWKX|A(1),	do_strtonum, MPF(strtonum)},
 {"sub",		Op_sub_builtin,	 LEX_BUILTIN,	NOT_OLD|A(2)|A(3), 0,	0},
@@ -7210,6 +7213,14 @@ make_assignable(INSTRUCTION *ip)
 	return NULL;
 }
 
+/* stopme --- for debugging */
+
+NODE *
+stopme(NODE *tree ATTRIBUTE_UNUSED)
+{
+	return make_number(0.0);
+}
+
 /* dumpintlstr --- write out an initial .po file entry for the string */
 
 static void
diff --git a/awkgram.y b/awkgram.y
index dceca6d..e7f8701 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -1876,6 +1876,9 @@ static const struct token tokentab[] = {
 {"sprintf",	Op_builtin,	 LEX_BUILTIN,	0,		do_sprintf,	0},
 {"sqrt",	Op_builtin,	 LEX_BUILTIN,	A(1),		do_sqrt,	MPF(sqrt)},
 {"srand",	Op_builtin,	 LEX_BUILTIN,	NOT_OLD|A(0)|A(1), do_srand,	MPF(srand)},
+#if defined(GAWKDEBUG) || defined(ARRAYDEBUG) /* || ... */
+{"stopme",	Op_builtin,	LEX_BUILTIN,	GAWKX|A(0),	stopme,		0},
+#endif
 {"strftime",	Op_builtin,	 LEX_BUILTIN,	GAWKX|A(0)|A(1)|A(2)|A(3), do_strftime,	0},
 {"strtonum",	Op_builtin,    LEX_BUILTIN,	GAWKX|A(1),	do_strtonum, MPF(strtonum)},
 {"sub",		Op_sub_builtin,	 LEX_BUILTIN,	NOT_OLD|A(2)|A(3), 0,	0},
@@ -4490,6 +4493,14 @@ make_assignable(INSTRUCTION *ip)
 	return NULL;
 }
 
+/* stopme --- for debugging */
+
+NODE *
+stopme(NODE *tree ATTRIBUTE_UNUSED)
+{
+	return make_number(0.0);
+}
+
 /* dumpintlstr --- write out an initial .po file entry for the string */
 
 static void

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |   15 +++++++++
 awk.h               |    2 +
 awkgram.c           |   11 +++++++
 awkgram.y           |   11 +++++++
 ext.c               |    2 +-
 extension/ChangeLog |    6 ++++
 extension/testext.c |   70 ++++++++++++++++++++++++++++++++++++++++----
 gawkapi.c           |   81 ++++++++++++++++++++++++++++++++++++++++++++++----
 gawkapi.h           |   11 ++++++-
 test/ChangeLog      |    4 ++
 test/testext.ok     |    8 +++++
 11 files changed, 205 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Thu Jun 21 15:21:12 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ShmwK-0007if-LG
	for mharc-gawk-diffs@gnu.org; Thu, 21 Jun 2012 15:21:12 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46742)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ShmwG-0007iM-B1
	for gawk-diffs@gnu.org; Thu, 21 Jun 2012 15:21:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ShmwD-00067t-FP
	for gawk-diffs@gnu.org; Thu, 21 Jun 2012 15:21:07 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:58095)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ShmwD-00067j-65
	for gawk-diffs@gnu.org; Thu, 21 Jun 2012 15:21:05 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1ShmwC-0007sz-Dr
	for gawk-diffs@gnu.org; Thu, 21 Jun 2012 19:21:04 +0000
Date: Thu, 21 Jun 2012 19:21:04 +0000
Message-Id: <E1ShmwC-0007sz-Dr@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: d66f3c9922e36bb2e760e0ac36364c1a5aa11442
X-Git-Newrev: 898eb2ad1d514887993994e60fe860ac3ee1bba8
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 898eb2ad1d514887993994e60fe860ac3ee1bba8
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 21 Jun 2012 19:21:10 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  898eb2ad1d514887993994e60fe860ac3ee1bba8 (commit)
      from  d66f3c9922e36bb2e760e0ac36364c1a5aa11442 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=898eb2ad1d514887993994e60fe860ac3ee1bba8

commit 898eb2ad1d514887993994e60fe860ac3ee1bba8
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Thu Jun 21 22:20:38 2012 +0300

    Further API code and test code.

diff --git a/ChangeLog b/ChangeLog
index beb8f36..57da23e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-06-21         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* awk.h (stopme): Make signature match other built-ins.
+	* awkgram.y (stopme): Make signature match other built-ins.
+	(regexp): Minor edit.
+	* gawkapi.c (api_set_argument): Remove unused variable.
+	Set parent_array field of array value.
+	* TODO.xgawk: Update some.
+
 2012-06-20         Arnold D. Robbins     <arnold@skeeve.com>
 
 	Restore lost debugging function:
diff --git a/TODO.xgawk b/TODO.xgawk
index a2f78e8..7ea135a 100644
--- a/TODO.xgawk
+++ b/TODO.xgawk
@@ -1,12 +1,5 @@
 To-do list for xgawk enhancements:
 
-- Finish implementing new interface using gawkapi.h
-   - api_get_curfunc_param not honoring requested type in node_to_awk_value
-      - should api_sym_lookup also accept a type request?
-   - must update the API do_lint value when changed by set_LINT
-   - what is the proper return value for load_ext?  It does not matter
-   unless called by the "extension" function that nobody uses.
-
 - Attempting to load the same file with -f and -i (or @include) should
   be a fatal error.
 
@@ -160,3 +153,10 @@ Done:
 
 - Add time extension to the gawk distro. This defines sleep and gettimeofday.
   Renamed existing gettimeofday to getlocaltime.
+
+- Finish implementing new interface using gawkapi.h
+   - api_get_curfunc_param not honoring requested type in node_to_awk_value
+      - should api_sym_lookup also accept a type request?
+   - must update the API do_lint value when changed by set_LINT
+   - what is the proper return value for load_ext?  It does not matter
+   unless called by the "extension" function that nobody uses.
diff --git a/awk.h b/awk.h
index 4bfaef4..d433a6e 100644
--- a/awk.h
+++ b/awk.h
@@ -1416,7 +1416,7 @@ extern int parse_program(INSTRUCTION **pcode);
 extern void dump_funcs(void);
 extern void dump_vars(const char *fname);
 extern const char *getfname(NODE *(*)(int));
-extern NODE *stopme(NODE *tree);
+extern NODE *stopme(int nargs);
 extern void shadow_funcs(void);
 extern int check_special(const char *name);
 extern SRCFILE *add_srcfile(int stype, char *src, SRCFILE *curr, bool *already_included, int *errcode);
diff --git a/awkgram.c b/awkgram.c
index ffdf95b..c8c7a08 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -2368,7 +2368,7 @@ yyreduce:
 			if (len == 0)
 				lintwarn_ln((yyvsp[(3) - (3)])->source_line,
 					_("regexp constant `//' looks like a C++ comment, but is not"));
-			else if ((re)[0] == '*' && (re)[len-1] == '*')
+			else if (re[0] == '*' && re[len-1] == '*')
 				/* possible C comment */
 				lintwarn_ln((yyvsp[(3) - (3)])->source_line,
 					_("regexp constant `/%s/' looks like a C comment, but is not"), re);
@@ -7216,7 +7216,7 @@ make_assignable(INSTRUCTION *ip)
 /* stopme --- for debugging */
 
 NODE *
-stopme(NODE *tree ATTRIBUTE_UNUSED)
+stopme(int nargs ATTRIBUTE_UNUSED)
 {
 	return make_number(0.0);
 }
diff --git a/awkgram.y b/awkgram.y
index e7f8701..3ed450d 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -407,7 +407,7 @@ regexp
 			if (len == 0)
 				lintwarn_ln($3->source_line,
 					_("regexp constant `//' looks like a C++ comment, but is not"));
-			else if ((re)[0] == '*' && (re)[len-1] == '*')
+			else if (re[0] == '*' && re[len-1] == '*')
 				/* possible C comment */
 				lintwarn_ln($3->source_line,
 					_("regexp constant `/%s/' looks like a C comment, but is not"), re);
@@ -4496,7 +4496,7 @@ make_assignable(INSTRUCTION *ip)
 /* stopme --- for debugging */
 
 NODE *
-stopme(NODE *tree ATTRIBUTE_UNUSED)
+stopme(int nargs ATTRIBUTE_UNUSED)
 {
 	return make_number(0.0);
 }
diff --git a/extension/ChangeLog b/extension/ChangeLog
index a134e00..b482d6f 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-21         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* testext.c (test_array_elem): Add a subarray.
+	(test_array_flatten): Removed: Tests done elsewhere.
+
 2012-06-20         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* testext.c (fill_in_array): New function.
diff --git a/extension/testext.c b/extension/testext.c
index 963a563..e3975b2 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -312,13 +312,22 @@ BEGIN {
 	ret = test_array_elem(test_array2, "3")
 	printf "test_array_elem() returned %d, test_array2[3] = %g\n", ret, test_array2[3]
 	if ("5" in test_array2)
-		printf "error: test_array_elem did not remove element \"5\"\n"
+		printf "error: test_array_elem() did not remove element \"5\"\n"
 	else
-		printf "test_array_elem did remove element \"5\"\n"
+		printf "test_array_elem() did remove element \"5\"\n"
 	if ("7" in test_array2)
-		printf "test_array_elem added element \"7\" --> %s\n", test_array2[7]
+		printf "test_array_elem() added element \"7\" --> %s\n", test_array2[7]
 	else
-		printf "test_array_elem did not add element \"7\"\n"
+		printf "test_array_elem() did not add element \"7\"\n"
+	if ("subarray" in test_array2) {
+		if (isarray(test_array2["subarray"])) {
+			for (i in test_array2["subarray"])
+				printf("test_array2[\"subarray\"][\"%s\"] = %s\n",
+					i, test_array2["subarray"][i])
+		} else
+			printf "test_array_elem() added element \"subarray\" as scalar\n"
+	} else
+		printf "test_array_elem() did not add element \"subarray\"\n"
 	print ""
 }
 */
@@ -380,6 +389,15 @@ test_array_elem(int nargs, awk_value_t *result)
 		goto out;
 	}
 
+	/* add a subarray */
+	(void) make_string("subarray", 8, & index);
+	element.index = index;
+	fill_in_array(& element.value);
+	if (! set_array_element(array.array_cookie, & element)) {
+		printf("test_array_elem: set_array_element (subarray) failed\n");
+		goto out;
+	}
+
 	/* change and deletion should be reflected in awk script */
 	make_number(1.0, result);
 out:
@@ -465,37 +483,7 @@ out:
 	return result;
 }
 
-/*
-#BEGIN {
-#	n = split("one two three four five six", test_array3)
-#	ret = test_array_flatten(test_array3)
-#	printf "test_array_flatten() returned %d\n", ret
-#	if ("3" in test_array3)
-#		printf "error: test_array_flatten() did not remove element \"3\"\n"
-#	else
-#		printf "test_array_flatten() did remove element \"3\"\n"
-#	print ""
-#}
-*/
-
-static awk_value_t *
-test_array_flatten(int nargs, awk_value_t *result)
-{
-	assert(result != NULL);
-	make_number(0.0, result);
-
-	if (nargs != 1) {
-		printf("test_array_flatten: nargs not right (%d should be 1)\n", nargs);
-		goto out;
-	}
-
-	/* FIXME: CODE HERE */
-
-	make_number(1.0, result);
-
-out:
-	return result;
-}
+/* fill_in_array --- fill in a new array */
 
 static void
 fill_in_array(awk_value_t *value)
@@ -527,6 +515,8 @@ fill_in_array(awk_value_t *value)
 
 }
 
+/* create_new_array --- create a named array */
+
 static void
 create_new_array()
 {
@@ -537,6 +527,8 @@ create_new_array()
 		printf("create_new_array: sym_update(\"new_array\") failed!\n");
 }
 
+/* at_exit0 --- first at_exit program, runs last */
+
 static void at_exit0(void *data, int exit_status)
 {
 	printf("at_exit0 called (should be third):");
@@ -547,6 +539,7 @@ static void at_exit0(void *data, int exit_status)
 	printf(" exit_status = %d\n", exit_status);
 }
 
+/* at_exit1 --- second at_exit program, runs second */
 
 static int data_for_1 = 0xDeadBeef;
 static void at_exit1(void *data, int exit_status)
@@ -565,6 +558,8 @@ static void at_exit1(void *data, int exit_status)
 	printf(" exit_status = %d\n", exit_status);
 }
 
+/* at_exit2 --- third at_exit program, runs first */
+
 static void at_exit2(void *data, int exit_status)
 {
 	printf("at_exit2 called (should be first):");
@@ -582,10 +577,11 @@ static awk_ext_func_t func_table[] = {
 	{ "test_array_size", test_array_size, 1 },
 	{ "test_array_elem", test_array_elem, 2 },
 	{ "test_array_param", test_array_param, 1 },
-	{ "test_array_flatten", test_array_flatten, 1 },
 	{ "print_do_lint", print_do_lint, 0 },
 };
 
+/* dl_load --- extension load routine, called from gawk */
+
 int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id)
 {
 	size_t i, j;
diff --git a/gawkapi.c b/gawkapi.c
index ad7e68f..139d77b 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -101,7 +101,6 @@ api_set_argument(awk_ext_id_t id,
 {
 	NODE *arg;
 	NODE *array = (NODE *) new_array;
-	awk_valtype_t valtype;
 
 	(void) id;
 
@@ -544,6 +543,8 @@ api_set_array_element(awk_ext_id_t id, awk_array_t a_cookie,
 	unref(tmp);
 	unref(*aptr);
 	*aptr = awk_value_to_node(& element->value);
+	if ((*aptr)->type == Node_var_array)
+		(*aptr)->parent_array = array;
 
 	return true;
 }
diff --git a/test/ChangeLog b/test/ChangeLog
index 71edf19..6d36310 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-21         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* testext.ok: Update contents.
+
 2012-06-20         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* testext.ok: Update contents.
diff --git a/test/testext.ok b/test/testext.ok
index 08e272d..619d97b 100644
--- a/test/testext.ok
+++ b/test/testext.ok
@@ -22,8 +22,10 @@ test_array_size() returned 1, length is now 0
 
 test_array_elem: a["3"] = "three"
 test_array_elem() returned 1, test_array2[3] = 42
-test_array_elem did remove element "5"
-test_array_elem added element "7" --> seven
+test_array_elem() did remove element "5"
+test_array_elem() added element "7" --> seven
+test_array2["subarray"]["hello"] = world
+test_array2["subarray"]["answer"] = 42
 
 test_array_param() returned 1
 isarray(a_new_array) = 1

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    9 ++++++
 TODO.xgawk          |   14 +++++-----
 awk.h               |    2 +-
 awkgram.c           |    4 +-
 awkgram.y           |    4 +-
 extension/ChangeLog |    5 +++
 extension/testext.c |   68 ++++++++++++++++++++++++---------------------------
 gawkapi.c           |    3 +-
 test/ChangeLog      |    4 +++
 test/testext.ok     |    6 +++-
 10 files changed, 68 insertions(+), 51 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Thu Jun 21 15:34:54 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Shn9a-00007e-5I
	for mharc-gawk-diffs@gnu.org; Thu, 21 Jun 2012 15:34:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33307)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Shn9W-0008Vc-NU
	for gawk-diffs@gnu.org; Thu, 21 Jun 2012 15:34:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Shn9U-0001M3-Fj
	for gawk-diffs@gnu.org; Thu, 21 Jun 2012 15:34:50 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:53296)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1Shn9U-0001Lv-Bw
	for gawk-diffs@gnu.org; Thu, 21 Jun 2012 15:34:48 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1Shn9T-000052-S2
	for gawk-diffs@gnu.org; Thu, 21 Jun 2012 19:34:48 +0000
Date: Thu, 21 Jun 2012 19:34:47 +0000
Message-Id: <E1Shn9T-000052-S2@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 898eb2ad1d514887993994e60fe860ac3ee1bba8
X-Git-Newrev: 115d332143b1a9d23bbf57088a577e778dcf31f8
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 115d332143b1a9d23bbf57088a577e778dcf31f8
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 21 Jun 2012 19:34:53 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  115d332143b1a9d23bbf57088a577e778dcf31f8 (commit)
       via  d0d954cce2ca5a2e0ed41116502b636446ac528f (commit)
      from  898eb2ad1d514887993994e60fe860ac3ee1bba8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=115d332143b1a9d23bbf57088a577e778dcf31f8

commit 115d332143b1a9d23bbf57088a577e778dcf31f8
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Thu Jun 21 22:34:36 2012 +0300

    Update NEWS a bit.

diff --git a/NEWS b/NEWS
index 243765a..79fcda6 100644
--- a/NEWS
+++ b/NEWS
@@ -16,9 +16,13 @@ Changes from 4.0.1 to 4.1
 
 2. The new -l option is used for loading dynamic extensions.
 
-3. Gawk now supports high precision arithmetic with MPFR.
+3. The new -i option is used for loading awk library files.
 
-4. A number of facilities from xgawk have been merged in!
+4. Gawk now supports high precision arithmetic with MPFR.
+
+5. A number of facilities from xgawk have been merged in!
+
+6. The dynamic extension interface has been completely redone! See the doc.
  
 Changes from 4.0.1 to 4.0.2
 ---------------------------

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=d0d954cce2ca5a2e0ed41116502b636446ac528f

commit d0d954cce2ca5a2e0ed41116502b636446ac528f
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Thu Jun 21 22:32:46 2012 +0300

    Remove extension() builtin.

diff --git a/ChangeLog b/ChangeLog
index 57da23e..dbfc8ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2012-06-21         Arnold D. Robbins     <arnold@skeeve.com>
 
+	More API and cleanup:
+
 	* awk.h (stopme): Make signature match other built-ins.
 	* awkgram.y (stopme): Make signature match other built-ins.
 	(regexp): Minor edit.
@@ -7,6 +9,15 @@
 	Set parent_array field of array value.
 	* TODO.xgawk: Update some.
 
+	Remove extension() builtin.
+
+	* awk.h (do_ext): Removed.
+	(load_ext): Signature changed.
+	* awkgram.y (tokentab): Remove do_ext.
+	Change calls to do_ext.
+	* ext.c (load_ext): Make init function a constant.
+	* main.c (main): Change calls to do_ext.
+
 2012-06-20         Arnold D. Robbins     <arnold@skeeve.com>
 
 	Restore lost debugging function:
diff --git a/awk.h b/awk.h
index d433a6e..6450cbd 100644
--- a/awk.h
+++ b/awk.h
@@ -1503,8 +1503,7 @@ extern STACK_ITEM *grow_stack(void);
 extern void dump_fcall_stack(FILE *fp);
 extern int register_exec_hook(Func_pre_exec preh, Func_post_exec posth);
 /* ext.c */
-NODE *do_ext(int nargs);
-NODE *load_ext(const char *lib_name, const char *init_func);
+void load_ext(const char *lib_name);
 #ifdef DYNAMIC
 awk_bool_t make_builtin(const awk_ext_func_t *);
 NODE *get_argument(int);
diff --git a/awkgram.c b/awkgram.c
index c8c7a08..a454b0c 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -4562,7 +4562,6 @@ static const struct token tokentab[] = {
 {"eval",	Op_symbol,	 LEX_EVAL,	0,		0,	0},
 {"exit",	Op_K_exit,	 LEX_EXIT,	0,		0,	0},
 {"exp",		Op_builtin,	 LEX_BUILTIN,	A(1),		do_exp,	MPF(exp)},
-{"extension",	Op_builtin,	 LEX_BUILTIN,	GAWKX|A(2),	do_ext,	0},
 {"fflush",	Op_builtin,	 LEX_BUILTIN,	RESX|A(0)|A(1), do_fflush,	0},
 {"for",		Op_K_for,	 LEX_FOR,	BREAK|CONTINUE,	0,	0},
 {"func",	Op_func, LEX_FUNCTION,	NOT_POSIX|NOT_OLD,	0,	0},
@@ -5160,7 +5159,7 @@ load_library(INSTRUCTION *file)
 		return -1;
 	}
 
-	(void) load_ext(s->fullpath, "dl_load");
+	load_ext(s->fullpath);
 	return 0;
 }
 
diff --git a/awkgram.y b/awkgram.y
index 3ed450d..7949829 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -1842,7 +1842,6 @@ static const struct token tokentab[] = {
 {"eval",	Op_symbol,	 LEX_EVAL,	0,		0,	0},
 {"exit",	Op_K_exit,	 LEX_EXIT,	0,		0,	0},
 {"exp",		Op_builtin,	 LEX_BUILTIN,	A(1),		do_exp,	MPF(exp)},
-{"extension",	Op_builtin,	 LEX_BUILTIN,	GAWKX|A(2),	do_ext,	0},
 {"fflush",	Op_builtin,	 LEX_BUILTIN,	RESX|A(0)|A(1), do_fflush,	0},
 {"for",		Op_K_for,	 LEX_FOR,	BREAK|CONTINUE,	0,	0},
 {"func",	Op_func, LEX_FUNCTION,	NOT_POSIX|NOT_OLD,	0,	0},
@@ -2440,7 +2439,7 @@ load_library(INSTRUCTION *file)
 		return -1;
 	}
 
-	(void) load_ext(s->fullpath, "dl_load");
+	load_ext(s->fullpath);
 	return 0;
 }
 
diff --git a/ext.c b/ext.c
index d0755cc..911754b 100644
--- a/ext.c
+++ b/ext.c
@@ -33,32 +33,12 @@
 
 #include <dlfcn.h>
 
-/* do_ext --- load an extension at run-time: interface to load_ext */
-
-NODE *
-do_ext(int nargs)
-{
-	NODE *obj, *fun, *ret = NULL;
-	SRCFILE *s;
-	extern SRCFILE *srcfiles;
-
-	fun = POP_STRING();	/* name of initialization function */
-	obj = POP_STRING();	/* name of shared object */
-
-	s = add_srcfile(SRC_EXTLIB, obj->stptr, srcfiles, NULL, NULL);
-	if (s != NULL)
-		ret = load_ext(s->fullpath, fun->stptr);
-	DEREF(obj);
-	DEREF(fun);
-	if (ret == NULL)
-		ret = dupnode(Nnull_string);
-	return ret;
-}
+#define INIT_FUNC	"dl_load"
 
 /* load_ext --- load an external library */
 
-NODE *
-load_ext(const char *lib_name, const char *init_func)
+void
+load_ext(const char *lib_name)
 {
 	int (*install_func)(const gawk_api_t *const, awk_ext_id_t);
 	void *dl;
@@ -69,7 +49,7 @@ load_ext(const char *lib_name, const char *init_func)
 		fatal(_("extensions are not allowed in sandbox mode"));
 
 	if (do_traditional || do_posix)
-		fatal(_("-l / @load / `extension' are gawk extensions"));
+		fatal(_("-l / @load are gawk extensions"));
 
 	if ((dl = dlopen(lib_name, flags)) == NULL)
 		fatal(_("load_ext: cannot open library `%s' (%s)\n"), lib_name,
@@ -81,14 +61,14 @@ load_ext(const char *lib_name, const char *init_func)
 		fatal(_("load_ext: library `%s': does not define `plugin_is_GPL_compatible' (%s)\n"),
 				lib_name, dlerror());
 	install_func = (int (*)(const gawk_api_t *const, awk_ext_id_t))
-				dlsym(dl, init_func);
+				dlsym(dl, INIT_FUNC);
 	if (install_func == NULL)
 		fatal(_("load_ext: library `%s': cannot call function `%s' (%s)\n"),
-				lib_name, init_func, dlerror());
+				lib_name, INIT_FUNC, dlerror());
 
 	if (install_func(& api_impl, NULL /* ext_id */) == 0) {
 		warning(_("load_ext: library `%s' initialization routine `%s' failed\n"),
-				lib_name, init_func);
+				lib_name, INIT_FUNC);
 		return make_number(-1);
 	}
 	return make_number(0);
@@ -231,23 +211,11 @@ get_actual_argument(int i, bool optional, bool want_array)
 
 #else
 
-/* do_ext --- dummy version if extensions not available */
-
-NODE *
-do_ext(int nargs)
-{
-	const char *emsg = _("Operation Not Supported");
-
-	update_ERRNO_string(emsg, DONT_TRANSLATE);
-	return make_number((AWKNUM) -1);
-}
-
 /* load_ext --- dummy version if extensions not available */
 
-NODE *
-load_ext(const char *lib_name, const char *init_func, NODE *obj)
+void
+load_ext(const char *lib_name)
 {
 	fatal(_("dynamic loading of library not supported"));
-	return NULL;
 }
 #endif
diff --git a/main.c b/main.c
index b3f7f9e..bbe656d 100644
--- a/main.c
+++ b/main.c
@@ -644,7 +644,7 @@ out:
 	/* load extension libs */
         for (s = srcfiles->next; s != srcfiles; s = s->next) {
                 if (s->stype == SRC_EXTLIB)
-			(void) load_ext(s->fullpath, "dl_load");
+			load_ext(s->fullpath);
 		else if (s->stype != SRC_INC)
 			have_srcfile++;
         }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |   11 +++++++++++
 NEWS      |    8 ++++++--
 awk.h     |    3 +--
 awkgram.c |    3 +--
 awkgram.y |    3 +--
 ext.c     |   50 +++++++++-----------------------------------------
 main.c    |    2 +-
 7 files changed, 30 insertions(+), 50 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Sun Jun 24 14:08:19 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SirER-0000Qp-8V
	for mharc-gawk-diffs@gnu.org; Sun, 24 Jun 2012 14:08:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41695)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SirEL-0000Od-UI
	for gawk-diffs@gnu.org; Sun, 24 Jun 2012 14:08:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SirEI-0007JK-5f
	for gawk-diffs@gnu.org; Sun, 24 Jun 2012 14:08:13 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:44274)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SirEI-0007JG-1O
	for gawk-diffs@gnu.org; Sun, 24 Jun 2012 14:08:10 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1SirEG-0008D6-9K
	for gawk-diffs@gnu.org; Sun, 24 Jun 2012 18:08:09 +0000
Date: Sun, 24 Jun 2012 18:08:09 +0000
Message-Id: <E1SirEG-0008D6-9K@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 115d332143b1a9d23bbf57088a577e778dcf31f8
X-Git-Newrev: 37cd3566b9b74c43d5f11f1cba8dec147a25e474
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 37cd3566b9b74c43d5f11f1cba8dec147a25e474
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 24 Jun 2012 18:08:17 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  37cd3566b9b74c43d5f11f1cba8dec147a25e474 (commit)
      from  115d332143b1a9d23bbf57088a577e778dcf31f8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=37cd3566b9b74c43d5f11f1cba8dec147a25e474

commit 37cd3566b9b74c43d5f11f1cba8dec147a25e474
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Sun Jun 24 21:07:22 2012 +0300

    Get rwarray extension working with new API.

diff --git a/ChangeLog b/ChangeLog
index dbfc8ef..9f6cad4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-24         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* ext.c (load_ext): Don't retun a value from a void function.
+	* gawkapi.c (api_set_array_element): Set up vname and parent_array.
+
 2012-06-21         Arnold D. Robbins     <arnold@skeeve.com>
 
 	More API and cleanup:
diff --git a/ext.c b/ext.c
index 911754b..0b87def 100644
--- a/ext.c
+++ b/ext.c
@@ -69,9 +69,9 @@ load_ext(const char *lib_name)
 	if (install_func(& api_impl, NULL /* ext_id */) == 0) {
 		warning(_("load_ext: library `%s' initialization routine `%s' failed\n"),
 				lib_name, INIT_FUNC);
-		return make_number(-1);
+		return;
 	}
-	return make_number(0);
+	return;
 }
 
 
diff --git a/extension/ChangeLog b/extension/ChangeLog
index b482d6f..9d4305c 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,9 @@
+2012-06-24         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* Makefile.am: Enable rwarray extension.
+	* rwarray.c: Redone to use new API.
+	* rwarray.awk: Revamped for new version.
+
 2012-06-21         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* testext.c (test_array_elem): Add a subarray.
diff --git a/extension/Makefile.am b/extension/Makefile.am
index bdb1bd1..767c2ab 100644
--- a/extension/Makefile.am
+++ b/extension/Makefile.am
@@ -1,7 +1,7 @@
 #
 # extension/Makefile.am --- automake input file for gawk
 #
-# Copyright (C) 1995-2006 the Free Software Foundation, Inc.
+# Copyright (C) 1995-2006, 2012 the Free Software Foundation, Inc.
 #
 # This file is part of GAWK, the GNU implementation of the
 # AWK Programming Language.
@@ -36,6 +36,7 @@ pkgextension_LTLIBRARIES =	\
 	fork.la		\
 	ordchr.la	\
 	readfile.la	\
+	rwarray.la	\
 	testext.la	\
 	time.la
 
@@ -49,12 +50,12 @@ ordchr_la_SOURCES     = ordchr.c
 ordchr_la_LDFLAGS     = $(MY_MODULE_FLAGS)
 readfile_la_SOURCES   = readfile.c
 readfile_la_LDFLAGS   = $(MY_MODULE_FLAGS)
+rwarray_la_SOURCES    = rwarray.c
+rwarray_la_LDFLAGS    = $(MY_MODULE_FLAGS)
 time_la_SOURCES       = time.c
 time_la_LDFLAGS       = $(MY_MODULE_FLAGS)
-testext_la_SOURCES       = testext.c
-testext_la_LDFLAGS       = $(MY_MODULE_FLAGS)
-#rwarray_la_SOURCES    = rwarray.c
-#rwarray_la_LDFLAGS    = $(MY_MODULE_FLAGS)
+testext_la_SOURCES    = testext.c
+testext_la_LDFLAGS    = $(MY_MODULE_FLAGS)
 
 EXTRA_DIST = \
 	ChangeLog \
diff --git a/extension/Makefile.in b/extension/Makefile.in
index 202989a..5666c9d 100644
--- a/extension/Makefile.in
+++ b/extension/Makefile.in
@@ -18,7 +18,7 @@
 #
 # extension/Makefile.am --- automake input file for gawk
 #
-# Copyright (C) 1995-2006 the Free Software Foundation, Inc.
+# Copyright (C) 1995-2006, 2012 the Free Software Foundation, Inc.
 #
 # This file is part of GAWK, the GNU implementation of the
 # AWK Programming Language.
@@ -154,6 +154,12 @@ readfile_la_OBJECTS = $(am_readfile_la_OBJECTS)
 readfile_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(readfile_la_LDFLAGS) $(LDFLAGS) -o $@
+rwarray_la_LIBADD =
+am_rwarray_la_OBJECTS = rwarray.lo
+rwarray_la_OBJECTS = $(am_rwarray_la_OBJECTS)
+rwarray_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(rwarray_la_LDFLAGS) $(LDFLAGS) -o $@
 testext_la_LIBADD =
 am_testext_la_OBJECTS = testext.lo
 testext_la_OBJECTS = $(am_testext_la_OBJECTS)
@@ -181,10 +187,10 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(filefuncs_la_SOURCES) $(fork_la_SOURCES) \
 	$(ordchr_la_SOURCES) $(readfile_la_SOURCES) \
-	$(testext_la_SOURCES) $(time_la_SOURCES)
+	$(rwarray_la_SOURCES) $(testext_la_SOURCES) $(time_la_SOURCES)
 DIST_SOURCES = $(filefuncs_la_SOURCES) $(fork_la_SOURCES) \
 	$(ordchr_la_SOURCES) $(readfile_la_SOURCES) \
-	$(testext_la_SOURCES) $(time_la_SOURCES)
+	$(rwarray_la_SOURCES) $(testext_la_SOURCES) $(time_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -337,6 +343,7 @@ pkgextension_LTLIBRARIES = \
 	fork.la		\
 	ordchr.la	\
 	readfile.la	\
+	rwarray.la	\
 	testext.la	\
 	time.la
 
@@ -349,12 +356,12 @@ ordchr_la_SOURCES = ordchr.c
 ordchr_la_LDFLAGS = $(MY_MODULE_FLAGS)
 readfile_la_SOURCES = readfile.c
 readfile_la_LDFLAGS = $(MY_MODULE_FLAGS)
+rwarray_la_SOURCES = rwarray.c
+rwarray_la_LDFLAGS = $(MY_MODULE_FLAGS)
 time_la_SOURCES = time.c
 time_la_LDFLAGS = $(MY_MODULE_FLAGS)
 testext_la_SOURCES = testext.c
 testext_la_LDFLAGS = $(MY_MODULE_FLAGS)
-#rwarray_la_SOURCES    = rwarray.c
-#rwarray_la_LDFLAGS    = $(MY_MODULE_FLAGS)
 EXTRA_DIST = \
 	ChangeLog \
 	ChangeLog.0 \
@@ -456,6 +463,8 @@ ordchr.la: $(ordchr_la_OBJECTS) $(ordchr_la_DEPENDENCIES) $(EXTRA_ordchr_la_DEPE
 	$(ordchr_la_LINK) -rpath $(pkgextensiondir) $(ordchr_la_OBJECTS) $(ordchr_la_LIBADD) $(LIBS)
 readfile.la: $(readfile_la_OBJECTS) $(readfile_la_DEPENDENCIES) $(EXTRA_readfile_la_DEPENDENCIES) 
 	$(readfile_la_LINK) -rpath $(pkgextensiondir) $(readfile_la_OBJECTS) $(readfile_la_LIBADD) $(LIBS)
+rwarray.la: $(rwarray_la_OBJECTS) $(rwarray_la_DEPENDENCIES) $(EXTRA_rwarray_la_DEPENDENCIES) 
+	$(rwarray_la_LINK) -rpath $(pkgextensiondir) $(rwarray_la_OBJECTS) $(rwarray_la_LIBADD) $(LIBS)
 testext.la: $(testext_la_OBJECTS) $(testext_la_DEPENDENCIES) $(EXTRA_testext_la_DEPENDENCIES) 
 	$(testext_la_LINK) -rpath $(pkgextensiondir) $(testext_la_OBJECTS) $(testext_la_LIBADD) $(LIBS)
 time.la: $(time_la_OBJECTS) $(time_la_DEPENDENCIES) $(EXTRA_time_la_DEPENDENCIES) 
@@ -471,6 +480,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fork.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ordchr.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rwarray.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testext.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Plo@am__quote@
 
diff --git a/extension/rwarray.awk b/extension/rwarray.awk
index 1057b39..b34a42a 100644
--- a/extension/rwarray.awk
+++ b/extension/rwarray.awk
@@ -1,19 +1,24 @@
-BEGIN {
-	extension("./rwarray.so","dlload")
+@load "rwarray"
 
+BEGIN {
 	while ((getline word < "/usr/share/dict/words") > 0)
 		dict[word] = word word
 
-	for (i in dict)
-		printf("dict[%s] = %s\n", i, dict[i]) > "orig.out"
+	n = asorti(dict, dictindices)
+	for (i = 1; i <= n; i++)
+		printf("dict[%s] = %s\n", dictindices[i], dict[dictindices[i]]) > "orig.out"
 	close("orig.out");
 
-	writea("orig.bin", dict)
+	ret = writea("orig.bin", dict)
+	printf "writea() returned %d, expecting 1\n", ret
 
-	reada("orig.bin", dict)
+ 
+	ret = reada("orig.bin", dict)
+	printf "reada() returned %d, expecting 1\n", ret
 
-	for (i in dict)
-		printf("dict[%s] = %s\n", i, dict[i]) > "new.out"
+	n = asorti(dict, dictindices)
+	for (i = 1; i <= n; i++)
+		printf("dict[%s] = %s\n", dictindices[i], dict[dictindices[i]]) > "new.out"
 	close("new.out");
 
 	ret = system("cmp orig.out new.out")
@@ -23,6 +28,6 @@ BEGIN {
 	else
 		print "old and new are not equal - BAD"
 
-	if (ret == 0 && !("keepit" in ENVIRON))
-		system("rm orig.bin orig.out new.out")
+	if (ret == 0 && !("KEEPIT" in ENVIRON))
+		system("rm -f orig.bin orig.out new.out")
 }
diff --git a/extension/rwarray.c b/extension/rwarray.c
index fed040f..e4ddde3 100644
--- a/extension/rwarray.c
+++ b/extension/rwarray.c
@@ -3,10 +3,11 @@
  *
  * Arnold Robbins
  * May 2009
+ * Redone June 2012
  */
 
 /*
- * Copyright (C) 2009, 2010, 2011 the Free Software Foundation, Inc.
+ * Copyright (C) 2009, 2010, 2011, 2012 the Free Software Foundation, Inc.
  * 
  * This file is part of GAWK, the GNU implementation of the
  * AWK Programming Language.
@@ -26,76 +27,98 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
-#include "awk.h"
+#include <stdio.h>
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
 #include <arpa/inet.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
 
+#include "gawkapi.h"
 
 #define MAGIC "awkrulz\n"
-#define MAJOR 1
+#define MAJOR 3
 #define MINOR 0
 
+static const gawk_api_t *api;	/* for convenience macros to work */
+static awk_ext_id_t *ext_id;
+
 int plugin_is_GPL_compatible;
 
-static int write_array(int fd, NODE *array);
-static int write_elem(int fd, int index, NODE *item);
-static int write_chain(int fd, int index, NODE *item);
-static int write_value(int fd, NODE *val);
+static awk_bool_t write_array(int fd, awk_array_t array);
+static awk_bool_t write_elem(int fd, awk_element_t *element);
+static awk_bool_t write_value(int fd, awk_value_t *val);
 
-static int read_array(int fd, NODE *array);
-static NODE *read_elem(int fd, int *index, NODE *array);
-static NODE *read_value(int fd);
+static awk_bool_t read_array(int fd, awk_array_t array);
+static awk_bool_t read_elem(int fd, awk_element_t *element);
+static awk_bool_t read_value(int fd, awk_value_t *value);
 
 /*
  * Format of array info:
  *
- * MAGIC	8 bytes
+ * MAGIC		8 bytes
  * Major version	4 bytes - network order
  * Minor version	4 bytes - network order
  * Element count	4 bytes - network order
- * Array size		4 bytes - network order
  * Elements
  * 
  * For each element:
- * Bucket number:	4 bytes - network order
- * Hash of index val:	4 bytes - network order
  * Length of index val:	4 bytes - network order
  * Index val as characters (N bytes)
- * Value type		1 byte (0 = string, 1 = number, 2 = array)
+ * Value type		4 bytes (0 = string, 1 = number, 2 = array)
  * IF string:
  * 	Length of value	4 bytes
  * 	Value as characters (N bytes)
- * ELSE
+ * ELSE IF number:
  * 	8 bytes as native double
+ * ELSE
+ * 	Element count
+ * 	Elements
+ * END IF
  */
 
 /* do_writea --- write an array */
 
-static NODE *
-do_writea(int nargs)
+static awk_value_t *
+do_writea(int nargs, awk_value_t *result)
 {
-	NODE *file, *array;
-	int ret;
-	int fd;
+	awk_value_t filename, array;
+	int fd = -1;
 	uint32_t major = MAJOR;
 	uint32_t minor = MINOR;
 
+	assert(result != NULL);
+	make_number(0.0, result);
+
 	if (do_lint && nargs > 2)
-		lintwarn("writea: called with too many arguments");
+		lintwarn(ext_id, "writea: called with too many arguments");
+
+	if (nargs < 2)
+		goto out;
 
 	/* directory is first arg, array to dump is second */
-	file = get_scalar_argument(0, false);
-	array = get_array_argument(1, false);
+	if (! get_argument(0, AWK_STRING, & filename)) {
+		fprintf(stderr, "do_writea: argument 0 is not a string\n");
+		errno = EINVAL;
+		goto done1;
+	}
 
-	/* open the file, if error, set ERRNO and return */
-	(void) force_string(file);
-	fd = creat(file->stptr, 0600);
-	if (fd < 0) {
+	if (! get_argument(1, AWK_ARRAY, & array)) {
+		fprintf(stderr, "do_writea: argument 1 is not an array\n");
+		errno = EINVAL;
 		goto done1;
 	}
 
+	/* open the file, if error, set ERRNO and return */
+	fd = creat(filename.str_value.str, 0600);
+	if (fd < 0)
+		goto done1;
+
 	if (write(fd, MAGIC, strlen(MAGIC)) != strlen(MAGIC))
 		goto done1;
 
@@ -107,356 +130,336 @@ do_writea(int nargs)
 	if (write(fd, & minor, sizeof(minor)) != sizeof(minor))
 		goto done1;
 
-	ret = write_array(fd, array);
-	if (ret != 0)
-		goto done1;
-	ret = 0;
-	goto done0;
+	if (write_array(fd, array.array_cookie)) {
+		make_number(1.0, result);
+		goto done0;
+	}
 
 done1:
-	ret = -1;
 	update_ERRNO_int(errno);
-	unlink(file->stptr);
+	unlink(filename.str_value.str);
 
 done0:
 	close(fd);
-
-	/* Set the return value */
-	return make_number((AWKNUM) ret);
+out:
+	return result;
 }
 
 
 /* write_array --- write out an array or a sub-array */
 
-static int
-write_array(int fd, NODE *array)
+static awk_bool_t
+write_array(int fd, awk_array_t array)
 {
-	int ret;
+	uint32_t i;
 	uint32_t count;
-	uint32_t array_sz;
-	int i;
-
-	count = htonl(array->table_size);
-	if (write(fd, & count, sizeof(count)) != sizeof(count))
-		return -1;
+	awk_flat_array_t *flat_array;
 
-	array_sz = htonl(array->array_size);
-	if (write(fd, & array_sz, sizeof(array_sz)) != sizeof(array_sz))
-		return -1;
-
-	for (i = 0; i < array->array_size; i++) {
-		ret = write_chain(fd, i, array->var_array[i]);
-		if (ret != 0)
-			return ret;
+	if (! flatten_array(array, & flat_array)) {
+		printf("write_array: could not flatten array\n");
+		return 0;
 	}
-	return 0;
-}
 
+	count = htonl(flat_array->count);
+	if (write(fd, & count, sizeof(count)) != sizeof(count))
+		return 0;
 
-/* write_chain --- write out a whole hash chain */
-
-/*
- * Write elements in the chain in reverse order so that
- * when we read the elements back in we can just push them
- * onto the front and thus recreate the array as it was.
- */
-
-static int
-write_chain(int fd, int index, NODE *bucket)
-{
-	int ret;
+	for (i = 0; i < flat_array->count; i++) {
+		if (! write_elem(fd, & flat_array->elements[i]))
+			return 0;
+	}
 
-	if (bucket == NULL)
+	if (! release_flattened_array(array, flat_array)) {
+		printf("write_array: could not release flattened array\n");
 		return 0;
+	}
 
-	ret = write_chain(fd, index, bucket->ahnext);
-	if (ret != 0)
-		return ret;
-
-	return write_elem(fd, index, bucket);
+	return 1;
 }
 
 /* write_elem --- write out a single element */
 
-static int
-write_elem(int fd, int index, NODE *item)
+static awk_bool_t
+write_elem(int fd, awk_element_t *element)
 {
-	uint32_t hashval, indexval_len;
-
-	index = htonl(index);
-	if (write(fd, & index, sizeof(index)) != sizeof(index))
-		return -1;
+	uint32_t indexval_len;
+	ssize_t write_count;
 
-	hashval = htonl(item->ahcode);
-	if (write(fd, & hashval, sizeof(hashval)) != sizeof(hashval))
-		return -1;
-
-	indexval_len = htonl(item->ahname_len);
+	indexval_len = htonl(element->index.str_value.len);
 	if (write(fd, & indexval_len, sizeof(indexval_len)) != sizeof(indexval_len))
-		return -1;
+		return 0;
 
-	if (write(fd, item->ahname_str, item->ahname_len) != item->ahname_len)
-		return -1;
+	if (element->index.str_value.len > 0) {
+		write_count = write(fd, element->index.str_value.str,
+				element->index.str_value.len);
+		if (write_count != (ssize_t) element->index.str_value.len)
+			return 0;
+	}
 
-	return write_value(fd, item->ahvalue);
+	return write_value(fd, & element->value);
 }
 
 /* write_value --- write a number or a string or a array */
 
 static int
-write_value(int fd, NODE *val)
+write_value(int fd, awk_value_t *val)
 {
-	int code, len;
+	uint32_t code, len;
 
-	if (val->type == Node_var_array) {
+	if (val->val_type == AWK_ARRAY) {
 		code = htonl(2);
 		if (write(fd, & code, sizeof(code)) != sizeof(code))
-			return -1;
-		return write_array(fd, val);
+			return 0;
+		return write_array(fd, val->array_cookie);
 	}
 
-	if ((val->flags & NUMBER) != 0) {
+	if (val->val_type == AWK_NUMBER) {
 		code = htonl(1);
 		if (write(fd, & code, sizeof(code)) != sizeof(code))
-			return -1;
+			return 0;
 
-		if (write(fd, & val->numbr, sizeof(val->numbr)) != sizeof(val->numbr))
-			return -1;
+		if (write(fd, & val->num_value, sizeof(val->num_value)) != sizeof(val->num_value))
+			return 0;
 	} else {
 		code = 0;
 		if (write(fd, & code, sizeof(code)) != sizeof(code))
-			return -1;
+			return 0;
 
-		len = htonl(val->stlen);
+		len = htonl(val->str_value.len);
 		if (write(fd, & len, sizeof(len)) != sizeof(len))
-			return -1;
+			return 0;
 
-		if (write(fd, val->stptr, val->stlen) != val->stlen)
-			return -1;
+		if (write(fd, val->str_value.str, val->str_value.len)
+				!= (ssize_t) val->str_value.len)
+			return 0;
 	}
 
-	return 0;
+	return 1;
 }
 
 /* do_reada --- read an array */
 
-static NODE *
-do_reada(int nargs)
+static awk_value_t *
+do_reada(int nargs, awk_value_t *result)
 {
-	NODE *file, *array;
-	int ret;
-	int fd;
+	awk_value_t filename, array;
+	int fd = -1;
 	uint32_t major;
 	uint32_t minor;
 	char magic_buf[30];
 
+	assert(result != NULL);
+	make_number(0.0, result);
+
 	if (do_lint && nargs > 2)
-		lintwarn("reada: called with too many arguments");
+		lintwarn(ext_id, "reada: called with too many arguments");
 
-	/* directory is first arg, array to dump is second */
-	file = get_scalar_argument(0, false);
-	array = get_array_argument(1, false);
+	if (nargs < 2)
+		goto out;
 
-	(void) force_string(file);
-	fd = open(file->stptr, O_RDONLY);
-	if (fd < 0) {
+	/* directory is first arg, array to read is second */
+	if (! get_argument(0, AWK_STRING, & filename)) {
+		fprintf(stderr, "do_reada: argument 0 is not a string\n");
+		errno = EINVAL;
 		goto done1;
 	}
 
+	if (! get_argument(1, AWK_ARRAY, & array)) {
+		fprintf(stderr, "do_reada: argument 1 is not an array\n");
+		errno = EINVAL;
+		goto done1;
+	}
+
+	fd = open(filename.str_value.str, O_RDONLY);
+	if (fd < 0)
+		goto done1;
+
 	memset(magic_buf, '\0', sizeof(magic_buf));
 	if (read(fd, magic_buf, strlen(MAGIC)) != strlen(MAGIC)) {
+		errno = EBADF;
 		goto done1;
 	}
 
 	if (strcmp(magic_buf, MAGIC) != 0) {
+		errno = EBADF;
 		goto done1;
 	}
 
 	if (read(fd, & major, sizeof(major)) != sizeof(major)) {
+		errno = EBADF;
 		goto done1;
 	}
 	major = ntohl(major);
 
 	if (major != MAJOR) {
+		errno = EBADF;
 		goto done1;
 	}
 
 	if (read(fd, & minor, sizeof(minor)) != sizeof(minor)) {
+		/* read() sets errno */
 		goto done1;
 	}
+
 	minor = ntohl(minor);
 	if (minor != MINOR) {
+		errno = EBADF;
 		goto done1;
 	}
 
-	assoc_clear(array, NULL);
+	if (! clear_array(array.array_cookie)) {
+		errno = ENOMEM;
+		printf("do_reada: clear_array failed\n");
+		goto done1;
+	}
 
-	ret = read_array(fd, array);
-	if (ret == 0)
+	if (read_array(fd, array.array_cookie)) {
+		make_number(1.0, result);
 		goto done0;
+	}
 
 done1:
-	ret = -1;
 	update_ERRNO_int(errno);
-
 done0:
 	close(fd);
-
-	/* Set the return value */
-	return make_number((AWKNUM) ret);
+out:
+	return result;
 }
 
 
 /* read_array --- read in an array or sub-array */
 
-static int
-read_array(int fd, NODE *array)
+static awk_bool_t
+read_array(int fd, awk_array_t array)
 {
-	int i;
+	uint32_t i;
 	uint32_t count;
-	uint32_t array_sz;
-	int index;
-	NODE *new_elem;
+	awk_element_t new_elem;
 
 	if (read(fd, & count, sizeof(count)) != sizeof(count)) {
-		return -1;
-	}
-	array->table_size = ntohl(count);
-
-	if (read(fd, & array_sz, sizeof(array_sz)) != sizeof(array_sz)) {
-		return -1;
+		return 0;
 	}
-	array->array_size = ntohl(array_sz);
-
-	/* malloc var_array */
-	array->var_array = (NODE **) malloc(array->array_size * sizeof(NODE *));
-	memset(array->var_array, '\0', array->array_size * sizeof(NODE *));
-
-	for (i = 0; i < array->table_size; i++) {
-		if ((new_elem = read_elem(fd, & index, array)) != NULL) {
-			new_elem->ahnext = array->var_array[index];
-			array->var_array[index] = new_elem;
+	count = ntohl(count);
+
+	for (i = 0; i < count; i++) {
+		if (read_elem(fd, & new_elem)) {
+			/* add to array */
+			if (! set_array_element(array, & new_elem)) {
+				printf("read_array: set_array_element failed\n");
+				return 0;
+			}
 		} else
 			break;
 	}
-	if (i != array->table_size)
-		return -1; 
-	return 0;
-}
 
+	if (i != count)
+		return 0;
+
+	return 1;
+}
 
 /* read_elem --- read in a single element */
 
-static NODE *
-read_elem(int fd, int *the_index, NODE *array)
+static awk_bool_t
+read_elem(int fd, awk_element_t *element)
 {
-	uint32_t hashval, indexval_len, index;
-	NODE *item;
-	NODE *val;
-	int ret;
+	uint32_t index_len;
+	static char *buffer;
+	static uint32_t buflen;
+	ssize_t ret;
 
-	*the_index = 0;
-
-	if ((ret = read(fd, & index, sizeof(index))) != sizeof(index)) {
-		return NULL;
+	if ((ret = read(fd, & index_len, sizeof(index_len))) != sizeof(index_len)) {
+		return 0;
 	}
-	*the_index = index = ntohl(index);
+	index_len = ntohl(index_len);
 
-	getnode(item);
-	memset(item, 0, sizeof(*item));
-	item->type = Node_ahash;
-	item->flags = MALLOC;
+	memset(element, 0, sizeof(*element));
 
-	if (read(fd, & hashval, sizeof(hashval)) != sizeof(hashval)) {
-		return NULL;
-	}
+	if (index_len > 0) {
+		if (buffer == NULL) {
+			// allocate buffer
+			emalloc(buffer, char *, index_len, "read_elem");
+			buflen = index_len;
+		} else if (buflen < index_len) {
+			// reallocate buffer
+			char *cp = realloc(buffer, index_len);
 
-	item->ahcode = ntohl(hashval);
+			if (cp == NULL)
+				return 0;
 
-	if (read(fd, & indexval_len, sizeof(indexval_len)) != sizeof(indexval_len)) {
-		return NULL;
-	}
-	item->ahname_len = ntohl(indexval_len);
+			buffer = cp;
+			buflen = index_len;
+		}
 
-	item->ahname_str = malloc(item->ahname_len + 2);
-	if (read(fd, item->ahname_str, item->ahname_len) != item->ahname_len) {
-		return NULL;
+		if (read(fd, buffer, index_len) != (ssize_t) index_len) {
+			return 0;
+		}
+		make_string(buffer, index_len, & element->index);
+	} else {
+		make_string("", 0, & element->index);
 	}
-	item->ahname_str[item->ahname_len] = '\0';
-	item->ahname_ref = 1;
 
-	item->ahvalue = val = read_value(fd);
-	if (val == NULL) {
-		return NULL;
-	}
-	if (val->type == Node_var_array) {
-		char *aname;
-		size_t aname_len;
-
-		/* construct the sub-array name */
-		aname_len = strlen(array->vname) + item->ahname_len + 4;
-		emalloc(aname, char *, aname_len + 2, "read_elem");
-		sprintf(aname, "%s[\"%.*s\"]", array->vname, (int) item->ahname_len, item->ahname_str);
-		val->vname = aname;
-	}
+	if (! read_value(fd, & element->value))
+		return 0;
 
-	return item;
+	return 1;
 }
 
 /* read_value --- read a number or a string */
 
-static NODE *
-read_value(int fd)
+static awk_bool_t
+read_value(int fd, awk_value_t *value)
 {
-	NODE *val;
-	int code, len;
+	uint32_t code, len;
 
-	getnode(val);
-	memset(val, 0, sizeof(*val));
-	val->type = Node_val;
+	if (read(fd, & code, sizeof(code)) != sizeof(code))
+		return 0;
 
-	if (read(fd, & code, sizeof(code)) != sizeof(code)) {
-		return NULL;
-	}
 	code = ntohl(code);
 
 	if (code == 2) {
-		val->type = Node_var_array;
-		if (read_array(fd, val) != 0)
-			return NULL; 
+		awk_array_t array = create_array();
+
+		if (read_array(fd, array) != 0)
+			return 0; 
+
+		/* hook into value */
+		value->val_type = AWK_ARRAY;
+		value->array_cookie = array;
 	} else if (code == 1) {
-		if (read(fd, & val->numbr, sizeof(val->numbr)) != sizeof(val->numbr)) {
-			return NULL;
-		}
+		double d;
+
+		if (read(fd, & d, sizeof(d)) != sizeof(d))
+			return 0;
 
-		val->flags = NUMBER|NUMCUR|MALLOC;
+		/* hook into value */
+		value->val_type = AWK_NUMBER;
+		value->num_value = d;
 	} else {
 		if (read(fd, & len, sizeof(len)) != sizeof(len)) {
-			return NULL;
+			return 0;
 		}
-		val->stlen = ntohl(len);
-		val->stptr = malloc(val->stlen + 2);
-		memset(val->stptr, '\0', val->stlen + 2);
-
-		if (read(fd, val->stptr, val->stlen) != val->stlen) {
-			return NULL;
+		len = ntohl(len);
+		value->val_type = AWK_STRING;
+		value->str_value.len = len;
+		value->str_value.str = malloc(len + 2);
+		memset(value->str_value.str, '\0', len + 2);
+
+		if (read(fd, value->str_value.str, len) != len) {
+			free(value->str_value.str);
+			return 0;
 		}
-
-		val->flags = STRING|STRCUR|MALLOC;
 	}
 
-	return val;
+	return 1;
 }
 
-/* dlload --- load new builtins in this library */
+static awk_ext_func_t func_table[] = {
+	{ "writea", do_writea, 2 },
+	{ "reada", do_reada, 2 },
+};
 
-NODE *
-dlload(tree, dl)
-NODE *tree;
-void *dl;
-{
-	make_builtin("writea", do_writea, 2);
-	make_builtin("reada", do_reada, 2);
 
-	return make_number((AWKNUM) 0);
-}
+/* define the dl_load function using the boilerplate macro */
+
+dl_load_func(func_table, rwarray, "")
diff --git a/gawkapi.c b/gawkapi.c
index 139d77b..f87c775 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -528,6 +528,7 @@ api_set_array_element(awk_ext_id_t id, awk_array_t a_cookie,
 {
 	NODE *array = (NODE *)a_cookie;
 	NODE *tmp;
+	NODE *elem;
 	NODE **aptr;
 
 	/* don't check for index len zero, null str is ok as index */
@@ -542,9 +543,13 @@ api_set_array_element(awk_ext_id_t id, awk_array_t a_cookie,
 	aptr = assoc_lookup(array, tmp);
 	unref(tmp);
 	unref(*aptr);
-	*aptr = awk_value_to_node(& element->value);
-	if ((*aptr)->type == Node_var_array)
-		(*aptr)->parent_array = array;
+	elem = *aptr = awk_value_to_node(& element->value);
+	if (elem->type == Node_var_array) {
+		elem->parent_array = array;
+		elem->vname = estrdup(element->index.str_value.str,
+					element->index.str_value.len);
+		make_aname(elem);
+	}
 
 	return true;
 }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |    5 +
 ext.c                 |    4 +-
 extension/ChangeLog   |    6 +
 extension/Makefile.am |   11 +-
 extension/Makefile.in |   20 ++-
 extension/rwarray.awk |   25 ++-
 extension/rwarray.c   |  469 +++++++++++++++++++++++++------------------------
 gawkapi.c             |   11 +-
 8 files changed, 293 insertions(+), 258 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Sun Jun 24 18:44:24 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SivXc-0005Zu-Qz
	for mharc-gawk-diffs@gnu.org; Sun, 24 Jun 2012 18:44:24 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42255)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SivXZ-0005Zo-Iw
	for gawk-diffs@gnu.org; Sun, 24 Jun 2012 18:44:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SivXW-0003kl-JT
	for gawk-diffs@gnu.org; Sun, 24 Jun 2012 18:44:21 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:37803)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SivXW-0003kf-Fu
	for gawk-diffs@gnu.org; Sun, 24 Jun 2012 18:44:18 -0400
Received: from ajschorr by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SivXV-0004RC-Dg
	for gawk-diffs@gnu.org; Sun, 24 Jun 2012 22:44:18 +0000
Date: Sun, 24 Jun 2012 22:44:17 +0000
Message-Id: <E1SivXV-0004RC-Dg@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 37cd3566b9b74c43d5f11f1cba8dec147a25e474
X-Git-Newrev: 6139211362667682c3022a72321e0cd8945b6592
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 6139211362667682c3022a72321e0cd8945b6592
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 24 Jun 2012 22:44:24 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  6139211362667682c3022a72321e0cd8945b6592 (commit)
      from  37cd3566b9b74c43d5f11f1cba8dec147a25e474 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=6139211362667682c3022a72321e0cd8945b6592

commit 6139211362667682c3022a72321e0cd8945b6592
Author: Andrew J. Schorr <aschorr@telemetry-investments.com>
Date:   Sun Jun 24 18:43:49 2012 -0400

    Hide private parts of IOBUF from extensions.

diff --git a/ChangeLog b/ChangeLog
index 9f6cad4..0043aaf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2012-06-24         Andrew J. Schorr     <aschorr@telemetry-investments.com>
+
+	* TODO.xgawk: Most of IOBUF has been hidden.
+	* gawkapi.h (IOBUF): Remove declaration (now back in awk.h).
+	(IOBUF_PUBLIC): Declare new structure defining subset of IOBUF fields
+	that should be exposed to extensions.
+	(gawk_api): Update register_open_hook argument from IOBUF to
+	IOBUF_PUBLIC.
+	* awk.h (IOBUF): Restore declaration with 5 fields moved to new
+	IOBUF_PUBLIC structure.
+	(register_open_hook): Update open_func argument from IOBUF to
+	IOBUF_PUBLIC.
+	* gawkapi.c (api_register_open_hook): Ditto.
+	* io.c (after_beginfile, nextfile, iop_close, gawk_pclose): Some fields
+	such as fd and name are now inside the IOBUF public structure.
+	(struct open_hook): Update open_func argument from IOBUF to
+	(register_open_hook): Ditto.
+	(find_open_hook): opaque now inside IOBUF_PUBLIC.
+	(iop_alloc): fd and name now in IOBUF_PUBLIC.
+	(get_a_record): If the get_record hook returns EOF, set the IOP_AT_EOF
+	flag.  Access fd inside IOBUF_PUBLIC.
+	(get_read_timeout): File name now inside IOBUF_PUBLIC.
+	* interpret.h (r_interpret): File name now inside IOBUF_PUBLIC.
+	* ext.c (load_ext): No need to call return at the end of a void
+	function.
+
 2012-06-24         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* ext.c (load_ext): Don't retun a value from a void function.
diff --git a/TODO.xgawk b/TODO.xgawk
index 7ea135a..3ea2029 100644
--- a/TODO.xgawk
+++ b/TODO.xgawk
@@ -40,9 +40,6 @@ To-do list for xgawk enhancements:
    (somehow).  More discussion / explanation of the vision behind this
    would be welcome.
 
-- Can the IOBUF internals be removed from gawkapi.h?  I think this may be
-  possible if we revise the open hook implementation.
-
 
 Separate projects for major standalone extensions.  We need to set up
 hosting for these projects:
@@ -160,3 +157,5 @@ Done:
    - must update the API do_lint value when changed by set_LINT
    - what is the proper return value for load_ext?  It does not matter
    unless called by the "extension" function that nobody uses.
+
+- Hide private parts of IOBUF from extensions.
diff --git a/awk.h b/awk.h
index 6450cbd..a2e0e39 100644
--- a/awk.h
+++ b/awk.h
@@ -887,10 +887,8 @@ typedef struct exp_instruction {
 /* Op_store_var */
 #define initval         x.xn
 
-#if 0
 typedef struct iobuf {
-	const char *name;       /* filename */
-	int fd;                 /* file descriptor */
+	IOBUF_PUBLIC public;	/* exposed to extensions */
 	struct stat sbuf;       /* stat buf */
 	char *buf;              /* start data buffer */
 	char *off;              /* start of current record in buffer */
@@ -908,10 +906,6 @@ typedef struct iobuf {
 	 */
 	ssize_t (*read_func)();
 
-	void *opaque;		/* private data for open hooks */
-	int (*get_record)(char **out, struct iobuf *, int *errcode);
-	void (*close_func)(struct iobuf *);		/* open and close hooks */
-	
 	int errcode;
 
 	int flag;
@@ -921,7 +915,6 @@ typedef struct iobuf {
 #		define  IOP_CLOSED      8
 #		define  IOP_AT_START    16
 } IOBUF;
-#endif
 
 typedef void (*Func_ptr)(void);
 
@@ -1549,7 +1542,7 @@ extern int isdirpunct(int c);
 
 /* io.c */
 extern void init_io(void);
-extern void register_open_hook(void *(*open_func)(IOBUF *));
+extern void register_open_hook(void *(*open_func)(IOBUF_PUBLIC *));
 extern void set_FNR(void);
 extern void set_NR(void);
 
diff --git a/ext.c b/ext.c
index 0b87def..14d55c5 100644
--- a/ext.c
+++ b/ext.c
@@ -66,12 +66,9 @@ load_ext(const char *lib_name)
 		fatal(_("load_ext: library `%s': cannot call function `%s' (%s)\n"),
 				lib_name, INIT_FUNC, dlerror());
 
-	if (install_func(& api_impl, NULL /* ext_id */) == 0) {
+	if (install_func(& api_impl, NULL /* ext_id */) == 0)
 		warning(_("load_ext: library `%s' initialization routine `%s' failed\n"),
 				lib_name, INIT_FUNC);
-		return;
-	}
-	return;
 }
 
 
diff --git a/gawkapi.c b/gawkapi.c
index f87c775..0a00be6 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -199,7 +199,7 @@ api_lintwarn(awk_ext_id_t id, const char *format, ...)
 /* api_register_open_hook --- register an open hook; for opening files read-only */
 
 static void
-api_register_open_hook(awk_ext_id_t id, void* (*open_func)(IOBUF *))
+api_register_open_hook(awk_ext_id_t id, void* (*open_func)(IOBUF_PUBLIC *))
 {
 	(void) id;
 
diff --git a/gawkapi.h b/gawkapi.h
index 3325c45..1954a5e 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -49,40 +49,14 @@
 extern "C" {
 #endif
 
-/* struct used for reading records and managing buffers */
-typedef struct iobuf {
-	const char *name;       /* filename */
-	int fd;                 /* file descriptor */
-	struct stat sbuf;       /* stat buf */
-	char *buf;              /* start data buffer */
-	char *off;              /* start of current record in buffer */
-	char *dataend;          /* first byte in buffer to hold new data,
-				   NULL if not read yet */
-	char *end;              /* end of buffer */
-	size_t readsize;        /* set from fstat call */
-	size_t size;            /* buffer size */
-	ssize_t count;          /* amount read last time */
-	size_t scanoff;         /* where we were in the buffer when we had
-				   to regrow/refill */
-	/*
-	 * No argument prototype on read_func. See get_src_buf()
-	 * in awkgram.y.
-	 */
-	ssize_t (*read_func)();
-
-	void *opaque;		/* private data for open hooks */
-	int (*get_record)(char **out, struct iobuf *, int *errcode);
-	void (*close_func)(struct iobuf *);	/* open and close hooks */
-	
-	int errcode;
-
-	int flag;
-#		define	IOP_IS_TTY	1
-#		define	IOP_NOFREE_OBJ	2
-#		define  IOP_AT_EOF      4
-#		define  IOP_CLOSED      8
-#		define  IOP_AT_START    16
-} IOBUF;
+/* portions of IOBUF that should be accessible to extension functions: */
+typedef struct iobuf_public {
+	const char *name;	/* filename */
+	int fd;			/* file descriptor */
+	void *opaque;           /* private data for open hooks */
+	int (*get_record)(char **out, struct iobuf_public *, int *errcode);
+	void (*close_func)(struct iobuf_public *);
+} IOBUF_PUBLIC;
 
 #define GAWK_API_MAJOR_VERSION	0
 #define GAWK_API_MINOR_VERSION	0
@@ -257,7 +231,7 @@ typedef struct gawk_api {
 	void (*api_lintwarn)(awk_ext_id_t id, const char *format, ...);
 
 	/* Register an open hook; for opening files read-only */
-	void (*register_open_hook)(awk_ext_id_t id, void* (*open_func)(IOBUF *));
+	void (*register_open_hook)(awk_ext_id_t id, void* (*open_func)(IOBUF_PUBLIC *));
 
 	/* Functions to update ERRNO */
 	void (*update_ERRNO_int)(awk_ext_id_t id, int errno_val);
diff --git a/interpret.h b/interpret.h
index abffbda..c7380bd 100644
--- a/interpret.h
+++ b/interpret.h
@@ -1043,7 +1043,7 @@ match_re:
 			if (inrec(curfile, & errcode) != 0) {
 				if (errcode > 0 && (do_traditional || ! pc->has_endfile))
 					fatal(_("error reading input file `%s': %s"),
-						curfile->name, strerror(errcode));
+						curfile->public.name, strerror(errcode));
 
 				JUMPTO(ni);
 			} /* else
diff --git a/io.c b/io.c
index a9fb345..ab204e0 100644
--- a/io.c
+++ b/io.c
@@ -312,11 +312,11 @@ after_beginfile(IOBUF **curfile)
 	iop = *curfile;
 	assert(iop != NULL);
 
-	if (iop->fd == INVALID_HANDLE) {
+	if (iop->public.fd == INVALID_HANDLE) {
 		const char *fname;
 		int errcode;
 
-		fname = iop->name;
+		fname = iop->public.name;
 		errcode = iop->errcode; 
 		iop->errcode = 0;
 		errno = 0;
@@ -366,7 +366,7 @@ nextfile(IOBUF **curfile, bool skipping)
 
 	if (iop != NULL) {
 		if (at_eof(iop)) {
-			assert(iop->fd != INVALID_HANDLE);
+			assert(iop->public.fd != INVALID_HANDLE);
 			(void) iop_close(iop);
 			*curfile = NULL;
 			return 1;	/* run endfile block */
@@ -430,7 +430,7 @@ nextfile(IOBUF **curfile, bool skipping)
 		iop = *curfile = iop_alloc(fileno(stdin), fname, & mybuf, false);
 		iop->flag |= IOP_NOFREE_OBJ;
 
-		if (iop->fd == INVALID_HANDLE) {
+		if (iop->public.fd == INVALID_HANDLE) {
 			errcode = errno;
 			errno = 0;
 			update_ERRNO_int(errno);
@@ -539,7 +539,7 @@ iop_close(IOBUF *iop)
 
 	if (iop == NULL)
 		return 0;
-	if (iop->fd == INVALID_HANDLE) {	/* from nextfile(...) above */
+	if (iop->public.fd == INVALID_HANDLE) {	/* from nextfile(...) above */
 		assert(iop->buf == NULL);
 		assert((iop->flag & IOP_NOFREE_OBJ) != 0);
 		return 0;
@@ -555,19 +555,19 @@ iop_close(IOBUF *iop)
 	 * So we remap the standard file to /dev/null.
 	 * Thanks to Jim Meyering for the suggestion.
 	 */
-	if (iop->fd == fileno(stdin)
-	    || iop->fd == fileno(stdout)
-	    || iop->fd == fileno(stderr))
-		ret = remap_std_file(iop->fd);
+	if (iop->public.fd == fileno(stdin)
+	    || iop->public.fd == fileno(stdout)
+	    || iop->public.fd == fileno(stderr))
+		ret = remap_std_file(iop->public.fd);
 	else
-		ret = close(iop->fd);
+		ret = close(iop->public.fd);
 
-	if (iop->close_func != NULL)
-		iop->close_func(iop);
+	if (iop->public.close_func != NULL)
+		iop->public.close_func(&iop->public);
 
 	if (ret == -1)
-		warning(_("close of fd %d (`%s') failed (%s)"), iop->fd,
-				iop->name, strerror(errno));
+		warning(_("close of fd %d (`%s') failed (%s)"), iop->public.fd,
+				iop->public.name, strerror(errno));
 	/*
 	 * Be careful -- $0 may still reference the buffer even though
 	 * an explicit close is being done; in the future, maybe we
@@ -1073,7 +1073,7 @@ close_rp(struct redirect *rp, two_way_close_type how)
 			if ((rp->flag & RED_SOCKET) != 0 && rp->iop != NULL) {
 #ifdef HAVE_SOCKETS
 				if ((rp->flag & RED_TCP) != 0)
-					(void) shutdown(rp->iop->fd, SHUT_RD);
+					(void) shutdown(rp->iop->public.fd, SHUT_RD);
 #endif /* HAVE_SOCKETS */
 				(void) iop_close(rp->iop);
 			} else
@@ -2224,10 +2224,10 @@ gawk_popen(const char *cmd, struct redirect *rp)
 static int
 gawk_pclose(struct redirect *rp)
 {
-	int rval, aval, fd = rp->iop->fd;
+	int rval, aval, fd = rp->iop->public.fd;
 
 	if (rp->iop != NULL) {
-		rp->iop->fd = dup(fd);	  /* kludge to allow close() + pclose() */
+		rp->iop->public.fd = dup(fd);	  /* kludge to allow close() + pclose() */
 		rval = iop_close(rp->iop);
 	}
 	rp->iop = NULL;
@@ -2589,13 +2589,13 @@ srcopen(SRCFILE *s)
 
 static struct open_hook {
 	struct open_hook *next;
-	void *(*open_func)(IOBUF *);
+	void *(*open_func)(IOBUF_PUBLIC *);
 } *open_hooks;
 
 /* register_open_hook --- add an open hook to the list */
 
 void
-register_open_hook(void *(*open_func)(IOBUF *))
+register_open_hook(void *(*open_func)(IOBUF_PUBLIC *))
 {
 	struct open_hook *oh;
 
@@ -2614,7 +2614,7 @@ find_open_hook(IOBUF *iop)
 
 	/* walk through open hooks, stop at first one that responds */
 	for (oh = open_hooks; oh != NULL; oh = oh->next) {
-		if ((iop->opaque = (*oh->open_func)(iop)) != NULL)
+		if ((iop->public.opaque = (*oh->open_func)(&iop->public)) != NULL)
 			break;
 	}
 }
@@ -2632,24 +2632,24 @@ iop_alloc(int fd, const char *name, IOBUF *iop, bool do_openhooks)
 		iop_malloced = true;
 	}
 	memset(iop, '\0', sizeof(IOBUF));
-	iop->fd = fd;
-	iop->name = name;
+	iop->public.fd = fd;
+	iop->public.name = name;
 	iop->read_func = ( ssize_t(*)() ) read;
 
 	if (do_openhooks) {
 		find_open_hook(iop);
 		/* tried to find open hook and could not */
-		if (iop->fd == INVALID_HANDLE) {
+		if (iop->public.fd == INVALID_HANDLE) {
 			if (iop_malloced)
 				efree(iop);
 			return NULL;
 		}
-	} else if (iop->fd == INVALID_HANDLE)
+	} else if (iop->public.fd == INVALID_HANDLE)
 		return iop;
 
-	if (os_isatty(iop->fd))
+	if (os_isatty(iop->public.fd))
 		iop->flag |= IOP_IS_TTY;
-	iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf);
+	iop->readsize = iop->size = optimal_bufsize(iop->public.fd, & sbuf);
 	iop->sbuf = sbuf;
 	if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0)
 		lintwarn(_("data file `%s' is empty"), name);
@@ -3052,12 +3052,16 @@ get_a_record(char **out,        /* pointer to pointer to data */
 	if (read_can_timeout)
 		read_timeout = get_read_timeout(iop);
 
-	if (iop->get_record != NULL)
-		return iop->get_record(out, iop, errcode);
+	if (iop->public.get_record != NULL) {
+		int rc = iop->public.get_record(out, &iop->public, errcode);
+		if (rc == EOF)
+			iop->flag |= IOP_AT_EOF;
+		return rc;
+	}
 
         /* fill initial buffer */
 	if (has_no_data(iop) || no_data_left(iop)) {
-		iop->count = iop->read_func(iop->fd, iop->buf, iop->readsize);
+		iop->count = iop->read_func(iop->public.fd, iop->buf, iop->readsize);
 		if (iop->count == 0) {
 			iop->flag |= IOP_AT_EOF;
 			return EOF;
@@ -3124,7 +3128,7 @@ get_a_record(char **out,        /* pointer to pointer to data */
 		amt_to_read = min(amt_to_read, SSIZE_MAX);
 #endif
 
-		iop->count = iop->read_func(iop->fd, iop->dataend, amt_to_read);
+		iop->count = iop->read_func(iop->public.fd, iop->dataend, amt_to_read);
 		if (iop->count == -1) {
 			*errcode = errno;
 			iop->flag |= IOP_AT_EOF;
@@ -3397,7 +3401,7 @@ get_read_timeout(IOBUF *iop)
 	long tmout = 0;
 
 	if (PROCINFO_node != NULL) {
-		const char *name = iop->name;
+		const char *name = iop->public.name;
 		NODE *val = NULL;
 		static NODE *full_idx = NULL;
 		static const char *last_name = NULL;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog   |   26 +++++++++++++++++++++++
 TODO.xgawk  |    5 +--
 awk.h       |   11 +--------
 ext.c       |    5 +---
 gawkapi.c   |    2 +-
 gawkapi.h   |   44 ++++++++-------------------------------
 interpret.h |    2 +-
 io.c        |   66 +++++++++++++++++++++++++++++++---------------------------
 8 files changed, 77 insertions(+), 84 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Mon Jun 25 14:29:31 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SjE2V-0007tc-0B
	for mharc-gawk-diffs@gnu.org; Mon, 25 Jun 2012 14:29:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57867)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SjE2R-0007tL-BQ
	for gawk-diffs@gnu.org; Mon, 25 Jun 2012 14:29:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SjE2O-0000j6-Sl
	for gawk-diffs@gnu.org; Mon, 25 Jun 2012 14:29:26 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:59206)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SjE2O-0000j0-PA
	for gawk-diffs@gnu.org; Mon, 25 Jun 2012 14:29:24 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1SjE2K-0005wi-MO
	for gawk-diffs@gnu.org; Mon, 25 Jun 2012 18:29:24 +0000
Date: Mon, 25 Jun 2012 18:29:23 +0000
Message-Id: <E1SjE2K-0005wi-MO@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 6139211362667682c3022a72321e0cd8945b6592
X-Git-Newrev: 93e689fa83ef9a78f2bdfa093af31fcecb429d58
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 93e689fa83ef9a78f2bdfa093af31fcecb429d58
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 25 Jun 2012 18:29:29 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  93e689fa83ef9a78f2bdfa093af31fcecb429d58 (commit)
      from  6139211362667682c3022a72321e0cd8945b6592 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=93e689fa83ef9a78f2bdfa093af31fcecb429d58

commit 93e689fa83ef9a78f2bdfa093af31fcecb429d58
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Mon Jun 25 21:28:29 2012 +0300

    Fix lint checking for extension functions.

diff --git a/ChangeLog b/ChangeLog
index 0043aaf..8b5e241 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-06-25         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* TODO.xgawk: Updated.
+	* awk.h (track_ext_func): Declared.
+	* awkgram.y (enum defref): Add option for extension function.
+	(struct fdesc): Add member for extension function.
+	(func_use): Handle extension function, mark as extension and defined.
+	(track_ext_func): New function.
+	(check_funcs): Update logic for extension functions.
+	* ext.c (make_builtin): Call track_ext_func.
+
 2012-06-24         Andrew J. Schorr     <aschorr@telemetry-investments.com>
 
 	* TODO.xgawk: Most of IOBUF has been hidden.
diff --git a/TODO.xgawk b/TODO.xgawk
index 3ea2029..6e14929 100644
--- a/TODO.xgawk
+++ b/TODO.xgawk
@@ -56,25 +56,10 @@ hosting for these projects:
 
 Low priority:
 
-- Fix extension/rwarray.c.  It does not currently compile due to changes
-  in the NODE structure relating to array support.  The MPFR changes will
-  also make this more complicated.  John is best equipped to solve this
-  problem.
-
 - Enhance extension/fork.c waitpid to allow the caller to specify the options.
   And add an optional array argument to wait and waitpid in which to return
   exit status information.
 
-- Fix lint complaints about shared library functions being called without
-  having been defined.  For example, try:
-     gawk --lint -lordchr 'BEGIN {print chr(65)}'
-     gawk: warning: function `chr' called but never defined
-     A
-  In ext.c, make_builtin needs to call awkgram.y:func_use.  If done naively,
-  I think this would result in complaints about shared library functions
-  defined but not used.  So there should probably be an enhancement to func_use
-  and ftable to indicate if it's a shared library function.
-
 
 Possible future changes requiring (further) discussion:
 
@@ -159,3 +144,15 @@ Done:
    unless called by the "extension" function that nobody uses.
 
 - Hide private parts of IOBUF from extensions.
+
+- Fix extension/rwarray.c.
+
+- Fix lint complaints about shared library functions being called without
+  having been defined.  For example, try:
+     gawk --lint -lordchr 'BEGIN {print chr(65)}'
+     gawk: warning: function `chr' called but never defined
+     A
+  In ext.c, make_builtin needs to call awkgram.y:func_use.  If done naively,
+  I think this would result in complaints about shared library functions
+  defined but not used.  So there should probably be an enhancement to func_use
+  and ftable to indicate if it's a shared library function.
diff --git a/awk.h b/awk.h
index a2e0e39..f08d7d9 100644
--- a/awk.h
+++ b/awk.h
@@ -1406,6 +1406,7 @@ extern unsigned long (*hash)(const char *s, size_t len, unsigned long hsize, siz
 /* awkgram.c */
 extern NODE *variable(int location, char *name, NODETYPE type);
 extern int parse_program(INSTRUCTION **pcode);
+extern void track_ext_func(const char *name);
 extern void dump_funcs(void);
 extern void dump_vars(const char *fname);
 extern const char *getfname(NODE *(*)(int));
diff --git a/awkgram.c b/awkgram.c
index a454b0c..104c554 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -120,7 +120,7 @@ static int count_expressions(INSTRUCTION **list, bool isarg);
 static INSTRUCTION *optimize_assignment(INSTRUCTION *exp);
 static void add_lint(INSTRUCTION *list, LINTTYPE linttype);
 
-enum defref { FUNC_DEFINE, FUNC_USE };
+enum defref { FUNC_DEFINE, FUNC_USE, FUNC_EXT };
 static void func_use(const char *name, enum defref how);
 static void check_funcs(void);
 
@@ -6937,6 +6937,7 @@ static struct fdesc {
 	char *name;
 	short used;
 	short defined;
+	short extension;
 	struct fdesc *next;
 } *ftable[HASHSIZE];
 
@@ -6956,7 +6957,10 @@ func_use(const char *name, enum defref how)
 		if (strcmp(fp->name, name) == 0) {
 			if (how == FUNC_DEFINE)
 				fp->defined++;
-			else
+			else if (how == FUNC_EXT) {
+				fp->defined++;
+				fp->extension++;
+			} else
 				fp->used++;
 			return;
 		}
@@ -6970,12 +6974,23 @@ func_use(const char *name, enum defref how)
 	strcpy(fp->name, name);
 	if (how == FUNC_DEFINE)
 		fp->defined++;
-	else
+	else if (how == FUNC_EXT) {
+		fp->defined++;
+		fp->extension++;
+	} else
 		fp->used++;
 	fp->next = ftable[ind];
 	ftable[ind] = fp;
 }
 
+/* track_ext_func --- add an extension function to the table */
+
+void
+track_ext_func(const char *name)
+{
+	func_use(name, FUNC_EXT);
+}
+
 /* check_funcs --- verify functions that are called but not defined */
 
 static void
@@ -6989,19 +7004,19 @@ check_funcs()
  
 	for (i = 0; i < HASHSIZE; i++) {
 		for (fp = ftable[i]; fp != NULL; fp = fp->next) {
+			if (fp->defined == 0 && ! fp->extension) {
 #ifdef REALLYMEAN
-			/* making this the default breaks old code. sigh. */
-			if (fp->defined == 0) {
+				/* making this the default breaks old code. sigh. */
 				error(
 		_("function `%s' called but never defined"), fp->name);
 				errcount++;
-			}
 #else
-			if (do_lint && fp->defined == 0)
 				lintwarn(
 		_("function `%s' called but never defined"), fp->name);
 #endif
-			if (do_lint && fp->used == 0) {
+			}
+
+			if (do_lint && fp->used == 0 && ! fp->extension) {
 				lintwarn(_("function `%s' defined but never called directly"),
 					fp->name);
 			}
diff --git a/awkgram.y b/awkgram.y
index 7949829..eed0693 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -76,7 +76,7 @@ static int count_expressions(INSTRUCTION **list, bool isarg);
 static INSTRUCTION *optimize_assignment(INSTRUCTION *exp);
 static void add_lint(INSTRUCTION *list, LINTTYPE linttype);
 
-enum defref { FUNC_DEFINE, FUNC_USE };
+enum defref { FUNC_DEFINE, FUNC_USE, FUNC_EXT };
 static void func_use(const char *name, enum defref how);
 static void check_funcs(void);
 
@@ -4217,6 +4217,7 @@ static struct fdesc {
 	char *name;
 	short used;
 	short defined;
+	short extension;
 	struct fdesc *next;
 } *ftable[HASHSIZE];
 
@@ -4236,7 +4237,10 @@ func_use(const char *name, enum defref how)
 		if (strcmp(fp->name, name) == 0) {
 			if (how == FUNC_DEFINE)
 				fp->defined++;
-			else
+			else if (how == FUNC_EXT) {
+				fp->defined++;
+				fp->extension++;
+			} else
 				fp->used++;
 			return;
 		}
@@ -4250,12 +4254,23 @@ func_use(const char *name, enum defref how)
 	strcpy(fp->name, name);
 	if (how == FUNC_DEFINE)
 		fp->defined++;
-	else
+	else if (how == FUNC_EXT) {
+		fp->defined++;
+		fp->extension++;
+	} else
 		fp->used++;
 	fp->next = ftable[ind];
 	ftable[ind] = fp;
 }
 
+/* track_ext_func --- add an extension function to the table */
+
+void
+track_ext_func(const char *name)
+{
+	func_use(name, FUNC_EXT);
+}
+
 /* check_funcs --- verify functions that are called but not defined */
 
 static void
@@ -4269,19 +4284,19 @@ check_funcs()
  
 	for (i = 0; i < HASHSIZE; i++) {
 		for (fp = ftable[i]; fp != NULL; fp = fp->next) {
+			if (fp->defined == 0 && ! fp->extension) {
 #ifdef REALLYMEAN
-			/* making this the default breaks old code. sigh. */
-			if (fp->defined == 0) {
+				/* making this the default breaks old code. sigh. */
 				error(
 		_("function `%s' called but never defined"), fp->name);
 				errcount++;
-			}
 #else
-			if (do_lint && fp->defined == 0)
 				lintwarn(
 		_("function `%s' called but never defined"), fp->name);
 #endif
-			if (do_lint && fp->used == 0) {
+			}
+
+			if (do_lint && fp->used == 0 && ! fp->extension) {
 				lintwarn(_("function `%s' defined but never called directly"),
 					fp->name);
 			}
diff --git a/ext.c b/ext.c
index 14d55c5..af6542d 100644
--- a/ext.c
+++ b/ext.c
@@ -123,6 +123,7 @@ make_builtin(const awk_ext_func_t *funcinfo)
 
        	symbol = install_symbol(estrdup(name, strlen(name)), Node_ext_func);
 	symbol->code_ptr = b;
+	track_ext_func(name);
 	return true;
 }
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog  |   11 +++++++++++
 TODO.xgawk |   27 ++++++++++++---------------
 awk.h      |    1 +
 awkgram.c  |   31 +++++++++++++++++++++++--------
 awkgram.y  |   31 +++++++++++++++++++++++--------
 ext.c      |    1 +
 6 files changed, 71 insertions(+), 31 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Mon Jun 25 15:06:21 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SjEc9-0006r7-7l
	for mharc-gawk-diffs@gnu.org; Mon, 25 Jun 2012 15:06:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56150)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SjEc5-0006qu-Ob
	for gawk-diffs@gnu.org; Mon, 25 Jun 2012 15:06:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SjEc2-0001fG-GL
	for gawk-diffs@gnu.org; Mon, 25 Jun 2012 15:06:17 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:58675)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SjEc2-0001ew-CT
	for gawk-diffs@gnu.org; Mon, 25 Jun 2012 15:06:14 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1SjEc0-0007qZ-4g
	for gawk-diffs@gnu.org; Mon, 25 Jun 2012 19:06:13 +0000
Date: Mon, 25 Jun 2012 19:06:12 +0000
Message-Id: <E1SjEc0-0007qZ-4g@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 93e689fa83ef9a78f2bdfa093af31fcecb429d58
X-Git-Newrev: 2d0d82f7453b1c5ad5e1baa8c02c2f6d5e5ccb67
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 2d0d82f7453b1c5ad5e1baa8c02c2f6d5e5ccb67
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 25 Jun 2012 19:06:20 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  2d0d82f7453b1c5ad5e1baa8c02c2f6d5e5ccb67 (commit)
       via  7642bd16ac81fbf85247ab2b5768cb6b316c8419 (commit)
      from  93e689fa83ef9a78f2bdfa093af31fcecb429d58 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=2d0d82f7453b1c5ad5e1baa8c02c2f6d5e5ccb67

commit 2d0d82f7453b1c5ad5e1baa8c02c2f6d5e5ccb67
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Mon Jun 25 22:05:42 2012 +0300

    Add rwarray to extension tests.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index 9d4305c..a1ba2e9 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-25         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* Makefile.am (EXTRA_DIST): Remove *.awk.
+	* rwarray.awk: Moved to test directory.
+
 2012-06-24         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* Makefile.am: Enable rwarray extension.
diff --git a/extension/Makefile.am b/extension/Makefile.am
index 767c2ab..5c6532b 100644
--- a/extension/Makefile.am
+++ b/extension/Makefile.am
@@ -59,5 +59,4 @@ testext_la_LDFLAGS    = $(MY_MODULE_FLAGS)
 
 EXTRA_DIST = \
 	ChangeLog \
-	ChangeLog.0 \
-	*.awk
+	ChangeLog.0
diff --git a/extension/Makefile.in b/extension/Makefile.in
index 5666c9d..1747bcd 100644
--- a/extension/Makefile.in
+++ b/extension/Makefile.in
@@ -364,8 +364,7 @@ testext_la_SOURCES = testext.c
 testext_la_LDFLAGS = $(MY_MODULE_FLAGS)
 EXTRA_DIST = \
 	ChangeLog \
-	ChangeLog.0 \
-	*.awk
+	ChangeLog.0
 
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
diff --git a/test/ChangeLog b/test/ChangeLog
index 6d36310..a0f7a64 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-25         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* Makefile.am (rwarray): New test.
+	* rwarray.awk, rwarray.in, rwarray.ok: New files.
+
 2012-06-21         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* testext.ok: Update contents.
diff --git a/test/Makefile.am b/test/Makefile.am
index c520b72..58fddfc 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -689,6 +689,9 @@ EXTRA_DIST = \
 	rtlen.sh \
 	rtlen01.ok \
 	rtlen01.sh \
+	rwarray.awk \
+	rwarray.in \
+	rwarray.ok \
 	scalar.awk \
 	scalar.ok \
 	sclforin.awk \
@@ -885,7 +888,9 @@ LOCALE_CHARSET_TESTS = \
 	asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \
 	mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc
 
-SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs testext time
+SHLIB_TESTS = \
+	filefuncs fork fork2 ordchr ordchr2 readfile rwarray \
+	testext time
 
 # List of the tests which should be run with --lint option:
 NEED_LINT = \
diff --git a/test/Makefile.in b/test/Makefile.in
index 57ccbd9..3e170f8 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -901,6 +901,9 @@ EXTRA_DIST = \
 	rtlen.sh \
 	rtlen01.ok \
 	rtlen01.sh \
+	rwarray.awk \
+	rwarray.in \
+	rwarray.ok \
 	scalar.awk \
 	scalar.ok \
 	sclforin.awk \
@@ -1093,7 +1096,10 @@ LOCALE_CHARSET_TESTS = \
 	asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \
 	mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc
 
-SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs testext time
+SHLIB_TESTS = \
+	filefuncs fork fork2 ordchr ordchr2 readfile rwarray \
+	testext time
+
 
 # List of the tests which should be run with --lint option:
 NEED_LINT = \
@@ -3168,7 +3174,7 @@ sprintfc:
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
-ordchr:
+filefuncs:
 	@echo $@
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
@@ -3183,11 +3189,16 @@ fork2:
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
-filefuncs:
+ordchr:
 	@echo $@
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
+rwarray:
+	@echo $@
+	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
 time:
 	@echo $@
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 64cd8e7..b10e175 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1199,7 +1199,7 @@ sprintfc:
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
-ordchr:
+filefuncs:
 	@echo $@
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
@@ -1214,11 +1214,16 @@ fork2:
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
-filefuncs:
+ordchr:
 	@echo $@
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
 	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
+rwarray:
+	@echo $@
+	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+	@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
 time:
 	@echo $@
 	@AWKPATH=$(srcdir) $(AWK) -f $@.awk  >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/extension/rwarray.awk b/test/rwarray.awk
similarity index 100%
rename from extension/rwarray.awk
rename to test/rwarray.awk
diff --git a/test/rwarray.in b/test/rwarray.in
new file mode 100644
index 0000000..aff8830
--- /dev/null
+++ b/test/rwarray.in
@@ -0,0 +1,780 @@
+a
+aardvark
+aardvark's
+aardvarks
+abaci
+aback
+abacus
+abacus's
+abacuses
+abaft
+abalone
+abalone's
+abalones
+abandon
+abandoned
+abandoning
+abandonment
+abandonment's
+abandons
+abase
+abased
+abasement
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+b
+baa
+baaed
+baaing
+baas
+babble
+babbled
+babbler
+babbler's
+babblers
+babbles
+babbling
+babe
+babe's
+babel
+babels
+babes
+babied
+babier
+babies
+babiest
+baboon
+baboon's
+baboons
+babushka
+babushka's
+babushkas
+baby
+baby's
+babyhood
+c
+cab
+cab's
+cabal
+cabal's
+cabals
+cabana
+cabana's
+cabanas
+cabaret
+cabaret's
+cabarets
+cabbage
+cabbage's
+cabbages
+cabbed
+cabbie
+cabbies
+cabbing
+cabby
+cabby's
+cabin
+cabin's
+cabinet
+cabinet's
+cabinetmaker
+cabinetmaker's
+cabinetmakers
+cabinets
+cabins
+d
+d'arezzo
+d'estaing
+dab
+dabbed
+dabbing
+dabble
+dabbled
+dabbler
+dabbler's
+dabblers
+dabbles
+dabbling
+dabs
+dacha
+dacha's
+dachas
+dachshund
+dachshund's
+dachshunds
+dactyl
+dactyl's
+dactylic
+dactylics
+dactyls
+dad
+dad's
+daddies
+db
+db's
+e
+e'er
+each
+eager
+eager's
+eagerer
+eagerest
+eagerly
+eagerness
+eagerness's
+eagle
+eagle's
+eagles
+eaglet
+eaglet's
+eaglets
+ear
+ear's
+earache
+earache's
+earaches
+eardrum
+eardrum's
+eardrums
+earful
+earful's
+earfuls
+earl
+ebay
+ebay's
+f
+fa
+fa's
+fable
+fable's
+fabled
+fables
+fabric
+fabric's
+fabricate
+fabricated
+fabricates
+fabricating
+fabrication
+fabrication's
+fabrications
+fabrics
+fabulous
+fabulously
+facade
+facade's
+facades
+face
+face's
+faced
+faceless
+facelift
+facelifts
+faces
+facet
+g
+gab
+gabardine
+gabardine's
+gabardines
+gabbed
+gabbier
+gabbiest
+gabbing
+gabble
+gabbled
+gabbles
+gabbling
+gabby
+gaberdine
+gaberdine's
+gaberdines
+gable
+gable's
+gabled
+gables
+gabling
+gabs
+gad
+gadabout
+gadabout's
+gadabouts
+gadded
+gadding
+gadflies
+h
+h'm
+ha
+haberdasher
+haberdasher's
+haberdasheries
+haberdashers
+haberdashery
+haberdashery's
+habit
+habit's
+habitability
+habitability's
+habitable
+habitat
+habitat's
+habitation
+habitation's
+habitations
+habitats
+habits
+habitual
+habitually
+habituals
+habituate
+habituated
+habituates
+habituating
+habituation
+habituation's
+i
+iamb
+iamb's
+iambic
+iambics
+iambs
+ibex
+ibex's
+ibexes
+ibices
+ibis
+ibis's
+ibises
+ibuprofen
+ice
+ice's
+iceberg
+iceberg's
+icebergs
+icebound
+icebox
+icebox's
+iceboxes
+icebreaker
+icebreaker's
+icebreakers
+icecap
+icecap's
+icecaps
+iced
+j
+jab
+jabbed
+jabber
+jabbered
+jabberer
+jabberer's
+jabberers
+jabbering
+jabbers
+jabbing
+jabot
+jabot's
+jabots
+jabs
+jack
+jack's
+jackal
+jackal's
+jackals
+jackass
+jackass's
+jackasses
+jackboot
+jackboot's
+jackboots
+jackdaw
+jackdaw's
+jackdaws
+jacked
+k
+kabob
+kabob's
+kabobs
+kaboom
+kale
+kale's
+kaleidoscope
+kaleidoscope's
+kaleidoscopes
+kaleidoscopic
+kamikaze
+kamikaze's
+kamikazes
+kangaroo
+kangaroo's
+kangarooed
+kangarooing
+kangaroos
+kaolin
+kaolin's
+kapok
+kapok's
+kaput
+kaput's
+karakul
+karakul's
+khz
+khz's
+kw
+l
+la
+la's
+lab
+lab's
+label
+label's
+labeled
+labeling
+labelled
+labelling
+labels
+labia
+labia's
+labial
+labials
+labium
+labor
+labor's
+laboratories
+laboratory
+laboratory's
+labored
+laborer
+laborer's
+laborers
+laboring
+laborious
+laboriously
+labors
+m
+ma
+ma'am
+ma's
+macabre
+macadam
+macadam's
+macaroni
+macaroni's
+macaroon
+macaroon's
+macaroons
+macaw
+macaw's
+macaws
+mace
+mace's
+maced
+macerate
+macerated
+macerates
+macerating
+maceration
+maceration's
+maces
+machete
+machete's
+machetes
+machination
+machination's
+n
+nab
+nabbed
+nabbing
+nabob
+nabob's
+nabobs
+nabs
+nacho
+nachos
+nacre
+nacre's
+nadir
+nadir's
+nadirs
+nag
+nagged
+nagging
+nags
+naiad
+naiad's
+naiades
+naiads
+nail
+nail's
+nailbrush
+nailbrush's
+nailbrushes
+nailed
+nailing
+o
+o'clock
+o'er
+oaf
+oaf's
+oafish
+oafs
+oak
+oak's
+oaken
+oaks
+oakum
+oakum's
+oar
+oar's
+oared
+oaring
+oarlock
+oarlock's
+oarlocks
+oars
+oarsman
+oarsman's
+oarsmen
+oases
+oasis
+oasis's
+oat
+oat's
+oaten
+p
+pa
+pa's
+pace
+pace's
+paced
+pacemaker
+pacemaker's
+pacemakers
+paces
+pacesetter
+pacesetter's
+pacesetters
+pachyderm
+pachyderm's
+pachyderms
+pacific
+pacifically
+pacification
+pacification's
+pacified
+pacifier
+pacifier's
+pacifiers
+pacifies
+pacifism
+pacifism's
+pacifist
+ph
+ph's
+q
+qua
+quack
+quacked
+quackery
+quackery's
+quacking
+quacks
+quad
+quad's
+quadrangle
+quadrangle's
+quadrangles
+quadrangular
+quadrangular's
+quadrant
+quadrant's
+quadrants
+quadraphonic
+quadraphonics
+quadratic
+quadratic's
+quadrature
+quadrature's
+quadrennial
+quadriceps
+quadriceps's
+quadricepses
+quadrilateral
+quadrilaterals
+r
+rabbi
+rabbi's
+rabbies
+rabbinate
+rabbinate's
+rabbinical
+rabbis
+rabbit
+rabbit's
+rabbited
+rabbiting
+rabbits
+rabble
+rabble's
+rabbles
+rabid
+rabies
+raccoon
+raccoon's
+raccoons
+race
+race's
+racecourse
+racecourse's
+racecourses
+raced
+racehorse
+racehorse's
+racehorses
+s
+sabbatical
+sabbaticals
+saber
+saber's
+sabers
+sable
+sable's
+sabled
+sables
+sabling
+sabotage
+sabotage's
+sabotaged
+sabotages
+sabotaging
+saboteur
+saboteur's
+saboteurs
+sabre
+sabres
+sac
+sac's
+saccharin
+saccharin's
+saccharine
+sacerdotal
+sachem
+sachem's
+sachems
+t
+tab
+tab's
+tabbed
+tabbies
+tabbing
+tabby
+tabernacle
+tabernacle's
+tabernacles
+table
+table's
+tableau
+tableau's
+tableaus
+tableaux
+tablecloth
+tablecloth's
+tablecloths
+tabled
+tableland
+tableland's
+tablelands
+tables
+tablespoon
+tablespoon's
+tablespoonful
+tablespoonful's
+tablespoonfuls
+tablespoons
+u
+ubiquitous
+ubiquitously
+ubiquity
+udder
+udder's
+udders
+ugh
+uglied
+uglier
+uglies
+ugliest
+ugliness
+ugliness's
+ugly
+uglying
+uh
+ukulele
+ukulele's
+ukuleles
+ulcer
+ulcer's
+ulcerate
+ulcerated
+ulcerates
+ulcerating
+ulceration
+ulceration's
+ulcered
+ulcering
+v
+vacancies
+vacancy
+vacancy's
+vacant
+vacantly
+vacate
+vacated
+vacates
+vacating
+vacation
+vacation's
+vacationed
+vacationer
+vacationers
+vacationing
+vacations
+vaccinate
+vaccinated
+vaccinates
+vaccinating
+vaccination
+vaccination's
+vaccinations
+vaccine
+vaccine's
+vaccines
+vacillate
+vacillated
+vacillates
+w
+wackes
+wackier
+wackiest
+wackiness
+wackiness's
+wacko
+wackos
+wacky
+wad
+wad's
+wadded
+wadding
+wadding's
+waddle
+waddled
+waddles
+waddling
+wade
+waded
+wader
+wader's
+waders
+wades
+wadi
+wadi's
+wadies
+wading
+wadis
+wads
+x
+xenon
+xenon's
+xenophobia
+xenophobia's
+xenophobic
+xenophon's
+xerographic
+xerography
+xerography's
+xerox
+xerox's
+xeroxed
+xeroxes
+xeroxing
+xerxes
+xerxes's
+xhosa
+xhosa's
+xi'an
+xiaoping
+xiaoping's
+xingu
+xylem
+xylem's
+xylophone
+xylophone's
+xylophones
+xylophonist
+xylophonists
+y
+y'all
+ya
+yacht
+yacht's
+yachted
+yachting
+yachting's
+yachts
+yachtsman
+yachtsmen
+yahoo
+yahoo's
+yahoos
+yak
+yak's
+yakked
+yakking
+yaks
+yam
+yam's
+yammer
+yammered
+yammering
+yammers
+yams
+yank
+yanked
+yanking
+yanks
+z
+zanied
+zanier
+zanies
+zaniest
+zaniness
+zaniness's
+zany
+zanying
+zap
+zapped
+zapping
+zaps
+zeal
+zeal's
+zealot
+zealot's
+zealots
+zealous
+zealously
+zealousness
+zealousness's
+zebra
+zebra's
+zebras
+zebu
+zebu's
+zebus
+zed
+zed's
diff --git a/test/rwarray.ok b/test/rwarray.ok
new file mode 100644
index 0000000..8392135
--- /dev/null
+++ b/test/rwarray.ok
@@ -0,0 +1,3 @@
+writea() returned 1, expecting 1
+reada() returned 1, expecting 1
+old and new are equal - GOOD

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=7642bd16ac81fbf85247ab2b5768cb6b316c8419

commit 7642bd16ac81fbf85247ab2b5768cb6b316c8419
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Mon Jun 25 21:59:14 2012 +0300

    Make rwarray.awk read regular input.

diff --git a/extension/rwarray.awk b/extension/rwarray.awk
index b34a42a..5d1b7e9 100644
--- a/extension/rwarray.awk
+++ b/extension/rwarray.awk
@@ -1,7 +1,7 @@
 @load "rwarray"
 
 BEGIN {
-	while ((getline word < "/usr/share/dict/words") > 0)
+	while ((getline word) > 0)
 		dict[word] = word word
 
 	n = asorti(dict, dictindices)

-----------------------------------------------------------------------

Summary of changes:
 extension/ChangeLog             |    5 +
 extension/Makefile.am           |    3 +-
 extension/Makefile.in           |    3 +-
 test/ChangeLog                  |    5 +
 test/Makefile.am                |    7 +-
 test/Makefile.in                |   17 +-
 test/Maketests                  |    9 +-
 {extension => test}/rwarray.awk |    2 +-
 test/rwarray.in                 |  780 +++++++++++++++++++++++++++++++++++++++
 test/rwarray.ok                 |    3 +
 10 files changed, 823 insertions(+), 11 deletions(-)
 rename {extension => test}/rwarray.awk (93%)
 create mode 100644 test/rwarray.in
 create mode 100644 test/rwarray.ok


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Thu Jun 28 10:38:33 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SkFrd-0004vq-GM
	for mharc-gawk-diffs@gnu.org; Thu, 28 Jun 2012 10:38:33 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37651)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SkFrR-0004vD-D3
	for gawk-diffs@gnu.org; Thu, 28 Jun 2012 10:38:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SkFrL-00009e-14
	for gawk-diffs@gnu.org; Thu, 28 Jun 2012 10:38:20 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:55428)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SkFrK-00009S-Ts
	for gawk-diffs@gnu.org; Thu, 28 Jun 2012 10:38:14 -0400
Received: from ajschorr by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1SkFrJ-0000Ot-Dg
	for gawk-diffs@gnu.org; Thu, 28 Jun 2012 14:38:14 +0000
Date: Thu, 28 Jun 2012 14:38:14 +0000
Message-Id: <E1SkFrJ-0000Ot-Dg@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 2d0d82f7453b1c5ad5e1baa8c02c2f6d5e5ccb67
X-Git-Newrev: 47828911ae88038eda1051cfa2232f46eda95fd8
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 47828911ae88038eda1051cfa2232f46eda95fd8
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 28 Jun 2012 14:38:31 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  47828911ae88038eda1051cfa2232f46eda95fd8 (commit)
      from  2d0d82f7453b1c5ad5e1baa8c02c2f6d5e5ccb67 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=47828911ae88038eda1051cfa2232f46eda95fd8

commit 47828911ae88038eda1051cfa2232f46eda95fd8
Author: Andrew J. Schorr <aschorr@telemetry-investments.com>
Date:   Thu Jun 28 10:37:36 2012 -0400

    Protect against race condition in test/time.awk.

diff --git a/test/ChangeLog b/test/ChangeLog
index a0f7a64..057434f 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-28         Andrew J. Schorr     <aschorr@telemetry-investments.com>
+
+	* time.awk: Avoid possibly throwing a spurious error by protecting
+	a race condition that depends on the order of expression evaluation.
+
 2012-06-25         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* Makefile.am (rwarray): New test.
diff --git a/test/time.awk b/test/time.awk
index eeabc7b..517377e 100644
--- a/test/time.awk
+++ b/test/time.awk
@@ -1,10 +1,20 @@
 @load "time"
 
+# make sure gettimeofday() is consistent with systime().  We must call
+# gettimeofday() before systime() to make sure the subtraction gives 0
+# without risk of rolling over to the next second.
+function timecheck(st,res) {
+   res = gettimeofday()
+   st = systime()
+   printf "gettimeofday - systime = %d\n", res-st
+   return res
+}
+
 BEGIN {
    delta = 1.3
-   printf "gettimeofday - systime = %d\n", (t0 = gettimeofday())-systime()
+   t0 = timecheck()
    printf "sleep(%s) = %s\n",delta,sleep(delta)
-   printf "gettimeofday - systime = %d\n", (t1 = gettimeofday())-systime()
+   t1 = timecheck()
    slept = t1-t0
    if ((slept < 0.9*delta) || (slept > 1.3*delta))
       printf "Warning: tried to sleep %.2f secs, but slept for %.2f secs\n",

-----------------------------------------------------------------------

Summary of changes:
 test/ChangeLog |    5 +++++
 test/time.awk  |   14 ++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Fri Jun 29 05:57:34 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SkXxG-0002nY-9v
	for mharc-gawk-diffs@gnu.org; Fri, 29 Jun 2012 05:57:34 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44116)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SkXx9-0002nC-Fk
	for gawk-diffs@gnu.org; Fri, 29 Jun 2012 05:57:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SkXx7-00056C-65
	for gawk-diffs@gnu.org; Fri, 29 Jun 2012 05:57:27 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:54462)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SkXx7-000568-2l
	for gawk-diffs@gnu.org; Fri, 29 Jun 2012 05:57:25 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1SkXx5-0001Ra-Q7
	for gawk-diffs@gnu.org; Fri, 29 Jun 2012 09:57:24 +0000
Date: Fri, 29 Jun 2012 09:57:24 +0000
Message-Id: <E1SkXx5-0001Ra-Q7@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/extgawk
X-Git-Reftype: branch
X-Git-Oldrev: 47828911ae88038eda1051cfa2232f46eda95fd8
X-Git-Newrev: 518bcc6e640648717bc5512d3fd5c2bf16d6fec3
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, extgawk,
	updated. 518bcc6e640648717bc5512d3fd5c2bf16d6fec3
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Jun 2012 09:57:32 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  518bcc6e640648717bc5512d3fd5c2bf16d6fec3 (commit)
       via  33734338e34ed4588ca05cecd5324d5ab5a1a654 (commit)
      from  47828911ae88038eda1051cfa2232f46eda95fd8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=518bcc6e640648717bc5512d3fd5c2bf16d6fec3

commit 518bcc6e640648717bc5512d3fd5c2bf16d6fec3
Merge: 3373433 4782891
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Fri Jun 29 12:56:05 2012 +0300

    Merge branch 'extgawk' of ssh://git.sv.gnu.org/srv/git/gawk into extgawk


http://git.sv.gnu.org/cgit/gawk.git/commit/?id=33734338e34ed4588ca05cecd5324d5ab5a1a654

commit 33734338e34ed4588ca05cecd5324d5ab5a1a654
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Fri Jun 29 12:55:37 2012 +0300

    Minor improvements in doc and in ordchr.c.

diff --git a/ChangeLog b/ChangeLog
index 8b5e241..f6086c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-29         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* gawkapi.h: Improve the documentation of the return values
+	per Andrew Schorr.
+
 2012-06-25         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* TODO.xgawk: Updated.
diff --git a/extension/ChangeLog b/extension/ChangeLog
index a1ba2e9..a0cc713 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-29         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* ordchr.c (do_ord, do_chr): Improve argument checking and
+	lint messages.
+
 2012-06-25         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* Makefile.am (EXTRA_DIST): Remove *.awk.
diff --git a/extension/ordchr.c b/extension/ordchr.c
index ba29d13..8d7eac8 100644
--- a/extension/ordchr.c
+++ b/extension/ordchr.c
@@ -61,8 +61,12 @@ do_ord(int nargs, awk_value_t *result)
 
 	if (get_argument(0, AWK_STRING, & str)) {
 		ret = str.str_value.str[0];
-	} else if (do_lint)
-		lintwarn(ext_id, "ord: called with no arguments");
+	} else if (do_lint) {
+		if (nargs == 0)
+			lintwarn(ext_id, "ord: called with no arguments");
+		else
+			lintwarn(ext_id, "ord: called with inappropriate argument(s)");
+	}
 
 	/* Set the return value */
 	return make_number(ret, result);
@@ -91,8 +95,12 @@ do_chr(int nargs, awk_value_t *result)
 		ret &= 0xff;
 		str[0] = ret;
 		str[1] = '\0';
-	} else if (do_lint)
-		lintwarn(ext_id, "chr: called with no arguments");
+	} else if (do_lint) {
+		if (nargs == 0)
+			lintwarn(ext_id, "chr: called with no arguments");
+		else
+			lintwarn(ext_id, "chr: called with inappropriate argument(s)");
+	}
 
 	/* Set the return value */
 	return dup_string(str, 1, result);
diff --git a/gawkapi.h b/gawkapi.h
index 1954a5e..10f1e0c 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -190,7 +190,10 @@ typedef struct gawk_api {
 #define gawk_do_mpfr		5
 
 	/*
-	 * Get the count'th paramater, zero-based.
+	 * All of the functions that return a value from inside gawk
+	 * (get a parameter, get a global variable, get an array element)
+	 * behave in the same way.
+	 *
 	 * Returns false if count is out of range, or if actual paramater
 	 * does not match what is specified in wanted. In that case,
 	 * result->val_type will hold the actual type of what was passed.
@@ -202,14 +205,25 @@ typedef struct gawk_api {
 	                      +----------+----------+-------+-----------+
 	                      |  String  |  Number  | Array | Undefined |
 	+---------+-----------+----------+----------+-------+-----------+
-	| Type    | String    |  String  |   false  | false |   String  |
+	| Type    | String    |  String  | Number if| false |   String  |
+	|         |           |          | it can be|       |           |
+	|         |           |          |converted,|       |           |
+	|         |           |          |   else   |       |           |
+	|         |           |          |   false  |       |           |
 	| of      +-----------+----------+----------+-------+-----------+
-	| Actual  | Number    |   false  |  Number  | false |   Number  |
+	| Actual  | Number    |  String  |  Number  | false |   Number  |
 	| Value:  +-----------+----------+----------+-------+-----------+
 	|         | Array     |   false  |   false  | Array |   Array   |
 	|         +-----------+----------+----------+-------+-----------+
 	|         | Undefined |   false  |   false  | false | Undefined |
 	+---------+-----------+----------+----------+-------+-----------+
+	*/
+
+	/*
+	 * Get the count'th paramater, zero-based.
+	 * Returns false if count is out of range, or if actual paramater
+	 * does not match what is specified in wanted. In that case,
+	 * result->val_type is as described above.
 	 */
 	awk_bool_t (*get_argument)(awk_ext_id_t id, size_t count,
 					  awk_valtype_t wanted,
@@ -258,8 +272,9 @@ typedef struct gawk_api {
 	/*
 	 * Lookup a variable, fills in value. No messing with the value
 	 * returned. Returns false if the variable doesn't exist
-	 * or the wrong type was requested.
-	 * In the latter case, fills in vaule->val_type with the real type.
+	 * or if the wrong type was requested.
+	 * In the latter case, fills in vaule->val_type with the real type,
+	 * as described above.
 	 * Built-in variables (except PROCINFO) may not be accessed by an
 	 * extension.
 	 *

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    5 +++++
 extension/ChangeLog |    5 +++++
 extension/ordchr.c  |   16 ++++++++++++----
 gawkapi.h           |   25 ++++++++++++++++++++-----
 4 files changed, 42 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
gawk


From MAILER-DAEMON Fri Jun 29 06:40:02 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SkYcM-0006VF-Io
	for mharc-gawk-diffs@gnu.org; Fri, 29 Jun 2012 06:40:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33023)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SkYcF-0006Uu-FP
	for gawk-diffs@gnu.org; Fri, 29 Jun 2012 06:40:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SkYc8-0000WY-Vm
	for gawk-diffs@gnu.org; Fri, 29 Jun 2012 06:39:55 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:56246)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1SkYc8-0000WS-SJ
	for gawk-diffs@gnu.org; Fri, 29 Jun 2012 06:39:48 -0400
Received: from arnold by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <arnold@skeeve.com>) id 1SkYc7-0003AY-VL
	for gawk-diffs@gnu.org; Fri, 29 Jun 2012 10:39:48 +0000
Date: Fri, 29 Jun 2012 10:39:48 +0000
Message-Id: <E1SkYc7-0003AY-VL@vcs.savannah.gnu.org>
To: gawk-diffs@gnu.org
X-Git-Refname: refs/heads/gawk-4.0-stable
X-Git-Reftype: branch
X-Git-Oldrev: 0b9dc23236f49d3e23a14900b1f34bb027fc3ba0
X-Git-Newrev: c494c33d585d0b7498b8e368434f60f2c107497f
From: Arnold Robbins <arnold@skeeve.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.0-stable,
	updated. c494c33d585d0b7498b8e368434f60f2c107497f
X-BeenThere: gawk-diffs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Commits to the source repository." <gawk-diffs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/gawk-diffs>
List-Post: <mailto:gawk-diffs@gnu.org>
List-Help: <mailto:gawk-diffs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-diffs>,
	<mailto:gawk-diffs-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Jun 2012 10:40:01 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-4.0-stable has been updated
       via  c494c33d585d0b7498b8e368434f60f2c107497f (commit)
      from  0b9dc23236f49d3e23a14900b1f34bb027fc3ba0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=c494c33d585d0b7498b8e368434f60f2c107497f

commit c494c33d585d0b7498b8e368434f60f2c107497f
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Fri Jun 29 13:39:26 2012 +0300

    Minor doc update w.r.t. mawk.

diff --git a/doc/ChangeLog b/doc/ChangeLog
index 8a1b004..56ec4ef 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-29         Arnold D. Robbins     <arnold@skeeve.com>
+
+	* gawk.texi, awkcard.in: Latest mawk understands /dev/stdin.
+
 2012-04-27         Arnold D. Robbins     <arnold@skeeve.com>
 
 	* gawk.texi: Add that -b affects output.
diff --git a/doc/awkcard.in b/doc/awkcard.in
index 22b4716..fa45fe3 100644
--- a/doc/awkcard.in
+++ b/doc/awkcard.in
@@ -1205,7 +1205,7 @@ The filenames are:
 expand;
 l lw(2i).
 \*(FC"\-"\fP	standard input
-\*(FC/dev/stdin\fP	standard input \*(CR(not \*(MK)\*(CD
+\*(FC/dev/stdin\fP	standard input
 \*(FC/dev/stdout\fP	standard output
 \*(FC/dev/stderr\fP	standard error output
 .TE
diff --git a/doc/gawk.info b/doc/gawk.info
index 397daab..5b063d7 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -20108,7 +20108,7 @@ Feature                      BWK Awk   Mawk   GNU Awk
 `\x' Escape sequence         X         X      X
 `RS' as regexp                         X      X
 `FS' as null string          X         X      X
-`/dev/stdin' special file    X                X
+`/dev/stdin' special file    X         X      X
 `/dev/stdout' special file   X         X      X
 `/dev/stderr' special file   X         X      X
 `**' and `**=' operators     X                X
diff --git a/doc/gawk.texi b/doc/gawk.texi
index b22f7ce..ba5ffa3 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -27001,7 +27001,7 @@ the three most widely-used freely available versions of @command{awk}
 @item @samp{\x} Escape sequence @tab X @tab X @tab X
 @item @code{RS} as regexp @tab @tab X @tab X
 @item @code{FS} as null string @tab X @tab X @tab X
-@item @file{/dev/stdin} special file @tab X @tab @tab X
+@item @file{/dev/stdin} special file @tab X @tab X @tab X
 @item @file{/dev/stdout} special file @tab X @tab X @tab X
 @item @file{/dev/stderr} special file @tab X @tab X @tab X
 @item @code{**} and @code{**=} operators @tab X @tab @tab X

-----------------------------------------------------------------------

Summary of changes:
 doc/ChangeLog  |    4 ++++
 doc/awkcard.in |    2 +-
 doc/gawk.info  |    2 +-
 doc/gawk.texi  |    2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
gawk


