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. 115d332143b1a9d23bbf57


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, extgawk, updated. 115d332143b1a9d23bbf57088a577e778dcf31f8
Date: Thu, 21 Jun 2012 19:34:47 +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 <address@hidden>
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 <address@hidden>
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     <address@hidden>
 
+       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     <address@hidden>
 
        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



reply via email to

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