"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ext.c" between
gawk-5.0.1.tar.xz and gawk-5.1.0.tar.xz

About: GNU awk - pattern scanning and processing language.

ext.c  (gawk-5.0.1.tar.xz):ext.c  (gawk-5.1.0.tar.xz)
/* /*
* ext.c - Builtin function that links external gawk functions and related * ext.c - Builtin function that links external gawk functions and related
* utilities. * utilities.
* *
* Christos Zoulas, Thu Jun 29 17:40:41 EDT 1995 * Christos Zoulas, Thu Jun 29 17:40:41 EDT 1995
* Arnold Robbins, update for 3.1, Mon Nov 23 12:53:39 EST 1998 * Arnold Robbins, update for 3.1, Mon Nov 23 12:53:39 EST 1998
*/ */
/* /*
* Copyright (C) 1995 - 2001, 2003-2014, 2016-2018, * Copyright (C) 1995 - 2001, 2003-2014, 2016-2020,
* the Free Software Foundation, Inc. * the Free Software Foundation, Inc.
* *
* This file is part of GAWK, the GNU implementation of the * This file is part of GAWK, the GNU implementation of the
* AWK Programming Language. * AWK Programming Language.
* *
* GAWK is free software; you can redistribute it and/or modify * GAWK is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
skipping to change at line 60 skipping to change at line 60
if (do_sandbox) if (do_sandbox)
fatal(_("extensions are not allowed in sandbox mode")); fatal(_("extensions are not allowed in sandbox mode"));
if (do_traditional || do_posix) if (do_traditional || do_posix)
fatal(_("-l / @load are gawk extensions")); fatal(_("-l / @load are gawk extensions"));
if (lib_name == NULL) if (lib_name == NULL)
fatal(_("load_ext: received NULL lib_name")); fatal(_("load_ext: received NULL lib_name"));
if ((dl = dlopen(lib_name, flags)) == NULL) if ((dl = dlopen(lib_name, flags)) == NULL)
fatal(_("load_ext: cannot open library `%s' (%s)"), lib_name, fatal(_("load_ext: cannot open library `%s': %s"), lib_name,
dlerror()); dlerror());
/* Per the GNU Coding standards */ /* Per the GNU Coding standards */
gpl_compat = (int *) dlsym(dl, "plugin_is_GPL_compatible"); gpl_compat = (int *) dlsym(dl, "plugin_is_GPL_compatible");
if (gpl_compat == NULL) if (gpl_compat == NULL)
fatal(_("load_ext: library `%s': does not define `plugin_is_GPL_c ompatible' (%s)"), fatal(_("load_ext: library `%s': does not define `plugin_is_GPL_c ompatible': %s"),
lib_name, dlerror()); lib_name, dlerror());
install_func = (int (*)(const gawk_api_t *const, awk_ext_id_t)) install_func = (int (*)(const gawk_api_t *const, awk_ext_id_t))
dlsym(dl, INIT_FUNC); dlsym(dl, INIT_FUNC);
if (install_func == NULL) if (install_func == NULL)
fatal(_("load_ext: library `%s': cannot call function `%s' (%s)") , fatal(_("load_ext: library `%s': cannot call function `%s': %s"),
lib_name, INIT_FUNC, dlerror()); 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' fai led"), warning(_("load_ext: library `%s' initialization routine `%s' fai led"),
lib_name, INIT_FUNC); lib_name, INIT_FUNC);
} }
/* make_builtin --- register name to be called as func with a builtin body */ /* make_builtin --- register name to be called as func with a builtin body */
awk_bool_t awk_bool_t
skipping to change at line 100 skipping to change at line 100
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
fatal(_("make_builtin: missing function name")); fatal(_("make_builtin: missing function name"));
if (! is_valid_identifier(name)) if (! is_valid_identifier(name))
return awk_false; return awk_false;
assert(name_space != NULL); assert(name_space != NULL);
if (name_space[0] == '\0' || strcmp(name_space, awk_namespace) == 0) { if (name_space[0] == '\0' || strcmp(name_space, awk_namespace) == 0) {
if (check_special(name) >= 0) if (check_special(name) >= 0)
fatal(_("make_builtin: can't use gawk built-in `%s' as fu nction name"), name); fatal(_("make_builtin: cannot use gawk built-in `%s' as f unction name"), name);
f = lookup(name); f = lookup(name);
install_name = estrdup(name, strlen(name)); install_name = estrdup(name, strlen(name));
} else { } else {
if (! is_valid_identifier(name_space)) if (! is_valid_identifier(name_space))
return awk_false; return awk_false;
if (check_special(name_space) >= 0) if (check_special(name_space) >= 0)
fatal(_("make_builtin: can't use gawk built-in `%s' as na mespace name"), name_space); fatal(_("make_builtin: cannot use gawk built-in `%s' as n amespace name"), name_space);
if (check_special(name) >= 0) if (check_special(name) >= 0)
fatal(_("make_builtin: can't use gawk built-in `%s' as fu nction name"), name); fatal(_("make_builtin: cannot use gawk built-in `%s' as f unction name"), name);
size_t len = strlen(name_space) + 2 + strlen(name) + 1; size_t len = strlen(name_space) + 2 + strlen(name) + 1;
char *buf; char *buf;
emalloc(buf, char *, len, "make_builtin"); emalloc(buf, char *, len, "make_builtin");
sprintf(buf, "%s::%s", name_space, name); sprintf(buf, "%s::%s", name_space, name);
install_name = buf; install_name = buf;
f = lookup(install_name); f = lookup(install_name);
} }
if (f != NULL) { if (f != NULL) {
// found it, but it shouldn't be there if we want to install this function // found it, but it shouldn't be there if we want to install this function
if (f->type == Node_func) { if (f->type == Node_func) {
/* user-defined function */ /* user-defined function */
fatal(_("make_builtin: can't redefine function `%s'"), na me); fatal(_("make_builtin: cannot redefine function `%s'"), n ame);
} else if (f->type == Node_ext_func) { } else if (f->type == Node_ext_func) {
/* multiple extension() calls etc. */ /* multiple extension() calls etc. */
if (do_lint) if (do_lint)
lintwarn(_("make_builtin: function `%s' already d efined"), name); lintwarn(_("make_builtin: function `%s' already d efined"), name);
return awk_false; return awk_false;
} else } else
/* variable name etc. */ /* variable name etc. */
fatal(_("make_builtin: function name `%s' previously defi ned"), name); fatal(_("make_builtin: function name `%s' previously defi ned"), name);
} }
 End of changes. 8 change blocks. 
8 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)