gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, extgawk, updated. 518bcc6e640648717bc551


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, extgawk, updated. 518bcc6e640648717bc5512d3fd5c2bf16d6fec3
Date: Fri, 29 Jun 2012 09:57: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  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 <address@hidden>
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 <address@hidden>
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     <address@hidden>
+
+       * gawkapi.h: Improve the documentation of the return values
+       per Andrew Schorr.
+
 2012-06-25         Arnold D. Robbins     <address@hidden>
 
        * 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     <address@hidden>
+
+       * ordchr.c (do_ord, do_chr): Improve argument checking and
+       lint messages.
+
 2012-06-25         Arnold D. Robbins     <address@hidden>
 
        * 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]