GAWK 3.1 - problem with extensions and loading the adump function. 
Author Message
 GAWK 3.1 - problem with extensions and loading the adump function.

Looking through the GAWK source code, I found a function "adump" that dumps
out an array.  However, by default, this function is not enabled.  If you
compile with -DARRAYDEBUG turned on, then the following program works:

         ./gawk 'BEGIN { adump(PROCINFO) }'

However, it occurred to me that it ought to be possible to turn adump on
via an extension() function (i.e., a shared lib), since both of the
functions that actually make up the adump function are compiled in
(regardless of the status of the ARRAYDEBUG symbol).

It seems that the following out to work:

% cat adump.c
#include "awk.h"

/* dlload --- load new builtins in this library */

NODE *
dlload(tree, dl)
NODE *tree;
void *dl;
{
        make_builtin("adump", do_adump, 1);
        return tmp_number((AWKNUM) 0);

Quote:
}

% cat adump.awk
BEGIN {
    extension("./adump.so","dlload")
    print "Finished adding extension"
    adump(PROCINFO)
Quote:
}

% gawk -f !$
gawk -f adump.awk
Finished adding extension
gawk: ext.c:130: fatal error: internal error
Abort
%

Note that the version of gawk that I am using above was *not* compiled
with ARRAYDEBUG defined, so, by default, adump is an undefined function.

Any ideas?



Thu, 01 Jan 2004 06:08:22 GMT  
 GAWK 3.1 - problem with extensions and loading the adump function.
At a guess I'd say that the make_builtin function assumes that the
arguments to the new builtin would be scalars, not arrays.

cheers,
Andrew



Fri, 02 Jan 2004 09:03:21 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Gawk 3.1: What are adump and stopme?

2. calling functions from gawk extensions

3. GAWK: Question on using filefuncs.so (creating arrays in extension functions)

4. beta test version of patch 2 to gawk 3.1 available

5. I'm trying to get a gawk (3.1) executable for sun/solaris

6. Patch #1 to gawk 3.1 now available

7. GAWK 3.1 getline Timeout

8. Second beta of gawk 3.1 now available

9. Gawk 3.1 new feature list

10. gawk version 3.1

11. GAWK 3.0.95 - Bug (er, problem) report on extension stuff

12. loading C++ executables into Quintus Prolog 3.1

 

 
Powered by phpBB® Forum Software