[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, extgawk, updated. b0f08ac2443e239b0ed9cc
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, extgawk, updated. b0f08ac2443e239b0ed9cc4421758f0ed3f7a94f |
Date: |
Mon, 18 Jun 2012 18:15:08 +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 <address@hidden>
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 <address@hidden>
+
+ * Makefile.am (testext): New test.
+ (clean): Add testext.awk to the list.
+ * testext.ok: New file.
+
2012-06-12 Arnold D. Robbins <address@hidden>
* 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)/address@hidden _$@ && 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)/address@hidden _$@ && 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)/address@hidden _$@ && 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)/address@hidden _$@ && 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 <address@hidden>
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 <address@hidden>
+
+ * 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 <address@hidden>
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 <address@hidden>
+
+ * testext.c (test_array_elem): Add AWK_UNDEFINED for `wanted'.
+
2012-06-17 Arnold D. Robbins <address@hidden>
* 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, extgawk, updated. b0f08ac2443e239b0ed9cc4421758f0ed3f7a94f,
Arnold Robbins <=