aboutsummaryrefslogtreecommitdiffstats
path: root/extension
diff options
context:
space:
mode:
Diffstat (limited to 'extension')
-rw-r--r--extension/Makefile.pc55
-rw-r--r--extension/arrayparm.c14
-rw-r--r--extension/filefuncs.c2
-rw-r--r--extension/pcext.def2
-rw-r--r--extension/readfile.c10
5 files changed, 72 insertions, 11 deletions
diff --git a/extension/Makefile.pc b/extension/Makefile.pc
new file mode 100644
index 00000000..fe8f5b47
--- /dev/null
+++ b/extension/Makefile.pc
@@ -0,0 +1,55 @@
+# Makefile for gawk extensions Mar 2003
+
+# - for GNU C (mingw32) [Windows32 executable for Windows 9x/NT]
+# - for Microsoft C 7 [16bit ececutable for DOS]
+
+# see README.pc for comments
+
+#------------------------------------------------------------------------
+# Some makes do not define MAKE (and ndmake does not allow a define).
+# Define MAK to be your make command.
+#MAKE = dmake
+MAK = $(MAKE) $(MAKEFILE)
+#MAK = $(MAKE)
+#MAKEFILE = -f Makefile
+#MAK = make45 $(MAKEFILE)
+
+VCCFLAGS=-nologo -O2 -DWIN32 -DWIN32_EXTENSION -D__STDC__=0 -DGAWK -I.. -DHAVE_CONFIG_H -DDYNAMIC
+VCLDFLAGS=-LD ../gawk.lib
+VCCC=cl -nologo
+
+MWCFLAGS=-O -shared -DWIN32 -DWIN32_EXTENSION -DGAWK -I.. -DHAVE_CONFIG_H -DDYNAMIC
+MWLDFLAGS=-s -Wl,--enable-stdcall-fixup -L.. -lgawk
+MWCC=gcc
+
+# this DEFFILE will work provided the exported function is always called
+# dlload
+DEFFILE=pcext.def
+
+
+default:
+ @echo "Enter $(MAK) target "
+ @echo " where 'target' is chosen from "
+ @echo " mingw32 . Windows32 exe [Mingw32 GNU C] "
+ @echo " vcWin32 . Windows32 exe [Microsoft Visual C] "
+
+.SUFFIXES: .c .dll
+
+.c.dll:
+ $(CC) $(CFLAGS) $< -o$@ $(LDFLAGS) $(DEFFILE)
+
+
+# dl.c, fork.c, and filefuncs.c don't compile cleanly...
+all : readfile.dll ordchr.dll arrayparm.dll
+
+vcWin32:
+ $(MAK) CFLAGS="$(VCCFLAGS)" LDFLAGS="$(VCLDFLAGS)" CC="$(VCCC)" all
+
+mingw32:
+ $(MAK) CFLAGS="$(MWCFLAGS)" LDFLAGS="$(MWLDFLAGS)" CC="$(MWCC)" all
+
+clean:
+ -rm *.dll
+ -rm *.o
+ -rm *.obj
+ -rm *.lib
diff --git a/extension/arrayparm.c b/extension/arrayparm.c
index 9a158676..6c627d65 100644
--- a/extension/arrayparm.c
+++ b/extension/arrayparm.c
@@ -4,10 +4,12 @@
* Arnold Robbins
* arnold@skeeve.com
* 10/2001
+ *
+ * Revised 7/2003
*/
/*
- * Copyright (C) 2001 the Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2003 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -51,6 +53,8 @@ NODE *tree;
var = get_argument(tree, 0);
if (var == NULL)
var = stack_ptr[0];
+
+ var = get_array(var);
sub = get_argument(tree, 1);
val = get_argument(tree, 2);
@@ -58,14 +62,6 @@ NODE *tree;
printf("sub->type = %s\n", nodetype2str(sub->type));
printf("val->type = %s\n", nodetype2str(val->type));
- if (var->var_array == NULL) {
- if (var->type != Node_var_array) {
- unref(var->var_value);
- var->type = Node_var_array;
- }
- var->array_size = var->table_size = 0; /* sanity */
- var->flags &= ~ARRAYMAXED;
- }
assoc_clear(var);
elemval = assoc_lookup(var, sub, 0);
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index 12badb5b..194db28f 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -189,6 +189,8 @@ NODE *tree;
file = get_argument(tree, 0);
array = get_argument(tree, 1);
+ array = get_array(array);
+
/* empty out the array */
assoc_clear(array);
diff --git a/extension/pcext.def b/extension/pcext.def
new file mode 100644
index 00000000..696907f6
--- /dev/null
+++ b/extension/pcext.def
@@ -0,0 +1,2 @@
+EXPORTS
+dlload @1
diff --git a/extension/readfile.c b/extension/readfile.c
index 8713bc8d..65f0efca 100644
--- a/extension/readfile.c
+++ b/extension/readfile.c
@@ -3,10 +3,12 @@
*
* Arnold Robbins
* Tue Apr 23 17:43:30 IDT 2002
+ * Revised per Peter Tillier
+ * Mon Jun 9 17:05:11 IDT 2003
*/
/*
- * Copyright (C) 2002 the Free Software Foundation, Inc.
+ * Copyright (C) 2002, 2003 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -29,6 +31,10 @@
#include "awk.h"
#include <fcntl.h>
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
/* do_readfile --- read a file into memory */
NODE *
@@ -61,7 +67,7 @@ NODE *tree;
goto done;
}
- if ((fd = open(filename->stptr, O_RDONLY)) < 0) {
+ if ((fd = open(filename->stptr, O_RDONLY|O_BINARY)) < 0) {
ret = -1;
update_ERRNO();
free_temp(filename);