diff options
Diffstat (limited to 'extension')
-rw-r--r-- | extension/ChangeLog | 6 | ||||
-rw-r--r-- | extension/arrayparm.c | 83 | ||||
-rw-r--r-- | extension/dl.c | 92 | ||||
-rwxr-xr-x | extension/doit | 1 | ||||
-rw-r--r-- | extension/foo.awk | 9 | ||||
-rwxr-xr-x | extension/steps | 23 | ||||
-rw-r--r-- | extension/testarg.awk | 7 | ||||
-rw-r--r-- | extension/testarg.c | 55 | ||||
-rw-r--r-- | extension/testarrayparm.awk | 10 | ||||
-rw-r--r-- | extension/testff.awk | 30 | ||||
-rw-r--r-- | extension/testfork.awk | 20 | ||||
-rw-r--r-- | extension/testordchr.awk | 6 |
12 files changed, 6 insertions, 336 deletions
diff --git a/extension/ChangeLog b/extension/ChangeLog index 140aea50..d647ebb9 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,9 @@ +2012-06-10 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * arrayparm.c, dl.c, doit, foo.awk, steps, testarg.awk, testarg.c, + testarrayparm.awk, testff.awk, testfork.awk, testordchr.awk: Remove + unused (obsolete) files. + 2012-06-06 Arnold D. Robbins <arnold@skeeve.com> * filefuncs.c (do_stat): Make `type' const char *. diff --git a/extension/arrayparm.c b/extension/arrayparm.c deleted file mode 100644 index 02b8c2e4..00000000 --- a/extension/arrayparm.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * arrayparm.c --- figure out how to make a parameter be an array - * - * Arnold Robbins - * arnold@skeeve.com - * 10/2001 - * - * Revised 7/2003 - * Revised 6/2004 - */ - -/* - * Copyright (C) 2001, 2003, 2004, 2011 the Free Software Foundation, Inc. - * - * This file is part of GAWK, the GNU implementation of the - * AWK Programming Language. - * - * GAWK is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * GAWK is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "awk.h" - -int plugin_is_GPL_compatible; - -/* do_mkarray --- turn a variable into an array */ - -/* - * From awk, call - * - * mkarray(var, sub, val) - */ - -static NODE * -do_mkarray(int nargs) -{ - int ret = -1; - NODE *var, *sub, *val; - NODE **elemval; - - if (do_lint && nargs > 3) - lintwarn("mkarray: called with too many arguments"); - - var = get_array_argument(0, false); - sub = get_scalar_argument(1, false); - val = get_scalar_argument(2, false); - - printf("var->type = %s\n", nodetype2str(var->type)); - printf("sub->type = %s\n", nodetype2str(sub->type)); - printf("val->type = %s\n", nodetype2str(val->type)); - - assoc_clear(var); - - elemval = assoc_lookup(var, sub); - *elemval = dupnode(val); - ret = 0; - - /* Set the return value */ - return make_number((AWKNUM) ret); -} - -/* dlload --- load new builtins in this library */ - -NODE * -dlload(tree, dl) -NODE *tree; -void *dl; -{ - make_builtin("mkarray", do_mkarray, 3); - - return make_number((AWKNUM) 0); -} diff --git a/extension/dl.c b/extension/dl.c deleted file mode 100644 index ee3b08fe..00000000 --- a/extension/dl.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * dl.c - Example of adding a new builtin function to gawk. - * - * Christos Zoulas, Thu Jun 29 17:40:41 EDT 1995 - * Arnold Robbins, update for 3.1, Wed Sep 13 09:38:56 2000 - */ - -/* - * Copyright (C) 1995 - 2001, 2011 the Free Software Foundation, Inc. - * - * This file is part of GAWK, the GNU implementation of the - * AWK Programming Language. - * - * GAWK is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * GAWK is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "awk.h" -#include <dlfcn.h> - -int plugin_is_GPL_compatible; - -static void *sdl = NULL; - -static NODE * -zaxxon(int nargs) -{ - NODE *obj; - int i; - int comma = 0; - - /* - * Print the arguments - */ - printf("External linkage zaxxon("); - - for (i = 0; i < nargs; i++) { - - obj = get_scalar_argument(i, true); - - if (obj == NULL) - break; - - force_string(obj); - - printf(comma ? ", %s" : "%s", obj->stptr); - comma = 1; - } - - printf(");\n"); - - /* - * Do something useful - */ - obj = get_scalar_argument(0, false); - - if (obj != NULL) { - force_string(obj); - if (strcmp(obj->stptr, "unload") == 0 && sdl) { - /* - * XXX: How to clean up the function? - * I would like the ability to remove a function... - */ - dlclose(sdl); - sdl = NULL; - } - } - - /* Set the return value */ - return make_number((AWKNUM) 3.14); -} - -NODE * -dlload(tree, dl) -NODE *tree; -void *dl; -{ - sdl = dl; - make_builtin("zaxxon", zaxxon, 4); - return make_number((AWKNUM) 0); -} diff --git a/extension/doit b/extension/doit deleted file mode 100755 index 29dff7d8..00000000 --- a/extension/doit +++ /dev/null @@ -1 +0,0 @@ -../gawk -f foo.awk diff --git a/extension/foo.awk b/extension/foo.awk deleted file mode 100644 index 00a89e5b..00000000 --- a/extension/foo.awk +++ /dev/null @@ -1,9 +0,0 @@ -BEGIN { - extension("./dl.so","dlload") - zaxxon("hi there", "this is", "a test", "of argument passing") - zaxxon(1) - zaxxon(1,2) - z = zaxxon(1,2,3,4) - z = zaxxon(1,zaxxon(zaxxon("foo")),3,4) - print z -} diff --git a/extension/steps b/extension/steps deleted file mode 100755 index a6696ddc..00000000 --- a/extension/steps +++ /dev/null @@ -1,23 +0,0 @@ -# what to do under linux to make dl.so -# Tue Nov 24 15:04:14 EST 1998 -# Sun Aug 26 16:03:58 IDT 2001 -# Sun Apr 28 15:59:57 IDT 2002 -# Mon Jun 21 17:03:37 IDT 2004 -# Fri May 15 15:48:45 IDT 2009 - -gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. dl.c -gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. filefuncs.c -gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. fork.c -gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. ordchr.c -gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. arrayparm.c -gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. readfile.c -gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. testarg.c -gcc -fPIC -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. rwarray.c -ld -o dl.so -shared dl.o -ld -o filefuncs.so -shared filefuncs.o -ld -o fork.so -shared fork.o -ld -o ordchr.so -shared ordchr.o -ld -o arrayparm.so -shared arrayparm.o -ld -o readfile.so -shared readfile.o -ld -o testarg.so -shared testarg.o -ld -o rwarray.so -shared rwarray.o diff --git a/extension/testarg.awk b/extension/testarg.awk deleted file mode 100644 index a91df1a9..00000000 --- a/extension/testarg.awk +++ /dev/null @@ -1,7 +0,0 @@ -BEGIN { - extension("./testarg.so", "dlload") - check_arg(x, a); - check_arg(y, b, z); - check_arg(u, v, u=1); - check_arg(p, q, r, s); -} diff --git a/extension/testarg.c b/extension/testarg.c deleted file mode 100644 index 32481b33..00000000 --- a/extension/testarg.c +++ /dev/null @@ -1,55 +0,0 @@ -#include "awk.h" - -int plugin_is_GPL_compatible; - -static NODE * -do_check_arg(int nargs) -{ - int ret = 0; - NODE *arg1, *arg2, *arg3; - - printf("arg count: defined = 3, supplied = %d\n", nargs); - - arg1 = get_scalar_argument(0, false); - arg2 = get_array_argument(1, false); - arg3 = get_scalar_argument(2, true); /* optional */ - if (nargs > 3) { - /* try to use an extra arg */ - NODE *arg4; - arg4 = get_array_argument(3, true); - printf("Shouldn't see this line\n"); - } - if (arg3 != NULL) { - printf("3rd arg present\n"); - if (arg3->type != Node_val) - printf("3nd arg type = %s (*** NOT OK ***)\n", nodetype2str(arg3->type)); - } else - printf("no 3rd arg\n"); - - if (arg2 != NULL) { - if (arg2->type != Node_var_array) - printf("2nd arg type = %s (*** NOT OK ***)\n", nodetype2str(arg2->type)); - } else - printf("2nd arg missing (NULL) (*** NOT OK ***)\n"); - - if (arg1 != NULL) { - if (arg1->type != Node_val) - printf("1st arg type = %s (*** NOT OK ***)\n", nodetype2str(arg1->type)); - } else - printf("1st arg missing (NULL) (*** NOT OK ***)\n"); - printf("\n"); - - /* Set the return value */ - return make_number((AWKNUM) ret); -} - -/* dlload --- load new builtins in this library */ - -NODE * -dlload(tree, dl) -NODE *tree; -void *dl; -{ - make_builtin("check_arg", do_check_arg, 3); - return make_number((AWKNUM) 0); -} diff --git a/extension/testarrayparm.awk b/extension/testarrayparm.awk deleted file mode 100644 index 08178f3e..00000000 --- a/extension/testarrayparm.awk +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/awk -f - -BEGIN { - extension("./arrayparm.so", "dlload") - - mkarray(newvar, "hi", "hello") - - for (i in newvar) - printf ("newvar[\"%s\"] = \"%s\"\n", i, newvar[i]) -} diff --git a/extension/testff.awk b/extension/testff.awk deleted file mode 100644 index 0a0a9b2f..00000000 --- a/extension/testff.awk +++ /dev/null @@ -1,30 +0,0 @@ -BEGIN { - extension("./filefuncs.so", "dlload") - -# printf "before: " -# fflush() -# system("pwd") -# -# chdir("..") -# -# printf "after: " -# fflush() -# system("pwd") - - chdir(".") - - data[1] = 1 - print "Info for testff.awk" - ret = stat("testff.awk", data) - print "ret =", ret - for (i in data) - printf "data[\"%s\"] = %s\n", i, data[i] - print "testff.awk modified:", strftime("%m %d %y %H:%M:%S", data["mtime"]) - - print "\nInfo for JUNK" - ret = stat("JUNK", data) - print "ret =", ret - for (i in data) - printf "data[\"%s\"] = %s\n", i, data[i] - print "JUNK modified:", strftime("%m %d %y %H:%M:%S", data["mtime"]) -} diff --git a/extension/testfork.awk b/extension/testfork.awk deleted file mode 100644 index ca00dca8..00000000 --- a/extension/testfork.awk +++ /dev/null @@ -1,20 +0,0 @@ -BEGIN { - extension("./fork.so", "dlload") - - printf "before fork, pid = %d, ppid = %d\n", PROCINFO["pid"], - PROCINFO["ppid"] - - fflush() - ret = fork() - if (ret < 0) - printf("ret = %d, ERRNO = %s\n", ret, ERRNO) - else if (ret == 0) - printf "child, pid = %d, ppid = %d\n", PROCINFO["pid"], - PROCINFO["ppid"] - else { - system("sleep 3") - printf "parent, ret = %d\n", ret - printf "parent, pid = %d, ppid = %d\n", PROCINFO["pid"], - PROCINFO["ppid"] - } -} diff --git a/extension/testordchr.awk b/extension/testordchr.awk deleted file mode 100644 index 64e53d16..00000000 --- a/extension/testordchr.awk +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN { - extension("./ordchr.so", "dlload") - - print "ord(\"a\") is", ord("a") - print "chr(65) is", chr(65) -} |