summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:33:03 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:33:03 +0300
commit2f83a4e72166e811a9f0b4726c19a3d5a0b17dcb (patch)
tree469bebda4e807139efb497edfca1ec0678b5ab8b
parent66b0bdd602e952f20fa98f6ce5430cea68d4f598 (diff)
downloadgawk-2f83a4e72166e811a9f0b4726c19a3d5a0b17dcb.tar.gz
Move to gawk-2.15.5.gawk-2.15.5
-rw-r--r--ACKNOWLEDGMENT4
-rw-r--r--FUTURES69
-rw-r--r--LIMITATIONS2
-rw-r--r--Makefile.bsd442
-rw-r--r--NEWS110
-rw-r--r--PORTS9
-rw-r--r--README7
-rw-r--r--README.atari2
-rw-r--r--README.hpux8x5
-rw-r--r--README.sgi10
-rw-r--r--array.c69
-rw-r--r--atari/config.h38
-rw-r--r--awk.h57
-rw-r--r--awk.y29
-rw-r--r--awktab.c1276
-rw-r--r--builtin.c251
-rw-r--r--config.in16
-rw-r--r--config/cray603
-rw-r--r--config/next201
-rw-r--r--config/next211
-rw-r--r--config/next301
-rw-r--r--config/osf1.dec4
-rw-r--r--config/sco6
-rw-r--r--config/sgi4051
-rw-r--r--config/utek18
-rw-r--r--dfa.c21
-rw-r--r--eval.c31
-rw-r--r--field.c79
-rw-r--r--gawk.119
-rw-r--r--getopt.c14
-rw-r--r--io.c42
-rw-r--r--iop.c18
-rw-r--r--main.c41
-rw-r--r--missing/strftime.311
-rw-r--r--missing/strftime.c165
-rw-r--r--msg.c2
-rw-r--r--node.c57
-rw-r--r--patchlevel.h2
-rw-r--r--protos.h32
-rw-r--r--test/Makefile7
-rw-r--r--test/manyfiles.awk2
-rw-r--r--test/rs.good1
-rw-r--r--vms/descrip.mms7
-rw-r--r--vms/vmsbuild.com2
44 files changed, 1512 insertions, 1032 deletions
diff --git a/ACKNOWLEDGMENT b/ACKNOWLEDGMENT
index 20bbe8ce..cb4021f7 100644
--- a/ACKNOWLEDGMENT
+++ b/ACKNOWLEDGMENT
@@ -8,7 +8,7 @@ platforms and providing a great deal of feedback. They are:
Hal Peterson <hrp@pecan.cray.com> (Cray)
Pat Rankin <gawk.rankin@EQL.Caltech.Edu> (VMS)
- Michal Jaegermann <NTOMCZAK@vm.ucs.UAlberta.CA> (Atari, NeXT, DEC 3100)
+ Michal Jaegermann <michal@gortel.phys.UAlberta.CA> (Atari, NeXT, DEC 3100)
Mike Lijewski <mjlx@eagle.cnsf.cornell.edu> (IBM RS6000)
Scott Deifik <scottd@amgen.com> (MSDOS 2.14 and 2.15)
Kent Williams (MSDOS 2.11)
@@ -16,6 +16,8 @@ platforms and providing a great deal of feedback. They are:
Scott Garfinkle (MSDOS earlier versions)
Kai Uwe Rommel <rommel@ars.muc.de> (OS/2)
Darrel Hankerson <hankedr@mail.auburn.edu> (OS/2)
+ Mark Moraes <Mark-Moraes@deshaw.com> (Code Center, Purify)
+ Kaveh Ghazi <ghazi@noc.rutgers.edu> (Lots of Unix variants)
Last, but far from least, we would like to thank Brian Kernighan who
has helped to clear up many dark corners of the language and provided a
diff --git a/FUTURES b/FUTURES
index b0965604..6250584f 100644
--- a/FUTURES
+++ b/FUTURES
@@ -1,14 +1,26 @@
This file lists future projects and enhancements for gawk. Items are listed
in roughly the order they will be done for a given release. This file is
-mainly for use by the developers to help keep themselves on track, please
+mainly for use by the developer(s) to help keep themselves on track, please
don't bug us too much about schedules or what all this really means.
+(An `x' indicates that some progress has been made, but that the feature is
+not complete yet.)
+
For 2.16
========
-David:
- Move to autoconf-based configure system.
+x Move to autoconf-based configure system.
+
+x Research awk `fflush' function.
+
+x Generalize IGNORECASE
+ any value makes it work, not just numeric non-zero
+ make it apply to *all* string comparisons
+
+x Fix FILENAME to have an initial value of "", not "-"
- Allow RS to be a regexp.
+In 2.17
+=======
+x Allow RS to be a regexp.
RT variable to hold text of record terminator
@@ -16,46 +28,24 @@ David:
Feedback alloca.s changes to FSF
- Extensible hashing in memory of awk arrays
+x Split() with null string as third arg to split up strings
- Split() with null string as third arg to split up strings
-
- Analogously, setting FS="" would split the input record into individual
+x Analogously, setting FS="" would split the input record into individual
characters.
-Arnold:
- Generalize IGNORECASE
- any value makes it work, not just numeric non-zero
- make it apply to *all* string comparisons
-
- Fix FILENAME to have an initial value of "", not "-"
-
- Clean up code by isolating system-specific functions in separate files.
+x Clean up code by isolating system-specific functions in separate files.
Undertake significant directory reorganization.
- Extensive manual cleanup:
+x Extensive manual cleanup:
Use of texinfo 2.0 features
Lots more examples
Document all of the above.
-In 2.17
-=======
-David:
-
- Incorporate newer dfa.c and regex.c (go to POSIX regexps)
+x Go to POSIX regexps
Make regex + dfa less dependant on gawk header file includes
- General sub functions:
- edit(line, pat, sub) and gedit(line, pat, sub)
- that return the substituted strings and allow \1 etc. in the sub string.
-
-Arnold:
- DBM storage of awk arrays. Try to allow multiple dbm packages
-
- ? Have strftime() pay attention to the value of ENVIRON["TZ"]
-
Additional manual features:
Document posix regexps
Document use of dbm arrays
@@ -67,19 +57,26 @@ Arnold:
For 2.18
========
+ DBM storage of awk arrays. Try to allow multiple dbm packages
-Arnold:
+ General sub functions:
+ edit(line, pat, sub) and gedit(line, pat, sub)
+ that return the substituted strings and allow \1 etc. in the sub
+ string.
+
+ ? Have strftime() pay attention to the value of ENVIRON["TZ"]
+
+For 2.19
+========
Add chdir and stat built-in functions.
Add function pointers as valid variable types.
Add an `ftw' built-in function that takes a function pointer.
-David:
-
Do an optimization pass over parse tree?
-For 2.19 or later:
+For 2.20 or later:
==================
Add variables similar to C's __FILE__ and __LINE__ for better diagnostics
from within awk programs.
@@ -101,7 +98,7 @@ Make awk '/foo/' files... run at egrep speeds
Do a reference card
-Allow OFMT to be other than a floating point format.
+Allow OFMT and CONVFMT to be other than a floating point format.
Allow redefining of builtin functions?
diff --git a/LIMITATIONS b/LIMITATIONS
index 5877197a..64eab85f 100644
--- a/LIMITATIONS
+++ b/LIMITATIONS
@@ -12,3 +12,5 @@ Characters in a character class: 2^(# of bits per byte)
# of pipe redirections: min(# of processes per user, # of open files)
double-precision floating point
Length of source line: unlimited
+Number of input records in one file: MAX_LONG
+Number of input records total: MAX_LONG
diff --git a/Makefile.bsd44 b/Makefile.bsd44
index 52b995e4..1daca532 100644
--- a/Makefile.bsd44
+++ b/Makefile.bsd44
@@ -10,5 +10,5 @@ MANDIR= /usr/share/man/cat
CLEANFILES+=awk.c y.tab.h awk.0
awk.0: gawk.1
- nroff -man gawk.1 > awk.0
+ nroff -man gawk.1 > awk.0
.include <bsd.prog.mk>
diff --git a/NEWS b/NEWS
index ac66f8b8..4df69e7d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,91 @@
+Changes from 2.15.4 to 2.15.5
+-----------------------------
+
+FUTURES file updated and re-arranged some with more rational schedule.
+
+Many prototypes handled better for ANSI C in protos.h.
+
+getopt.c updated somewhat.
+
+test/Makefile now removes junk directory, `bardargtest' renamed `badargs.'
+
+Bug fix in iop.c for RS = "". Eat trailing newlines off of record separator.
+
+Bug fix in Makefile.bsd44, use leading tab in actions.
+
+Fix in field.c:set_FS for FS == "\\" and IGNORECASE != 0.
+
+Config files updated or added:
+ cray60, DEC OSF/1 2.0, Utek, sgi405, next21, next30, atari/config.h,
+ sco.
+
+Fix in io.c for ENFILE as well as EMFILE, update decl of groupset to
+include OSF/1.
+
+Rationalized printing as integers if numbers are outside the range of a long.
+Changes to node.c:force_string and builtin.c.
+
+Made internal NF, NR, and FNR variables longs instead of ints.
+
+Add LIMITS_H_MISSING stuff to config.in and awk.h, and default defs for
+INT_MAX and LONG_MAX, if no limits.h file. Add a standard decl of
+the time() function for __STDC__. From ghazi@noc.rutgers.edu.
+
+Fix tree_eval in awk.h and r_tree_eval in eval.c to deal better with
+function parameters, particularly ones that are arrays.
+
+Fix eval.c to print out array names of arrays used in scalar contexts.
+
+Fix eval.c in interpret to zero out source and sourceline initially. This
+does a better job of providing source file and line number information.
+
+Fix to re_parse_field in field.c to not use isspace when RS = "", but rather
+to explicitly look for blank and tab.
+
+Fix to sc_parse_field in field.c to catch the case of the FS character at the
+end of a record.
+
+Lots of miscellanious bug fixes for memory leaks, courtesy Mark Moraes,
+also fixes for arrays.
+
+io.c fixed to warn about lack of explicit closes if --lint.
+
+Updated missing/strftime.c to match posted strftime 6.2.
+
+Bug fix in builtin.c, in case of non-match in sub_common.
+
+Updated constant used for division in builtin.c:do_rand for DEC Alpha
+and CRAY Y-MP.
+
+POSIXLY_CORRECT in the environment turns on --posix (fixed in main.c).
+
+Updated srandom prototype and calls in builtin.c.
+
+Fix awk.y to enforce posix semantics of unary +: result is numeric.
+
+Fix array.c to not rearrange the hash chain upon finding an index in
+the array. This messed things up in cases like:
+ for (index1 in array) {
+ blah
+ if (index2 in array) # blew away the for
+ stuff
+ }
+
+Fixed spelling errors in the man page.
+
+Fixes in awk.y so that
+ gawk '' /path/to/file
+will work without core dumping or finding parse errors.
+
+Fix main.c so that --lint will fuss about an empty program.
+Yet another fix for argument parsing in the case of unrecognized options.
+
+Bug fix in dfa.c to not attempt to free null pointers.
+
+Bug fix in builtin.c to only use DEFAULT_G_PRECISION for %g or %G.
+
+Bug fix in field.c to achieve call by value semantics for split.
+
Changes from 2.15.3 to 2.15.4
-----------------------------
@@ -26,7 +114,7 @@ New bionic (faster, better, stronger than before) hashing function.
Bug fix in argument handling. `gawk -X' now notices there was no program.
Additional bug fixes to make --compat and --lint work again.
-Many changes for 16-bit cleanliness.
+Many changes for systems where sizeof(int) != sizeof(void *).
Add explicit alloca(0) in io.c to recover space from C alloca.
@@ -64,7 +152,7 @@ More getpgrp() defines.
Changes for BSD44: <sys/param.h> in io.c and Makefile.bsd44.
-All directories in the distribution are now writeable.
+All directories in the distribution are now writable.
Separated LDFLAGS and CFLAGS in Makefile. CFLAGS can now be overridden by
user.
@@ -258,7 +346,7 @@ Added code to do better diagnoses of weird or null file names.
Allow continue outside of a loop, unless in strict posix mode. Lint option
will issue warning.
-New missing/strftime.c. There has been one chage that affects gawk. Posix
+New missing/strftime.c. There has been one change that affects gawk. Posix
now defines a %V conversion so the vms conversion has been changed to %v.
If this version is used with gawk -Wlint and they use %V in a call to
strftime, they'll get a warning.
@@ -286,7 +374,7 @@ Fixed a couple of bugs for reference to $0 when $0 is "" -- particularly in
Fixed premature freeing in construct "$0 = $0".
Removed the call to wait_any() in gawk_popen(), since on at least some systems,
- if gawk's input was from a pipe, the predecssor process in the pipe was a
+ if gawk's input was from a pipe, the predecessor process in the pipe was a
child of gawk and this caused a deadlock.
Regexp can (once again) match a newline, if given explicitly.
@@ -312,7 +400,7 @@ Fixed bug when NF is set by user -- fields_arr must be expanded if necessary
Fixed several bugs in [g]sub() for no match found or the match is 0-length.
-Fixed bug where in gsub() a pattern anchorred at the beginning would still
+Fixed bug where in gsub() a pattern anchored at the beginning would still
substitute throughout the string.
make test does not assume the . is in PATH.
@@ -332,7 +420,7 @@ Fixed hanging of pipe redirection to getline
Fixed coredump on access to $0 inside BEGIN block.
Fixed treatment of RS = "". It now parses the fields correctly and strips
- leading whitspace from a record if FS is a space.
+ leading whitespace from a record if FS is a space.
Fixed faking of /dev/stdin.
@@ -376,7 +464,7 @@ Update to config/bsd43.
Added config/apollo, config/msc60, config/cray2-50, config/interactive2.2
-sgi33.cc added for compilation using cc ratther than gcc.
+sgi33.cc added for compilation using cc rather than gcc.
Ultrix41 now propagates to config.h properly -- as part of a general
mechanism in configure for kludges -- #define anything from a config file
@@ -697,7 +785,7 @@ Fixed bug in output flushing introduced a few patches back. This caused
Changes from 2.12.22 to 2.12.23
-------------------------------
-Accidently left config/cray2-60 out of last patch.
+Accidentally left config/cray2-60 out of last patch.
Added some missing dependencies to Makefile.
@@ -847,7 +935,7 @@ Changes from 2.12.14 to 2.12.15
-------------------------------
Changed config/* to a condensed form that can be used with mkconf to generate
- a config.h from config.h-dist -- much easier to maintain. Please chaeck
+ a config.h from config.h-dist -- much easier to maintain. Please check
carefully against what you had before for a particular system and report
any problems. vms.h remains separate since the stuff at the bottom
didn't quite fit the mkconf model -- hopefully cleared up later.
@@ -1199,7 +1287,7 @@ Changes from 2.11beta to 2.11.1 (production)
Went from "beta" to production status!!!
Now flushes stdout before closing pipes or redirected files to
-synchonize output.
+synchronize output.
MS-DOS changes added in.
@@ -1314,7 +1402,7 @@ Cleaned up and fixed close_redir().
Fixed an obscure bug to do with redirection. Intermingled ">" and ">>"
redirects did not output in a predictable order.
-Improved handling of output bufferring: now all print[f]s redirected to a tty
+Improved handling of output buffering: now all print[f]s redirected to a tty
or pipe are flushed immediately and non-redirected output to a tty is flushed
before the next input record is read.
diff --git a/PORTS b/PORTS
index 95e133f9..5087a430 100644
--- a/PORTS
+++ b/PORTS
@@ -18,15 +18,18 @@ OpenVMS AXP V1.0
MSDOS - Microsoft C 5.1, compiles and runs very simple testing
BSD 4.4alpha
-From: ghazi@caip.rutgers.edu (Kaveh R. Ghazi):
+From: ghazi@noc.rutgers.edu (Kaveh R. Ghazi):
arch configured as:
---- --------------
+Dec Alpha OSF 1.3 osf1
Hpux 9.0 hpux8x
NeXTStep 2.0 next20
-Sgi Irix 4.0.5 (/bin/cc) sgi405.cc (new file)
+Sgi Irix 4.0.5 (/bin/cc) sgi405.cc
Stardent Titan 1500 OSv2.5 sysv3
Stardent Vistra (i860) SVR4 sysv4
-SunOS 4.1.2 sunos41
+Solaris 2.3 solaris2.cc
+SunOS 4.1.3 sunos41
Tektronix XD88 (UTekV 3.2e) sysv3
+Tektronix 4300 (UTek 4.0) utek
Ultrix 4.2 ultrix41
diff --git a/README b/README
index 88ada1c0..90ed9c29 100644
--- a/README
+++ b/README
@@ -1,8 +1,7 @@
README:
-This is GNU Awk 2.15. It should be upwardly compatible with the
-System V Release 4 awk. It is almost completely compliant with draft 11.3
-of POSIX 1003.2.
+This is GNU Awk 2.15. It should be upwardly compatible with the System
+V Release 4 awk. It is almost completely compliant with POSIX 1003.2.
This release adds new features -- see NEWS for details.
@@ -28,7 +27,7 @@ INSTALLATION:
Check whether there is a system-specific README file for your system.
-A quick overview of the installation process is in the file INSTALLATION.
+A quick overview of the installation process is in the file INSTALL.
Makefile.in may need some tailoring. The only changes necessary should
be to change installation targets or to change compiler flags.
diff --git a/README.atari b/README.atari
index 1122caaa..60bf9210 100644
--- a/README.atari
+++ b/README.atari
@@ -15,7 +15,7 @@ awkpath, reparse, nfset.
Nearly all of these test do not require any adjustments to run, but a
modified test suite with a driving Makefile (for gulam) is available
-on a request from Michal Jaegermann, ntomczak@vm.ucs.ualberta.ca,
+on a request from Michal Jaegermann, michal@gortel.phys.ualberta.ca,
via e-mail.
TOS and MiNT
diff --git a/README.hpux8x b/README.hpux8x
index 4142e8fa..6209c0d7 100644
--- a/README.hpux8x
+++ b/README.hpux8x
@@ -11,3 +11,8 @@ hp9000 series 700 systems does not pass its test suite. When compiled with
hp's C compiler, it does fine. If you compile with cc and it fails, then
let me hear about it please. If you compile with gcc and then complain to
me, I'm going to fuss at you for not reading the documenation. (:-)
+------------------------------------
+
+January 1994 - arnold@skeeve.atl.ga.us
+
+I'm told that with gcc 2.5.8, gawk now compiles.
diff --git a/README.sgi b/README.sgi
index 51015ca9..ae5dbf42 100644
--- a/README.sgi
+++ b/README.sgi
@@ -1,7 +1,5 @@
-January 1994
+April 1994
-I have reports that gawk fails to pass its tests when compiled with gcc on
-the IRIX, through gcc 2.5.7. Therefore you should probably try compiling
-with cc. If gawk compiled with cc fails to pass its `make test', then I want
-to hear about it. Otherwise I will fuss at you for not reading the
-documentation.
+I'm told that gawk now compiles on the SGI with gcc without problems.
+The main issue was apparently the use of CHAR_UNSIGNED in regex.c, and
+the current regex.c now manages to figure it out on its own.
diff --git a/array.c b/array.c
index 0ddc6644..d42f9a6c 100644
--- a/array.c
+++ b/array.c
@@ -111,6 +111,7 @@ NODE *symbol;
free(symbol->var_array);
symbol->var_array = NULL;
symbol->array_size = symbol->table_size = 0;
+ symbol->flags &= ~ARRAYMAXED;
}
/*
@@ -229,11 +230,19 @@ int hash1;
for (bucket = symbol->var_array[hash1]; bucket; bucket = bucket->ahnext) {
if (cmp_nodes(bucket->ahname, subs) == 0) {
+#if 0
+ /*
+ * Disable this code for now. It screws things up if we have
+ * a ``for (iggy in foo)'' in progress. Interestingly enough,
+ * this was not a problem in 2.15.3, only in 2.15.4. I'm not
+ * sure why it works in 2.15.3.
+ */
if (prev) { /* move found to front of chain */
prev->ahnext = bucket->ahnext;
bucket->ahnext = symbol->var_array[hash1];
symbol->var_array[hash1] = bucket;
}
+#endif
return bucket;
} else
prev = bucket; /* save previous list entry */
@@ -284,6 +293,7 @@ NODE *symbol, *subs;
if (symbol->var_array == 0) {
symbol->type = Node_var_array;
symbol->array_size = symbol->table_size = 0; /* sanity */
+ symbol->flags &= ~ARRAYMAXED;
grow_table(symbol);
hash1 = hash(subs->stptr, subs->stlen,
(unsigned long) symbol->array_size);
@@ -368,7 +378,8 @@ NODE *symbol, *tree;
memset(symbol->var_array, '\0',
sizeof(NODE *) * symbol->array_size);
symbol->table_size = symbol->array_size = 0;
- free(symbol->var_array);
+ symbol->flags &= ~ARRAYMAXED;
+ free((char *) symbol->var_array);
symbol->var_array = NULL;
}
}
@@ -378,32 +389,54 @@ assoc_scan(symbol, lookat)
NODE *symbol;
struct search *lookat;
{
- if (symbol->var_array == NULL) {
- lookat->retval = NULL;
- return;
- }
- lookat->arr_ptr = symbol->var_array;
- lookat->arr_end = lookat->arr_ptr + symbol->array_size;
- lookat->bucket = symbol->var_array[0];
- assoc_next(lookat);
+ lookat->sym = symbol;
+ lookat->idx = 0;
+ lookat->bucket = NULL;
+ lookat->retval = NULL;
+ if (symbol->var_array != NULL)
+ assoc_next(lookat);
}
void
assoc_next(lookat)
struct search *lookat;
{
- while (lookat->arr_ptr < lookat->arr_end) {
- if (lookat->bucket != 0) {
- lookat->retval = lookat->bucket->ahname;
- lookat->bucket = lookat->bucket->ahnext;
+ register NODE *symbol = lookat->sym;
+
+ if (symbol == NULL)
+ fatal("null symbol in assoc_next");
+ if (symbol->var_array == NULL || lookat->idx > symbol->array_size) {
+ lookat->retval = NULL;
+ return;
+ }
+ /*
+ * This is theoretically unsafe. The element bucket might have
+ * been freed if the body of the scan did a delete on the next
+ * element of the bucket. The only way to do that is by array
+ * reference, which is unlikely. Basically, if the user is doing
+ * anything other than an operation on the current element of an
+ * assoc array while walking through it sequentially, all bets are
+ * off. (The safe way is to register all search structs on an
+ * array with the array, and update all of them on a delete or
+ * insert)
+ */
+ if (lookat->bucket != NULL) {
+ lookat->retval = lookat->bucket->ahname;
+ lookat->bucket = lookat->bucket->ahnext;
+ return;
+ }
+ for (; lookat->idx < symbol->array_size; lookat->idx++) {
+ NODE *bucket;
+
+ if ((bucket = symbol->var_array[lookat->idx]) != NULL) {
+ lookat->retval = bucket->ahname;
+ lookat->bucket = bucket->ahnext;
+ lookat->idx++;
return;
}
- lookat->arr_ptr++;
- if (lookat->arr_ptr < lookat->arr_end)
- lookat->bucket = *(lookat->arr_ptr);
- else
- lookat->retval = NULL;
}
+ lookat->retval = NULL;
+ lookat->bucket = NULL;
return;
}
diff --git a/atari/config.h b/atari/config.h
index 28c855bd..48eaf0f1 100644
--- a/atari/config.h
+++ b/atari/config.h
@@ -11,45 +11,11 @@
#define SZTC (size_t)
#define INTC (int)
-#define HAVE_STRING_H 1 /* have <string.h> */
-#ifdef HAVE_STRING_H
-#undef NEED_MEMORY_H /* need <memory.h> to declare memcpy() et al. */
-#endif
-
-#define STDC_HEADERS 1 /* have the usual ANSI header files */
-#undef HAVE_UNISTD_H /* have <unistd.h> */
-#undef HAVE_ALLOCA_H /* have <alloca.h> -- only used if bison is used */
-#undef HAVE_SIGNUM_H /* have <signum.h> */
-#undef REGEX_MALLOC /* don't use alloca in regex.c */
-
-#define HAVE_VPRINTF 1 /* have vprintf() */
-
-#define HAVE_RANDOM 1 /* have random(), or using missing/random.c */
-
-#define HAVE_STRCHR 1 /* have strchr() and strrchr() */
-#ifndef HAVE_STRCHR
-#ifdef HAVE_RINDEX /* use index() and rindex() if present */
-#define strchr index
-#define strrchr rindex
-#endif
-#endif
-
-#define HAVE_FMOD 1 /* have fmod(), otherwise use modf() */
-
-#define HAVE_MEMCPY 1 /* have memcpy() et al. */
-
-#define HAVE_ST_BLKSIZE 1 /* have st_blksize member in the stat(2) structure */
-
-#define HAVE_STRFTIME 1
-
-#define HAVE_STRINGIZE 1 /* have ANSI "stringizing" capability */
+#define STDC_HEADERS 1 /* have the usual ANSI header files */
+#undef REGEX_MALLOC /* use alloca in regex.c */
#undef __CHAR_UNSIGNED__ /* default char is signed */
-#define RETSIGTYPE void /* type used in signal() */
-#define SPRINTF_RET int /* type returned by sprintf() */
-
-#undef _ALL_SOURCE /* on AIX, used to get some BSD functions */
/*
* srandom already has a prototype defined - don't redefine it
*/
diff --git a/awk.h b/awk.h
index 5db87c59..27118f9f 100644
--- a/awk.h
+++ b/awk.h
@@ -24,8 +24,12 @@
*/
/* ------------------------------ Includes ------------------------------ */
+#include "config.h"
+
#include <stdio.h>
+#ifndef LIMITS_H_MISSING
#include <limits.h>
+#endif
#include <ctype.h>
#include <setjmp.h>
#include <varargs.h>
@@ -53,8 +57,6 @@ extern int errno;
#include <signal.h>
-#include "config.h"
-
#ifdef __STDC__
#define P(s) s
#define MALLOC_ARG_T size_t
@@ -154,7 +156,7 @@ extern FILE *popen P((const char *,const char *));
extern int pclose P((FILE *));
extern void vms_arg_fixup P((int *,char ***));
/* some things not in STDC_HEADERS */
-extern int gnu_strftime P((char *,size_t,const char *,const struct tm *));
+extern size_t gnu_strftime P((char *,size_t,const char *,const struct tm *));
extern int unlink P((const char *));
extern int getopt P((int,char **,char *));
extern int isatty P((int));
@@ -196,21 +198,7 @@ extern int _text_read (int, char *, int);
#define ENVSEP ':'
#endif
-#define DEFAULT_G_PRECISION 6
-
-/* semi-temporary hack, mostly to gracefully handle VMS */
-#ifdef GFMT_WORKAROUND
-extern void sgfmt P((char *, const char *, int, int, int, double)); /* builtin.c */
-
-/* Partial fix, to handle the most common case. */
-#define NUMTOSTR(str, format, num) \
- if (strcmp((format), "%.6g") == 0 || strcmp((format), "%g") == 0) \
- sgfmt(str, "%*.*g", 0, 1, DEFAULT_G_PRECISION, num); \
- else \
- (void) sprintf(str, format, num) /* NOTE: no semi-colon! */
-#else
-#define NUMTOSTR(str, format, num) (void) sprintf(str, format, num)
-#endif /* GFMT_WORKAROUND */
+extern double double_to_int P((double d));
/* ------------------ Constants, Structures, Typedefs ------------------ */
#define AWKNUM double
@@ -460,8 +448,8 @@ typedef struct for_loop_header {
/* for "for(iggy in foo) {" */
struct search {
- NODE **arr_ptr;
- NODE **arr_end;
+ NODE *sym;
+ size_t idx;
NODE *bucket;
NODE *retval;
};
@@ -519,13 +507,25 @@ struct src {
/* Return means return from a function call; leave value in ret_node */
#define TAG_RETURN 3
+#ifndef INT_MAX
+#define INT_MAX (~(1 << (sizeof (int) * 8 - 1)))
+#endif
+#ifndef LONG_MAX
+#define LONG_MAX (~(1 << (sizeof (long) * 8 - 1)))
+#endif
+#ifndef ULONG_MAX
+#define ULONG_MAX (~(unsigned long)0)
+#endif
+#ifndef LONG_MIN
+#define LONG_MIN (-LONG_MAX - 1)
+#endif
#define HUGE INT_MAX
/* -------------------------- External variables -------------------------- */
/* gawk builtin variables */
-extern int NF;
-extern int NR;
-extern int FNR;
+extern long NF;
+extern long NR;
+extern long FNR;
extern int IGNORECASE;
extern char *RS;
extern char *OFS;
@@ -583,12 +583,11 @@ extern int in_end_rule;
#else
#define get_lhs(p, a) ((p)->type == Node_var ? (&(p)->var_value) : \
r_get_lhs((p), (a)))
-#define tree_eval(t) (_t = (t),(_t) == NULL ? Nnull_string : \
- ((_t)->type == Node_val ? (_t) : \
- ((_t)->type == Node_var ? (_t)->var_value : \
- ((_t)->type == Node_param_list ? \
- (stack_ptr[(_t)->param_cnt])->var_value : \
- r_tree_eval((_t))))))
+#define tree_eval(t) (_t = (t),_t == NULL ? Nnull_string : \
+ (_t->type == Node_param_list ? r_tree_eval(_t) : \
+ (_t->type == Node_val ? _t : \
+ (_t->type == Node_var ? _t->var_value : \
+ r_tree_eval(_t)))))
#endif
#define make_number(x) mk_number((x), (unsigned int)(MALLOC|NUM|NUMBER))
diff --git a/awk.y b/awk.y
index 504bd2b0..175cea90 100644
--- a/awk.y
+++ b/awk.y
@@ -163,6 +163,7 @@ program
}
| error { $$ = NULL; }
| program error { $$ = NULL; }
+ | /* empty */ { $$ = NULL; }
;
rule
@@ -718,7 +719,11 @@ non_post_simp_exp
$$ = node ($2, Node_unary_minus, (NODE *)NULL);
}
| '+' simp_exp %prec UNARY
- { $$ = $2; }
+ {
+ /* was: $$ = $2 */
+ /* POSIX semantics: force a conversion to numeric type */
+ $$ = node (make_number(0.0), Node_plus, $2);
+ }
;
opt_variable
@@ -852,7 +857,7 @@ va_dcl
errcount++;
/* Find the current line in the input file */
- if (lexptr) {
+ if (lexptr && lexeme) {
if (!thisline) {
cp = lexeme;
if (*cp == '\n') {
@@ -860,7 +865,7 @@ va_dcl
mesg = "unexpected newline";
}
for ( ; cp != lexptr_begin && *cp != '\n'; --cp)
- ;
+ continue;
if (*cp == '\n')
cp++;
thisline = cp;
@@ -908,12 +913,22 @@ get_src_buf()
static int did_newline = 0;
# define SLOP 128 /* enough space to hold most source lines */
+again:
if (nextfile > numfiles)
return NULL;
if (srcfiles[nextfile].stype == CMDLINE) {
if (len == 0) {
len = strlen(srcfiles[nextfile].val);
+ if (len == 0) {
+ /*
+ * Yet Another Special case:
+ * gawk '' /path/name
+ * Sigh.
+ */
+ ++nextfile;
+ goto again;
+ }
sourceline = 1;
lexptr = lexptr_begin = srcfiles[nextfile].val;
lexend = lexptr + len;
@@ -999,6 +1014,7 @@ get_src_buf()
if (n == 0) {
samefile = 0;
nextfile++;
+ *lexeme = '\0';
len = 0;
return get_src_buf();
}
@@ -1115,7 +1131,7 @@ yylex()
}
retry:
while ((c = nextc()) == ' ' || c == '\t')
- ;
+ continue;
lexeme = lexptr ? lexptr - 1 : lexptr;
thisline = NULL;
@@ -1430,7 +1446,7 @@ retry:
break;
if (c == '#') {
while ((c = nextc()) != '\n' && c != '\0')
- ;
+ continue;
if (c == '\0')
break;
}
@@ -1456,7 +1472,7 @@ retry:
break;
if (c == '#') {
while ((c = nextc()) != '\n' && c != '\0')
- ;
+ continue;
if (c == '\0')
break;
}
@@ -1524,6 +1540,7 @@ retry:
else
yylval.nodetypeval = tokentab[mid].value;
+ free(tokkey);
return tokentab[mid].class;
}
}
diff --git a/awktab.c b/awktab.c
index 20f19dbe..19e4a38b 100644
--- a/awktab.c
+++ b/awktab.c
@@ -164,100 +164,100 @@ static const char yytranslate[] = { 0,
#if YYDEBUG != 0
static const short yyprhs[] = { 0,
- 0, 4, 6, 9, 11, 14, 15, 19, 20, 24,
- 27, 30, 33, 35, 38, 41, 43, 45, 47, 49,
- 51, 52, 60, 65, 67, 71, 72, 77, 83, 88,
- 90, 93, 95, 98, 100, 103, 106, 109, 113, 115,
- 122, 131, 140, 151, 161, 164, 167, 174, 179, 183,
- 187, 188, 193, 200, 204, 207, 209, 211, 218, 228,
- 230, 233, 234, 236, 237, 240, 241, 244, 247, 250,
- 251, 253, 255, 259, 261, 264, 268, 269, 271, 272,
- 274, 276, 280, 282, 285, 289, 293, 294, 296, 298,
- 302, 304, 307, 311, 315, 316, 321, 327, 332, 336,
- 340, 344, 348, 350, 353, 357, 361, 365, 369, 375,
- 377, 380, 381, 386, 390, 394, 398, 400, 403, 407,
- 411, 415, 421, 423, 426, 428, 432, 436, 440, 444,
- 448, 452, 455, 458, 461, 465, 470, 475, 477, 482,
- 484, 487, 490, 492, 494, 497, 500, 501, 503, 505,
- 510, 513, 516, 519, 521, 522, 524, 526
+ 0, 4, 6, 9, 11, 14, 15, 16, 20, 21,
+ 25, 28, 31, 34, 36, 39, 42, 44, 46, 48,
+ 50, 52, 53, 61, 66, 68, 72, 73, 78, 84,
+ 89, 91, 94, 96, 99, 101, 104, 107, 110, 114,
+ 116, 123, 132, 141, 152, 162, 165, 168, 175, 180,
+ 184, 188, 189, 194, 201, 205, 208, 210, 212, 219,
+ 229, 231, 234, 235, 237, 238, 241, 242, 245, 248,
+ 251, 252, 254, 256, 260, 262, 265, 269, 270, 272,
+ 273, 275, 277, 281, 283, 286, 290, 294, 295, 297,
+ 299, 303, 305, 308, 312, 316, 317, 322, 328, 333,
+ 337, 341, 345, 349, 351, 354, 358, 362, 366, 370,
+ 376, 378, 381, 382, 387, 391, 395, 399, 401, 404,
+ 408, 412, 416, 422, 424, 427, 429, 433, 437, 441,
+ 445, 449, 453, 456, 459, 462, 466, 471, 476, 478,
+ 483, 485, 488, 491, 493, 495, 498, 501, 502, 504,
+ 506, 511, 514, 517, 520, 522, 523, 525, 527
};
#endif
static const short yyrhs[] = { 82,
62, 82, 0, 63, 0, 62, 63, 0, 1, 0,
- 62, 1, 0, 0, 15, 64, 74, 0, 0, 16,
- 65, 74, 0, 15, 76, 0, 16, 76, 0, 71,
- 74, 0, 74, 0, 71, 76, 0, 68, 70, 0,
- 4, 0, 3, 0, 67, 0, 37, 0, 38, 0,
- 0, 30, 69, 66, 54, 85, 102, 82, 0, 100,
- 75, 101, 103, 0, 92, 0, 92, 41, 92, 0,
- 0, 48, 73, 5, 48, 0, 100, 75, 101, 103,
- 82, 0, 100, 101, 103, 82, 0, 77, 0, 75,
- 77, 0, 1, 0, 75, 1, 0, 81, 0, 104,
- 82, 0, 104, 82, 0, 100, 101, 0, 100, 75,
- 101, 0, 80, 0, 21, 54, 92, 102, 82, 77,
- 0, 22, 82, 77, 21, 54, 92, 102, 82, 0,
- 23, 54, 4, 32, 4, 102, 82, 77, 0, 23,
- 54, 87, 104, 92, 104, 87, 102, 82, 77, 0,
- 23, 54, 87, 104, 104, 87, 102, 82, 77, 0,
- 24, 76, 0, 25, 76, 0, 79, 54, 91, 102,
- 84, 76, 0, 79, 88, 84, 76, 0, 28, 87,
- 76, 0, 29, 87, 76, 0, 0, 19, 78, 87,
- 76, 0, 20, 4, 56, 91, 57, 76, 0, 20,
- 4, 76, 0, 92, 76, 0, 26, 0, 27, 0,
- 17, 54, 92, 102, 82, 77, 0, 17, 54, 92,
- 102, 82, 77, 18, 82, 77, 0, 13, 0, 81,
- 13, 0, 0, 81, 0, 0, 42, 96, 0, 0,
- 43, 92, 0, 10, 92, 0, 44, 92, 0, 0,
- 86, 0, 4, 0, 86, 105, 4, 0, 1, 0,
- 86, 1, 0, 86, 105, 1, 0, 0, 92, 0,
- 0, 89, 0, 94, 0, 89, 105, 94, 0, 1,
- 0, 89, 1, 0, 89, 1, 94, 0, 89, 105,
- 1, 0, 0, 91, 0, 92, 0, 91, 105, 92,
- 0, 1, 0, 91, 1, 0, 91, 1, 92, 0,
- 91, 105, 1, 0, 0, 99, 11, 93, 92, 0,
- 54, 91, 102, 32, 4, 0, 92, 44, 31, 98,
- 0, 31, 98, 83, 0, 92, 33, 92, 0, 92,
- 34, 92, 0, 92, 12, 92, 0, 72, 0, 50,
- 72, 0, 92, 32, 4, 0, 92, 9, 92, 0,
- 92, 42, 92, 0, 92, 43, 92, 0, 92, 39,
- 92, 40, 92, 0, 96, 0, 92, 96, 0, 0,
- 99, 11, 95, 94, 0, 94, 33, 94, 0, 94,
- 34, 94, 0, 31, 98, 83, 0, 72, 0, 50,
- 72, 0, 94, 12, 94, 0, 94, 32, 4, 0,
- 94, 9, 94, 0, 94, 39, 94, 40, 94, 0,
- 96, 0, 94, 96, 0, 97, 0, 96, 52, 96,
- 0, 96, 47, 96, 0, 96, 48, 96, 0, 96,
- 49, 96, 0, 96, 45, 96, 0, 96, 46, 96,
- 0, 99, 35, 0, 99, 36, 0, 50, 96, 0,
- 54, 92, 102, 0, 37, 54, 90, 102, 0, 38,
- 54, 90, 102, 0, 38, 0, 3, 54, 90, 102,
- 0, 99, 0, 35, 99, 0, 36, 99, 0, 7,
- 0, 8, 0, 46, 96, 0, 45, 96, 0, 0,
- 99, 0, 4, 0, 4, 56, 91, 57, 0, 53,
- 97, 0, 58, 82, 0, 59, 82, 0, 55, 0,
- 0, 104, 0, 60, 0, 41, 82, 0
+ 62, 1, 0, 0, 0, 15, 64, 74, 0, 0,
+ 16, 65, 74, 0, 15, 76, 0, 16, 76, 0,
+ 71, 74, 0, 74, 0, 71, 76, 0, 68, 70,
+ 0, 4, 0, 3, 0, 67, 0, 37, 0, 38,
+ 0, 0, 30, 69, 66, 54, 85, 102, 82, 0,
+ 100, 75, 101, 103, 0, 92, 0, 92, 41, 92,
+ 0, 0, 48, 73, 5, 48, 0, 100, 75, 101,
+ 103, 82, 0, 100, 101, 103, 82, 0, 77, 0,
+ 75, 77, 0, 1, 0, 75, 1, 0, 81, 0,
+ 104, 82, 0, 104, 82, 0, 100, 101, 0, 100,
+ 75, 101, 0, 80, 0, 21, 54, 92, 102, 82,
+ 77, 0, 22, 82, 77, 21, 54, 92, 102, 82,
+ 0, 23, 54, 4, 32, 4, 102, 82, 77, 0,
+ 23, 54, 87, 104, 92, 104, 87, 102, 82, 77,
+ 0, 23, 54, 87, 104, 104, 87, 102, 82, 77,
+ 0, 24, 76, 0, 25, 76, 0, 79, 54, 91,
+ 102, 84, 76, 0, 79, 88, 84, 76, 0, 28,
+ 87, 76, 0, 29, 87, 76, 0, 0, 19, 78,
+ 87, 76, 0, 20, 4, 56, 91, 57, 76, 0,
+ 20, 4, 76, 0, 92, 76, 0, 26, 0, 27,
+ 0, 17, 54, 92, 102, 82, 77, 0, 17, 54,
+ 92, 102, 82, 77, 18, 82, 77, 0, 13, 0,
+ 81, 13, 0, 0, 81, 0, 0, 42, 96, 0,
+ 0, 43, 92, 0, 10, 92, 0, 44, 92, 0,
+ 0, 86, 0, 4, 0, 86, 105, 4, 0, 1,
+ 0, 86, 1, 0, 86, 105, 1, 0, 0, 92,
+ 0, 0, 89, 0, 94, 0, 89, 105, 94, 0,
+ 1, 0, 89, 1, 0, 89, 1, 94, 0, 89,
+ 105, 1, 0, 0, 91, 0, 92, 0, 91, 105,
+ 92, 0, 1, 0, 91, 1, 0, 91, 1, 92,
+ 0, 91, 105, 1, 0, 0, 99, 11, 93, 92,
+ 0, 54, 91, 102, 32, 4, 0, 92, 44, 31,
+ 98, 0, 31, 98, 83, 0, 92, 33, 92, 0,
+ 92, 34, 92, 0, 92, 12, 92, 0, 72, 0,
+ 50, 72, 0, 92, 32, 4, 0, 92, 9, 92,
+ 0, 92, 42, 92, 0, 92, 43, 92, 0, 92,
+ 39, 92, 40, 92, 0, 96, 0, 92, 96, 0,
+ 0, 99, 11, 95, 94, 0, 94, 33, 94, 0,
+ 94, 34, 94, 0, 31, 98, 83, 0, 72, 0,
+ 50, 72, 0, 94, 12, 94, 0, 94, 32, 4,
+ 0, 94, 9, 94, 0, 94, 39, 94, 40, 94,
+ 0, 96, 0, 94, 96, 0, 97, 0, 96, 52,
+ 96, 0, 96, 47, 96, 0, 96, 48, 96, 0,
+ 96, 49, 96, 0, 96, 45, 96, 0, 96, 46,
+ 96, 0, 99, 35, 0, 99, 36, 0, 50, 96,
+ 0, 54, 92, 102, 0, 37, 54, 90, 102, 0,
+ 38, 54, 90, 102, 0, 38, 0, 3, 54, 90,
+ 102, 0, 99, 0, 35, 99, 0, 36, 99, 0,
+ 7, 0, 8, 0, 46, 96, 0, 45, 96, 0,
+ 0, 99, 0, 4, 0, 4, 56, 91, 57, 0,
+ 53, 97, 0, 58, 82, 0, 59, 82, 0, 55,
+ 0, 0, 104, 0, 60, 0, 41, 82, 0
};
#if YYDEBUG != 0
static const short yyrline[] = { 0,
- 135, 140, 148, 164, 165, 169, 171, 185, 187, 201,
- 207, 213, 215, 217, 230, 239, 241, 243, 253, 254,
- 258, 262, 270, 279, 281, 290, 292, 310, 312, 317,
- 319, 327, 329, 334, 335, 339, 341, 343, 345, 347,
- 349, 351, 356, 360, 365, 368, 371, 373, 384, 411,
- 413, 415, 417, 419, 433, 438, 440, 445, 450, 457,
- 459, 463, 464, 468, 470, 475, 477, 479, 481, 486,
- 488, 493, 495, 497, 499, 501, 507, 509, 514, 516,
- 521, 523, 529, 531, 533, 535, 540, 542, 547, 549,
- 555, 557, 559, 561, 566, 569, 574, 576, 581, 587,
- 589, 591, 597, 599, 607, 609, 615, 617, 619, 621,
- 623, 628, 631, 632, 634, 636, 642, 644, 646, 648,
- 650, 652, 654, 656, 661, 663, 665, 667, 669, 671,
- 673, 675, 677, 682, 684, 686, 689, 691, 699, 703,
- 704, 706, 708, 710, 713, 720, 725, 727, 732, 734,
- 742, 747, 751, 755, 759, 760, 764, 767
+ 135, 140, 148, 164, 165, 166, 170, 172, 186, 188,
+ 202, 208, 214, 216, 218, 231, 240, 242, 244, 254,
+ 255, 259, 263, 271, 280, 282, 291, 293, 311, 313,
+ 318, 320, 328, 330, 335, 336, 340, 342, 344, 346,
+ 348, 350, 352, 357, 361, 366, 369, 372, 374, 385,
+ 412, 414, 416, 418, 420, 434, 439, 441, 446, 451,
+ 458, 460, 464, 465, 469, 471, 476, 478, 480, 482,
+ 487, 489, 494, 496, 498, 500, 502, 508, 510, 515,
+ 517, 522, 524, 530, 532, 534, 536, 541, 543, 548,
+ 550, 556, 558, 560, 562, 567, 570, 575, 577, 582,
+ 588, 590, 592, 598, 600, 608, 610, 616, 618, 620,
+ 622, 624, 629, 632, 633, 635, 637, 643, 645, 647,
+ 649, 651, 653, 655, 657, 662, 664, 666, 668, 670,
+ 672, 674, 676, 678, 683, 685, 687, 690, 692, 700,
+ 704, 705, 707, 709, 711, 714, 721, 730, 732, 737,
+ 739, 747, 752, 756, 760, 764, 765, 769, 772
};
static const char * const yytname[] = { "$","error","$illegal.","FUNC_CALL",
@@ -278,75 +278,75 @@ static const char * const yytname[] = { "$","error","$illegal.","FUNC_CALL",
#endif
static const short yyr1[] = { 0,
- 61, 62, 62, 62, 62, 64, 63, 65, 63, 63,
- 63, 63, 63, 63, 63, 66, 66, 66, 67, 67,
- 69, 68, 70, 71, 71, 73, 72, 74, 74, 75,
- 75, 75, 75, 76, 76, 77, 77, 77, 77, 77,
+ 61, 62, 62, 62, 62, 62, 64, 63, 65, 63,
+ 63, 63, 63, 63, 63, 63, 66, 66, 66, 67,
+ 67, 69, 68, 70, 71, 71, 73, 72, 74, 74,
+ 75, 75, 75, 75, 76, 76, 77, 77, 77, 77,
77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
- 78, 77, 77, 77, 77, 79, 79, 80, 80, 81,
- 81, 82, 82, 83, 83, 84, 84, 84, 84, 85,
- 85, 86, 86, 86, 86, 86, 87, 87, 88, 88,
- 89, 89, 89, 89, 89, 89, 90, 90, 91, 91,
- 91, 91, 91, 91, 93, 92, 92, 92, 92, 92,
+ 77, 78, 77, 77, 77, 77, 79, 79, 80, 80,
+ 81, 81, 82, 82, 83, 83, 84, 84, 84, 84,
+ 85, 85, 86, 86, 86, 86, 86, 87, 87, 88,
+ 88, 89, 89, 89, 89, 89, 89, 90, 90, 91,
+ 91, 91, 91, 91, 91, 93, 92, 92, 92, 92,
92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
- 92, 95, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 97, 97, 97, 97, 97, 97, 97,
- 97, 97, 97, 97, 97, 97, 98, 98, 99, 99,
- 99, 100, 101, 102, 103, 103, 104, 105
+ 92, 92, 95, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 97, 97, 98, 98, 99,
+ 99, 99, 100, 101, 102, 103, 103, 104, 105
};
static const short yyr2[] = { 0,
- 3, 1, 2, 1, 2, 0, 3, 0, 3, 2,
- 2, 2, 1, 2, 2, 1, 1, 1, 1, 1,
- 0, 7, 4, 1, 3, 0, 4, 5, 4, 1,
- 2, 1, 2, 1, 2, 2, 2, 3, 1, 6,
- 8, 8, 10, 9, 2, 2, 6, 4, 3, 3,
- 0, 4, 6, 3, 2, 1, 1, 6, 9, 1,
- 2, 0, 1, 0, 2, 0, 2, 2, 2, 0,
- 1, 1, 3, 1, 2, 3, 0, 1, 0, 1,
- 1, 3, 1, 2, 3, 3, 0, 1, 1, 3,
- 1, 2, 3, 3, 0, 4, 5, 4, 3, 3,
- 3, 3, 1, 2, 3, 3, 3, 3, 5, 1,
- 2, 0, 4, 3, 3, 3, 1, 2, 3, 3,
- 3, 5, 1, 2, 1, 3, 3, 3, 3, 3,
- 3, 2, 2, 2, 3, 4, 4, 1, 4, 1,
- 2, 2, 1, 1, 2, 2, 0, 1, 1, 4,
- 2, 2, 2, 1, 0, 1, 1, 2
+ 3, 1, 2, 1, 2, 0, 0, 3, 0, 3,
+ 2, 2, 2, 1, 2, 2, 1, 1, 1, 1,
+ 1, 0, 7, 4, 1, 3, 0, 4, 5, 4,
+ 1, 2, 1, 2, 1, 2, 2, 2, 3, 1,
+ 6, 8, 8, 10, 9, 2, 2, 6, 4, 3,
+ 3, 0, 4, 6, 3, 2, 1, 1, 6, 9,
+ 1, 2, 0, 1, 0, 2, 0, 2, 2, 2,
+ 0, 1, 1, 3, 1, 2, 3, 0, 1, 0,
+ 1, 1, 3, 1, 2, 3, 3, 0, 1, 1,
+ 3, 1, 2, 3, 3, 0, 4, 5, 4, 3,
+ 3, 3, 3, 1, 2, 3, 3, 3, 3, 5,
+ 1, 2, 0, 4, 3, 3, 3, 1, 2, 3,
+ 3, 3, 5, 1, 2, 1, 3, 3, 3, 3,
+ 3, 3, 2, 2, 2, 3, 4, 4, 1, 4,
+ 1, 2, 2, 1, 1, 2, 2, 0, 1, 1,
+ 4, 2, 2, 2, 1, 0, 1, 1, 2
};
-static const short yydefact[] = { 62,
- 60, 63, 0, 61, 4, 0, 149, 143, 144, 6,
- 8, 21, 147, 0, 0, 0, 138, 0, 0, 26,
- 0, 0, 0, 62, 0, 2, 0, 0, 103, 13,
- 24, 110, 125, 140, 0, 0, 0, 157, 0, 10,
- 34, 62, 0, 11, 0, 64, 148, 141, 142, 0,
- 0, 0, 0, 146, 140, 145, 0, 104, 134, 151,
- 140, 91, 0, 89, 152, 5, 3, 1, 15, 0,
- 12, 14, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 111, 0, 0, 0, 0, 0, 0, 95,
- 132, 133, 32, 0, 51, 0, 0, 62, 0, 0,
- 0, 56, 57, 77, 77, 62, 0, 30, 0, 39,
- 0, 0, 155, 62, 0, 0, 89, 0, 7, 35,
- 9, 17, 16, 19, 20, 0, 18, 0, 99, 0,
- 0, 0, 0, 92, 62, 154, 0, 0, 135, 0,
- 106, 102, 105, 100, 101, 0, 25, 107, 108, 147,
- 130, 131, 127, 128, 129, 126, 0, 0, 77, 0,
- 0, 0, 77, 45, 46, 0, 78, 0, 153, 33,
- 31, 155, 83, 147, 0, 0, 117, 66, 0, 81,
- 123, 140, 55, 0, 37, 62, 156, 36, 139, 150,
- 0, 65, 136, 137, 27, 93, 158, 0, 94, 90,
- 155, 0, 98, 96, 0, 0, 0, 54, 0, 0,
- 149, 0, 49, 50, 62, 64, 118, 0, 0, 0,
- 0, 0, 84, 0, 0, 0, 0, 0, 0, 0,
- 124, 112, 38, 29, 74, 72, 0, 0, 97, 23,
- 109, 62, 52, 0, 62, 0, 0, 0, 28, 116,
- 66, 68, 67, 69, 48, 85, 86, 82, 121, 119,
- 120, 114, 115, 0, 0, 62, 75, 0, 0, 0,
- 0, 0, 0, 0, 77, 0, 0, 113, 22, 76,
- 73, 58, 53, 40, 0, 62, 77, 0, 47, 122,
- 62, 62, 0, 0, 62, 0, 41, 42, 62, 0,
- 59, 0, 44, 43, 0, 0, 0
+static const short yydefact[] = { 63,
+ 61, 64, 0, 62, 4, 0, 150, 144, 145, 7,
+ 9, 22, 148, 0, 0, 0, 139, 0, 0, 27,
+ 0, 0, 0, 63, 0, 2, 0, 0, 104, 14,
+ 25, 111, 126, 141, 0, 0, 0, 158, 0, 11,
+ 35, 63, 0, 12, 0, 65, 149, 142, 143, 0,
+ 0, 0, 0, 147, 141, 146, 0, 105, 135, 152,
+ 141, 92, 0, 90, 153, 5, 3, 1, 16, 0,
+ 13, 15, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 112, 0, 0, 0, 0, 0, 0, 96,
+ 133, 134, 33, 0, 52, 0, 0, 63, 0, 0,
+ 0, 57, 58, 78, 78, 63, 0, 31, 0, 40,
+ 0, 0, 156, 63, 0, 0, 90, 0, 8, 36,
+ 10, 18, 17, 20, 21, 0, 19, 0, 100, 0,
+ 0, 0, 0, 93, 63, 155, 0, 0, 136, 0,
+ 107, 103, 106, 101, 102, 0, 26, 108, 109, 148,
+ 131, 132, 128, 129, 130, 127, 0, 0, 78, 0,
+ 0, 0, 78, 46, 47, 0, 79, 0, 154, 34,
+ 32, 156, 84, 148, 0, 0, 118, 67, 0, 82,
+ 124, 141, 56, 0, 38, 63, 157, 37, 140, 151,
+ 0, 66, 137, 138, 28, 94, 159, 0, 95, 91,
+ 156, 0, 99, 97, 0, 0, 0, 55, 0, 0,
+ 150, 0, 50, 51, 63, 65, 119, 0, 0, 0,
+ 0, 0, 85, 0, 0, 0, 0, 0, 0, 0,
+ 125, 113, 39, 30, 75, 73, 0, 0, 98, 24,
+ 110, 63, 53, 0, 63, 0, 0, 0, 29, 117,
+ 67, 69, 68, 70, 49, 86, 87, 83, 122, 120,
+ 121, 115, 116, 0, 0, 63, 76, 0, 0, 0,
+ 0, 0, 0, 0, 78, 0, 0, 114, 23, 77,
+ 74, 59, 54, 41, 0, 63, 78, 0, 48, 123,
+ 63, 63, 0, 0, 63, 0, 42, 43, 63, 0,
+ 60, 0, 45, 44, 0, 0, 0
};
static const short yydefgoto[] = { 305,
@@ -358,37 +358,37 @@ static const short yydefgoto[] = { 305,
};
static const short yypact[] = { 6,
--32768, 10, 1082,-32768,-32768, -33, -16,-32768,-32768, 4,
- 4,-32768, 31, 31, 31, 14, 44, 1746, 1746,-32768,
- 1740, 1746, 1155, 6, 874,-32768, 46, 0,-32768,-32768,
- 1324, 284,-32768, 18, 654, 433, 1155,-32768, 46,-32768,
+-32768, 10, 874,-32768,-32768, -33, -16,-32768,-32768, 4,
+ 4,-32768, 31, 31, 31, 14, 44, 1749, 1749,-32768,
+ 1743, 1749, 1158, 6, 930,-32768, 46, 0,-32768,-32768,
+ 1327, 284,-32768, 18, 654, 433, 1158,-32768, 46,-32768,
10, 6, 46,-32768, 88, 65,-32768,-32768,-32768, 433,
- 433, 1746, 1536, 59, 58, 59, 111,-32768, 59,-32768,
--32768,-32768, 40, 1271,-32768,-32768,-32768,-32768,-32768, 790,
--32768,-32768, 1536, 1536, 117, 1536, 1536, 1536, 1536, 1536,
- 1536, 99, 284, 1746, 1746, 1746, 1746, 1746, 1746,-32768,
+ 433, 1749, 1539, 59, 58, 59, 111,-32768, 59,-32768,
+-32768,-32768, 40, 1274,-32768,-32768,-32768,-32768,-32768, 790,
+-32768,-32768, 1539, 1539, 117, 1539, 1539, 1539, 1539, 1539,
+ 1539, 99, 284, 1749, 1749, 1749, 1749, 1749, 1749,-32768,
-32768,-32768,-32768, 69,-32768, 132, 79, 6, 83, 4,
- 4,-32768,-32768, 1536, 1536, 6, 742,-32768, 848,-32768,
- 980, 654, 80, 6, 84, 42, 1420, 8,-32768,-32768,
--32768,-32768,-32768,-32768,-32768, 90,-32768, 1746,-32768, 84,
- 84, 1271, 97, 1536, 6,-32768, 106, 1175,-32768, 742,
- 1807, 1794,-32768, 1556, 1468, 1372, 1420, 1807, 1807, 31,
- 129, 129, 59, 59, 59, 59, 1536, 1536, 1536, 50,
- 1536, 922, 1664,-32768,-32768, 4, 1420, 4,-32768,-32768,
--32768, 80,-32768, 31, 1740, 1155,-32768, 75, 1, 1604,
+ 4,-32768,-32768, 1539, 1539, 6, 742,-32768, 848,-32768,
+ 1036, 654, 80, 6, 84, 42, 1423, 8,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768, 90,-32768, 1749,-32768, 84,
+ 84, 1274, 97, 1539, 6,-32768, 106, 1178,-32768, 742,
+ 1810, 1797,-32768, 1559, 1471, 1375, 1423, 1810, 1810, 31,
+ 129, 129, 59, 59, 59, 59, 1539, 1539, 1539, 50,
+ 1539, 978, 1667,-32768,-32768, 4, 1423, 4,-32768,-32768,
+-32768, 80,-32768, 31, 1743, 1158,-32768, 75, 1, 1607,
284, 92,-32768, 742,-32768, 6,-32768,-32768,-32768,-32768,
- 11, 284,-32768,-32768,-32768, 1420,-32768, 145,-32768, 1420,
- 80, 1536,-32768, 1420, 1271, 4, 1155,-32768, 1271, 138,
- 57, 80,-32768,-32768, 6, 65,-32768, 40, 1536, 1536,
- 1536, 4, 1720, 1223, 1720, 1720, 146, 1720, 1720, 1720,
+ 11, 284,-32768,-32768,-32768, 1423,-32768, 145,-32768, 1423,
+ 80, 1539,-32768, 1423, 1274, 4, 1158,-32768, 1274, 138,
+ 57, 80,-32768,-32768, 6, 65,-32768, 40, 1539, 1539,
+ 1539, 4, 1723, 1226, 1723, 1723, 146, 1723, 1723, 1723,
284,-32768,-32768,-32768,-32768,-32768, 84, 45,-32768,-32768,
- 1420, 6,-32768, 15, 6, 110, 149, 1107,-32768,-32768,
- 75, 1420, 1420, 1420,-32768, 1604,-32768, 1604, 549, 139,
--32768, 1684, 1644, 1516, 1720, 6,-32768, 35, 922, 4,
- 922, 1536, 84, 1034, 1536, 4, 1720, 1604,-32768,-32768,
--32768, 147,-32768,-32768, 1271, 6, 1536, 84,-32768, 1604,
- 6, 6, 922, 84, 6, 922,-32768,-32768, 6, 922,
--32768, 922,-32768,-32768, 172, 180,-32768
+ 1423, 6,-32768, 15, 6, 110, 149, 1110,-32768,-32768,
+ 75, 1423, 1423, 1423,-32768, 1607,-32768, 1607, 549, 139,
+-32768, 1687, 1647, 1519, 1723, 6,-32768, 35, 978, 4,
+ 978, 1539, 84, 1090, 1539, 4, 1723, 1607,-32768,-32768,
+-32768, 147,-32768,-32768, 1274, 6, 1539, 84,-32768, 1607,
+ 6, 6, 978, 84, 6, 978,-32768,-32768, 6, 978,
+-32768, 978,-32768,-32768, 172, 180,-32768
};
static const short yypgoto[] = {-32768,
@@ -400,20 +400,20 @@ static const short yypgoto[] = {-32768,
};
-#define YYLAST 1861
+#define YYLAST 1864
static const short yytable[] = { 31,
168, 223, 224, 63, 172, 65, 68, 215, 134, 185,
- -80, 235, 1, -80, 236, 134, 1, 118, 1, 64,
+ -81, 235, 1, -81, 236, 134, 1, 118, 1, 64,
36, 31, 4, 120, 256, 258, 259, 260, 90, 262,
263, 264, 117, 117, 7, 280, 240, 201, 281, 37,
- 134, 135, 134, -80, -80, 267, 117, 117, 135, 132,
+ 134, 135, 134, -81, -81, 267, 117, 117, 135, 132,
41, 41, 91, 92, 206, 135, 171, 24, 212, 38,
- -80, 268, 1, 38, 190, -70, 278, 50, 41, 141,
+ -81, 268, 1, 38, 190, -71, 278, 50, 41, 141,
142, 270, 144, 145, 146, 147, 148, 149, 290, 162,
135, 233, 135, 22, 219, 135, 140, 169, 247, 171,
- 122, 123, 91, 92, 136, 188, -88, 51, 58, -71,
+ 122, 123, 91, 92, 136, 188, -89, 51, 58, -72,
167, 167, 232, 24, 44, 207, 128, 203, 71, 38,
89, 210, 37, 130, 131, 133, 197, 220, 221, 119,
143, 72, 158, 121, 124, 125, 91, 92, 184, 150,
@@ -452,7 +452,7 @@ static const short yytable[] = { 31,
155, 156, 0, 193, 194, 0, 0, 0, 0, 0,
0, 0, 0, 13, 0, 0, 0, 14, 15, 16,
17, 181, 0, 83, 0, 0, 0, 18, 19, 83,
- 20, 0, 21, 0, 0, 22, 23, -87, 0, 0,
+ 20, 0, 21, 0, 0, 22, 23, -88, 0, 0,
192, 0, 114, 0, 83, 0, 0, 0, 0, 0,
0, 0, 0, 83, 83, 0, 83, 83, 83, 83,
83, 83, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -489,108 +489,108 @@ static const short yytable[] = { 31,
13, 0, 0, 0, 14, 15, 16, 17, 0, 0,
0, 0, 0, 0, 18, 19, 0, 20, 0, 21,
0, 0, 22, 23, 0, 0, 0, 24, 173, 38,
- 6, 7, 0, 0, 8, 9, 0, -79, 0, 0,
- -79, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, -62, 66, 0, 6, 7, 174, 0,
- 8, 9, 14, 15, 16, 17, 1, 0, 10, 11,
- -79, -79, 18, 19, 0, 20, 0, 175, 0, 0,
- 22, 176, 0, 12, 13, 0, 0, -79, 14, 15,
+ 6, 7, 0, 0, 8, 9, 0, -80, 0, 0,
+ -80, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, -6, 5, 0, 6, 7, 174, 0,
+ 8, 9, 14, 15, 16, 17, -6, 0, 10, 11,
+ -80, -80, 18, 19, 0, 20, 0, 175, 0, 0,
+ 22, 176, 0, 12, 13, 0, 0, -80, 14, 15,
16, 17, 0, 0, 0, 0, 0, 0, 18, 19,
- 0, 20, 0, 21, 6, 7, 22, 23, 8, 9,
- 0, 24, 0, 0, 0, 0, 0, 0, 94, 0,
- 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 105, 0, 13, 0, 0, 0, 14, 15, 16, 17,
- 0, 0, 0, 0, 0, 0, 18, 19, 0, 20,
- 0, 21, 0, 0, 22, 23, 0, 0, 0, 24,
- 0, 38, 6, 7, 0, 0, 8, 9, 73, 0,
- 0, 74, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 20, 0, 21, 0, 0, 22, 23, 0, -63,
+ 66, 24, 6, 7, 0, 0, 8, 9, 0, 0,
+ 0, 0, 1, 0, 10, 11, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
+ 13, 0, 0, 0, 14, 15, 16, 17, 0, 0,
+ 0, 0, 0, 0, 18, 19, 0, 20, 0, 21,
+ 6, 7, 22, 23, 8, 9, 0, 24, 0, 0,
+ 0, 0, 0, 0, 94, 0, 95, 96, 97, 98,
+ 99, 100, 101, 102, 103, 104, 105, 0, 13, 0,
+ 0, 0, 14, 15, 16, 17, 0, 0, 0, 0,
+ 0, 0, 18, 19, 0, 20, 0, 21, 0, 0,
+ 22, 23, 0, 0, 0, 24, 0, 38, 6, 7,
+ 0, 0, 8, 9, 73, 0, 0, 74, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 75, 76, 77,
+ 14, 15, 16, 17, 78, 0, 0, 80, 81, 82,
+ 18, 19, 0, 0, 0, 52, 0, 0, 22, 53,
+ 0, 0, 6, 7, 0, 38, 8, 9, 73, 0,
+ 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 7, 0, 0, 8, 9, 0, 0,
0, 75, 76, 77, 14, 15, 16, 17, 78, 0,
0, 80, 81, 82, 18, 19, 0, 0, 0, 52,
- 0, 0, 22, 53, 0, 0, 6, 7, 0, 38,
+ 13, 0, 22, 53, 14, 15, 16, 17, 0, 38,
+ 0, 0, 0, 0, 18, 19, 0, 20, 62, 21,
+ 6, 7, 22, 23, 8, 9, 0, 0, 0, 38,
+ 0, 0, 0, 0, 0, 0, 0, 0, 199, 0,
+ 6, 7, 0, 0, 8, 9, 0, 0, 13, 0,
+ 0, 0, 14, 15, 16, 17, 0, 0, 0, 0,
+ 0, 0, 18, 19, 0, 20, 0, 21, 13, 0,
+ 22, 23, 14, 15, 16, 17, 0, 0, 0, 0,
+ 0, 0, 18, 19, 0, 20, 257, 21, 6, 7,
+ 22, 23, 8, 9, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 174, 0, 0, 0,
+ 14, 15, 16, 17, 0, 0, 0, 0, 0, 0,
+ 18, 19, 0, 20, 0, 175, 6, 7, 22, 53,
8, 9, 73, 0, 0, 74, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 75, 76, 77, 14, 15,
16, 17, 78, 0, 0, 80, 81, 82, 18, 19,
- 0, 0, 5, 52, 6, 7, 22, 53, 8, 9,
- 0, 0, 0, 38, 0, 0, 10, 11, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,
- 7, 12, 13, 8, 9, 0, 14, 15, 16, 17,
- 0, 0, 0, 0, 0, 0, 18, 19, 0, 20,
- 0, 21, 0, 0, 22, 23, 0, 13, 0, 24,
- 0, 14, 15, 16, 17, 0, 0, 0, 0, 0,
- 0, 18, 19, 0, 20, 62, 21, 6, 7, 22,
- 23, 8, 9, 0, 0, 0, 38, 0, 0, 0,
- 0, 0, 0, 0, 0, 199, 0, 6, 7, 0,
- 0, 8, 9, 0, 0, 13, 0, 0, 0, 14,
- 15, 16, 17, 0, 0, 0, 0, 0, 0, 18,
- 19, 0, 20, 0, 21, 13, 0, 22, 23, 14,
- 15, 16, 17, 0, 0, 0, 0, 0, 0, 18,
- 19, 0, 20, 257, 21, 6, 7, 22, 23, 8,
- 9, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 174, 0, 0, 0, 14, 15, 16,
- 17, 0, 0, 0, 0, 0, 0, 18, 19, 0,
- 20, 0, 175, 6, 7, 22, 53, 8, 9, 73,
- 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 52, 0, 0, 22, 53, 136, 6,
+ 7, 0, 0, 8, 9, 73, 0, 0, 74, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 75, 76, 77, 14, 15, 16, 17, 78,
- 0, 0, 80, 81, 82, 18, 19, 0, 0, 0,
- 52, 0, 0, 22, 53, 136, 6, 7, 0, 0,
- 8, 9, 73, 0, 0, 74, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
+ 77, 14, 15, 16, 17, 78, 0, 79, 80, 81,
+ 82, 18, 19, 0, 0, 0, 52, 6, 7, 22,
+ 53, 8, 9, 73, 0, 0, 74, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 75, 76, 77, 14, 15,
- 16, 17, 78, 0, 79, 80, 81, 82, 18, 19,
- 0, 0, 0, 52, 6, 7, 22, 53, 8, 9,
- 73, 0, 0, 74, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 75, 76, 77, 14,
+ 15, 16, 17, 78, 202, 0, 80, 81, 82, 18,
+ 19, 0, 0, 0, 52, 6, 7, 22, 53, 8,
+ 9, 73, 0, 0, 74, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 75, 76, 77, 14, 15, 16, 17,
- 78, 202, 0, 80, 81, 82, 18, 19, 0, 0,
- 0, 52, 6, 7, 22, 53, 8, 9, 73, 0,
- 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 75, 76, 77, 14, 15, 16,
+ 17, 78, 0, 0, 80, 81, 82, 18, 19, 0,
+ 0, 0, 52, 6, 7, 22, 53, 8, 9, 73,
+ 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 75, 76, 77, 14, 15, 16, 17, 78, 0,
- 0, 80, 81, 82, 18, 19, 0, 0, 0, 52,
- 6, 7, 22, 53, 8, 9, 73, 0, 0, 74,
+ 0, 0, 75, 76, 0, 14, 15, 16, 17, 0,
+ 0, 0, 80, 81, 82, 18, 19, 0, 0, 0,
+ 52, 6, 7, 22, 53, 8, 9, 225, 0, 0,
+ 226, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 6, 7, 0, 0, 8, 9, 0, 0, 0,
+ 227, 228, 229, 14, 15, 16, 17, 230, 277, 0,
+ 0, 6, 7, 18, 19, 8, 9, 73, 52, 13,
+ 74, 22, 53, 14, 15, 16, 17, 0, 0, 0,
+ 0, 0, 0, 18, 19, 0, 20, 0, 21, 0,
+ 75, 22, 23, 14, 15, 16, 17, 0, 0, 0,
+ 80, 81, 82, 18, 19, 0, 0, 0, 52, 6,
+ 7, 22, 53, 8, 9, 225, 0, 0, 226, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
- 76, 0, 14, 15, 16, 17, 0, 0, 0, 80,
- 81, 82, 18, 19, 0, 0, 0, 52, 6, 7,
- 22, 53, 8, 9, 225, 0, 0, 226, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 6, 7,
- 0, 0, 8, 9, 0, 0, 0, 227, 228, 229,
- 14, 15, 16, 17, 230, 277, 0, 0, 6, 7,
- 18, 19, 8, 9, 73, 52, 13, 74, 22, 53,
- 14, 15, 16, 17, 0, 0, 0, 0, 0, 0,
- 18, 19, 0, 20, 0, 21, 0, 75, 22, 23,
- 14, 15, 16, 17, 0, 0, 0, 80, 81, 82,
- 18, 19, 0, 0, 0, 52, 6, 7, 22, 53,
- 8, 9, 225, 0, 0, 226, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 227, 228,
+ 229, 14, 15, 16, 17, 230, 0, 0, 0, 6,
+ 7, 18, 19, 8, 9, 225, 52, 0, 226, 22,
+ 53, 0, 0, 0, 0, 0, 0, 0, 0, 6,
+ 211, 0, 0, 8, 9, 0, 0, 0, 227, 228,
+ 0, 14, 15, 16, 17, 0, 0, 0, 0, 6,
+ 7, 18, 19, 8, 9, 225, 52, 13, 226, 22,
+ 53, 14, 15, 16, 17, 0, 0, 0, 0, 0,
+ 0, 18, 19, 0, 20, 0, 21, 0, 227, 22,
+ 23, 14, 15, 16, 17, 6, 7, 0, 0, 8,
+ 9, 18, 19, 0, 0, 0, 52, 0, 0, 22,
+ 53, 0, 0, 0, 0, 6, 7, 0, 0, 8,
+ 9, 6, 7, 174, 0, 8, 9, 14, 15, 16,
+ 17, 0, 0, 0, 0, 0, 0, 18, 19, 0,
+ 20, 0, 175, 0, 0, 22, 53, 14, 15, 16,
+ 17, 0, 0, 14, 15, 16, 17, 18, 19, 0,
+ 20, 0, 52, 18, 19, 22, 53, 0, 52, 0,
+ 7, 22, 53, 8, 9, 73, 0, 0,-32768, 0,
+ 0, 0, 0, 7, 0, 0, 8, 9,-32768, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 227, 228, 229, 14, 15,
- 16, 17, 230, 0, 0, 0, 6, 7, 18, 19,
- 8, 9, 225, 52, 0, 226, 22, 53, 0, 0,
- 0, 0, 0, 0, 0, 0, 6, 211, 0, 0,
- 8, 9, 0, 0, 0, 227, 228, 0, 14, 15,
- 16, 17, 0, 0, 0, 0, 6, 7, 18, 19,
- 8, 9, 225, 52, 13, 226, 22, 53, 14, 15,
- 16, 17, 0, 0, 0, 0, 0, 0, 18, 19,
- 0, 20, 0, 21, 0, 227, 22, 23, 14, 15,
- 16, 17, 6, 7, 0, 0, 8, 9, 18, 19,
- 0, 0, 0, 52, 0, 0, 22, 53, 0, 0,
- 0, 0, 6, 7, 0, 0, 8, 9, 6, 7,
- 174, 0, 8, 9, 14, 15, 16, 17, 0, 0,
- 0, 0, 0, 0, 18, 19, 0, 20, 0, 175,
- 0, 0, 22, 53, 14, 15, 16, 17, 0, 0,
- 14, 15, 16, 17, 18, 19, 0, 20, 0, 52,
- 18, 19, 22, 53, 0, 52, 0, 7, 22, 53,
- 8, 9, 73, 0, 0,-32768, 0, 0, 0, 0,
- 7, 0, 0, 8, 9,-32768, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 14, 15,
- 0, 0, 0, 0, 0, 80, 81, 82, 18, 19,
- 0, 14, 15, 52, 0, 0, 22, 53,-32768,-32768,
--32768, 18, 19, 0, 0, 0, 52, 0, 0, 22,
- 53
+ 0, 14, 15, 0, 0, 0, 0, 0, 80, 81,
+ 82, 18, 19, 0, 14, 15, 52, 0, 0, 22,
+ 53,-32768,-32768,-32768, 18, 19, 0, 0, 0, 52,
+ 0, 0, 22, 53
};
static const short yycheck[] = { 3,
@@ -686,101 +686,101 @@ static const short yycheck[] = { 3,
43, 44, 45, 46, -1, 48, -1, 50, -1, -1,
53, 54, -1, 30, 31, -1, -1, 60, 35, 36,
37, 38, -1, -1, -1, -1, -1, -1, 45, 46,
- -1, 48, -1, 50, 3, 4, 53, 54, 7, 8,
- -1, 58, -1, -1, -1, -1, -1, -1, 17, -1,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, -1, 31, -1, -1, -1, 35, 36, 37, 38,
- -1, -1, -1, -1, -1, -1, 45, 46, -1, 48,
- -1, 50, -1, -1, 53, 54, -1, -1, -1, 58,
- -1, 60, 3, 4, -1, -1, 7, 8, 9, -1,
- -1, 12, 13, -1, -1, -1, -1, -1, -1, -1,
+ -1, 48, -1, 50, -1, -1, 53, 54, -1, 0,
+ 1, 58, 3, 4, -1, -1, 7, 8, -1, -1,
+ -1, -1, 13, -1, 15, 16, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 30,
+ 31, -1, -1, -1, 35, 36, 37, 38, -1, -1,
+ -1, -1, -1, -1, 45, 46, -1, 48, -1, 50,
+ 3, 4, 53, 54, 7, 8, -1, 58, -1, -1,
+ -1, -1, -1, -1, 17, -1, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, -1, 31, -1,
+ -1, -1, 35, 36, 37, 38, -1, -1, -1, -1,
+ -1, -1, 45, 46, -1, 48, -1, 50, -1, -1,
+ 53, 54, -1, -1, -1, 58, -1, 60, 3, 4,
+ -1, -1, 7, 8, 9, -1, -1, 12, 13, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 32, 33, 34,
+ 35, 36, 37, 38, 39, -1, -1, 42, 43, 44,
+ 45, 46, -1, -1, -1, 50, -1, -1, 53, 54,
+ -1, -1, 3, 4, -1, 60, 7, 8, 9, -1,
+ -1, 12, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 3, 4, -1, -1, 7, 8, -1, -1,
-1, 32, 33, 34, 35, 36, 37, 38, 39, -1,
-1, 42, 43, 44, 45, 46, -1, -1, -1, 50,
- -1, -1, 53, 54, -1, -1, 3, 4, -1, 60,
+ 31, -1, 53, 54, 35, 36, 37, 38, -1, 60,
+ -1, -1, -1, -1, 45, 46, -1, 48, 1, 50,
+ 3, 4, 53, 54, 7, 8, -1, -1, -1, 60,
+ -1, -1, -1, -1, -1, -1, -1, -1, 1, -1,
+ 3, 4, -1, -1, 7, 8, -1, -1, 31, -1,
+ -1, -1, 35, 36, 37, 38, -1, -1, -1, -1,
+ -1, -1, 45, 46, -1, 48, -1, 50, 31, -1,
+ 53, 54, 35, 36, 37, 38, -1, -1, -1, -1,
+ -1, -1, 45, 46, -1, 48, 1, 50, 3, 4,
+ 53, 54, 7, 8, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 31, -1, -1, -1,
+ 35, 36, 37, 38, -1, -1, -1, -1, -1, -1,
+ 45, 46, -1, 48, -1, 50, 3, 4, 53, 54,
7, 8, 9, -1, -1, 12, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 32, 33, 34, 35, 36,
37, 38, 39, -1, -1, 42, 43, 44, 45, 46,
- -1, -1, 1, 50, 3, 4, 53, 54, 7, 8,
- -1, -1, -1, 60, -1, -1, 15, 16, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 3,
- 4, 30, 31, 7, 8, -1, 35, 36, 37, 38,
- -1, -1, -1, -1, -1, -1, 45, 46, -1, 48,
- -1, 50, -1, -1, 53, 54, -1, 31, -1, 58,
- -1, 35, 36, 37, 38, -1, -1, -1, -1, -1,
- -1, 45, 46, -1, 48, 1, 50, 3, 4, 53,
- 54, 7, 8, -1, -1, -1, 60, -1, -1, -1,
- -1, -1, -1, -1, -1, 1, -1, 3, 4, -1,
- -1, 7, 8, -1, -1, 31, -1, -1, -1, 35,
- 36, 37, 38, -1, -1, -1, -1, -1, -1, 45,
- 46, -1, 48, -1, 50, 31, -1, 53, 54, 35,
- 36, 37, 38, -1, -1, -1, -1, -1, -1, 45,
- 46, -1, 48, 1, 50, 3, 4, 53, 54, 7,
- 8, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 50, -1, -1, 53, 54, 55, 3,
+ 4, -1, -1, 7, 8, 9, -1, -1, 12, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 31, -1, -1, -1, 35, 36, 37,
- 38, -1, -1, -1, -1, -1, -1, 45, 46, -1,
- 48, -1, 50, 3, 4, 53, 54, 7, 8, 9,
- -1, -1, 12, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 32, 33,
+ 34, 35, 36, 37, 38, 39, -1, 41, 42, 43,
+ 44, 45, 46, -1, -1, -1, 50, 3, 4, 53,
+ 54, 7, 8, 9, -1, -1, 12, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 32, 33, 34, 35, 36, 37, 38, 39,
- -1, -1, 42, 43, 44, 45, 46, -1, -1, -1,
- 50, -1, -1, 53, 54, 55, 3, 4, -1, -1,
- 7, 8, 9, -1, -1, 12, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 32, 33, 34, 35, 36,
- 37, 38, 39, -1, 41, 42, 43, 44, 45, 46,
- -1, -1, -1, 50, 3, 4, 53, 54, 7, 8,
- 9, -1, -1, 12, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, -1, 42, 43, 44, 45,
+ 46, -1, -1, -1, 50, 3, 4, 53, 54, 7,
+ 8, 9, -1, -1, 12, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 32, 33, 34, 35, 36, 37, 38,
- 39, 40, -1, 42, 43, 44, 45, 46, -1, -1,
- -1, 50, 3, 4, 53, 54, 7, 8, 9, -1,
- -1, 12, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 32, 33, 34, 35, 36, 37,
+ 38, 39, -1, -1, 42, 43, 44, 45, 46, -1,
+ -1, -1, 50, 3, 4, 53, 54, 7, 8, 9,
+ -1, -1, 12, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 32, 33, 34, 35, 36, 37, 38, 39, -1,
- -1, 42, 43, 44, 45, 46, -1, -1, -1, 50,
- 3, 4, 53, 54, 7, 8, 9, -1, -1, 12,
+ -1, -1, 32, 33, -1, 35, 36, 37, 38, -1,
+ -1, -1, 42, 43, 44, 45, 46, -1, -1, -1,
+ 50, 3, 4, 53, 54, 7, 8, 9, -1, -1,
+ 12, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 3, 4, -1, -1, 7, 8, -1, -1, -1,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, -1,
+ -1, 3, 4, 45, 46, 7, 8, 9, 50, 31,
+ 12, 53, 54, 35, 36, 37, 38, -1, -1, -1,
+ -1, -1, -1, 45, 46, -1, 48, -1, 50, -1,
+ 32, 53, 54, 35, 36, 37, 38, -1, -1, -1,
+ 42, 43, 44, 45, 46, -1, -1, -1, 50, 3,
+ 4, 53, 54, 7, 8, 9, -1, -1, 12, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 32,
- 33, -1, 35, 36, 37, 38, -1, -1, -1, 42,
- 43, 44, 45, 46, -1, -1, -1, 50, 3, 4,
- 53, 54, 7, 8, 9, -1, -1, 12, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 3, 4,
- -1, -1, 7, 8, -1, -1, -1, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, -1, -1, 3, 4,
- 45, 46, 7, 8, 9, 50, 31, 12, 53, 54,
- 35, 36, 37, 38, -1, -1, -1, -1, -1, -1,
- 45, 46, -1, 48, -1, 50, -1, 32, 53, 54,
- 35, 36, 37, 38, -1, -1, -1, 42, 43, 44,
- 45, 46, -1, -1, -1, 50, 3, 4, 53, 54,
- 7, 8, 9, -1, -1, 12, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 32, 33,
+ 34, 35, 36, 37, 38, 39, -1, -1, -1, 3,
+ 4, 45, 46, 7, 8, 9, 50, -1, 12, 53,
+ 54, -1, -1, -1, -1, -1, -1, -1, -1, 3,
+ 4, -1, -1, 7, 8, -1, -1, -1, 32, 33,
+ -1, 35, 36, 37, 38, -1, -1, -1, -1, 3,
+ 4, 45, 46, 7, 8, 9, 50, 31, 12, 53,
+ 54, 35, 36, 37, 38, -1, -1, -1, -1, -1,
+ -1, 45, 46, -1, 48, -1, 50, -1, 32, 53,
+ 54, 35, 36, 37, 38, 3, 4, -1, -1, 7,
+ 8, 45, 46, -1, -1, -1, 50, -1, -1, 53,
+ 54, -1, -1, -1, -1, 3, 4, -1, -1, 7,
+ 8, 3, 4, 31, -1, 7, 8, 35, 36, 37,
+ 38, -1, -1, -1, -1, -1, -1, 45, 46, -1,
+ 48, -1, 50, -1, -1, 53, 54, 35, 36, 37,
+ 38, -1, -1, 35, 36, 37, 38, 45, 46, -1,
+ 48, -1, 50, 45, 46, 53, 54, -1, 50, -1,
+ 4, 53, 54, 7, 8, 9, -1, -1, 12, -1,
+ -1, -1, -1, 4, -1, -1, 7, 8, 9, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 32, 33, 34, 35, 36,
- 37, 38, 39, -1, -1, -1, 3, 4, 45, 46,
- 7, 8, 9, 50, -1, 12, 53, 54, -1, -1,
- -1, -1, -1, -1, -1, -1, 3, 4, -1, -1,
- 7, 8, -1, -1, -1, 32, 33, -1, 35, 36,
- 37, 38, -1, -1, -1, -1, 3, 4, 45, 46,
- 7, 8, 9, 50, 31, 12, 53, 54, 35, 36,
- 37, 38, -1, -1, -1, -1, -1, -1, 45, 46,
- -1, 48, -1, 50, -1, 32, 53, 54, 35, 36,
- 37, 38, 3, 4, -1, -1, 7, 8, 45, 46,
- -1, -1, -1, 50, -1, -1, 53, 54, -1, -1,
- -1, -1, 3, 4, -1, -1, 7, 8, 3, 4,
- 31, -1, 7, 8, 35, 36, 37, 38, -1, -1,
- -1, -1, -1, -1, 45, 46, -1, 48, -1, 50,
- -1, -1, 53, 54, 35, 36, 37, 38, -1, -1,
- 35, 36, 37, 38, 45, 46, -1, 48, -1, 50,
- 45, 46, 53, 54, -1, 50, -1, 4, 53, 54,
- 7, 8, 9, -1, -1, 12, -1, -1, -1, -1,
- 4, -1, -1, 7, 8, 9, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 35, 36,
- -1, -1, -1, -1, -1, 42, 43, 44, 45, 46,
- -1, 35, 36, 50, -1, -1, 53, 54, 42, 43,
- 44, 45, 46, -1, -1, -1, 50, -1, -1, 53,
- 54
+ -1, 35, 36, -1, -1, -1, -1, -1, 42, 43,
+ 44, 45, 46, -1, 35, 36, 50, -1, -1, 53,
+ 54, 42, 43, 44, 45, 46, -1, -1, -1, 50,
+ -1, -1, 53, 54
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/local/lib/bison.simple"
@@ -1262,11 +1262,15 @@ case 5:
{ yyval.nodeval = NULL; ;
break;}
case 6:
-#line 169 "awk.y"
-{ io_allowed = 0; ;
+#line 166 "awk.y"
+{ yyval.nodeval = NULL; ;
break;}
case 7:
-#line 171 "awk.y"
+#line 170 "awk.y"
+{ io_allowed = 0; ;
+ break;}
+case 8:
+#line 172 "awk.y"
{
if (begin_block) {
if (begin_block->type != Node_rule_list)
@@ -1282,12 +1286,12 @@ case 7:
yyerrok;
;
break;}
-case 8:
-#line 185 "awk.y"
+case 9:
+#line 186 "awk.y"
{ io_allowed = 0; ;
break;}
-case 9:
-#line 187 "awk.y"
+case 10:
+#line 188 "awk.y"
{
if (end_block) {
if (end_block->type != Node_rule_list)
@@ -1303,32 +1307,32 @@ case 9:
yyerrok;
;
break;}
-case 10:
-#line 202 "awk.y"
+case 11:
+#line 203 "awk.y"
{
warning("BEGIN blocks must have an action part");
errcount++;
yyerrok;
;
break;}
-case 11:
-#line 208 "awk.y"
+case 12:
+#line 209 "awk.y"
{
warning("END blocks must have an action part");
errcount++;
yyerrok;
;
break;}
-case 12:
-#line 214 "awk.y"
+case 13:
+#line 215 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_rule_node, yyvsp[0].nodeval); yyerrok; ;
break;}
-case 13:
-#line 216 "awk.y"
+case 14:
+#line 217 "awk.y"
{ yyval.nodeval = node ((NODE *)NULL, Node_rule_node, yyvsp[0].nodeval); yyerrok; ;
break;}
-case 14:
-#line 218 "awk.y"
+case 15:
+#line 219 "awk.y"
{
yyval.nodeval = node (yyvsp[-1].nodeval,
Node_rule_node,
@@ -1342,24 +1346,24 @@ case 14:
yyerrok;
;
break;}
-case 15:
-#line 231 "awk.y"
+case 16:
+#line 232 "awk.y"
{
func_install(yyvsp[-1].nodeval, yyvsp[0].nodeval);
yyval.nodeval = NULL;
yyerrok;
;
break;}
-case 16:
-#line 240 "awk.y"
-{ yyval.sval = yyvsp[0].sval; ;
- break;}
case 17:
-#line 242 "awk.y"
+#line 241 "awk.y"
{ yyval.sval = yyvsp[0].sval; ;
break;}
case 18:
-#line 244 "awk.y"
+#line 243 "awk.y"
+{ yyval.sval = yyvsp[0].sval; ;
+ break;}
+case 19:
+#line 245 "awk.y"
{
yyerror("%s() is a built-in function, it cannot be redefined",
tokstart);
@@ -1367,40 +1371,40 @@ case 18:
/* yyerrok; */
;
break;}
-case 21:
-#line 259 "awk.y"
+case 22:
+#line 260 "awk.y"
{
param_counter = 0;
;
break;}
-case 22:
-#line 263 "awk.y"
+case 23:
+#line 264 "awk.y"
{
yyval.nodeval = append_right(make_param(yyvsp[-4].sval), yyvsp[-2].nodeval);
can_return = 1;
;
break;}
-case 23:
-#line 271 "awk.y"
+case 24:
+#line 272 "awk.y"
{
yyval.nodeval = yyvsp[-2].nodeval;
can_return = 0;
;
break;}
-case 24:
-#line 280 "awk.y"
+case 25:
+#line 281 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
-case 25:
-#line 282 "awk.y"
+case 26:
+#line 283 "awk.y"
{ yyval.nodeval = mkrangenode ( node(yyvsp[-2].nodeval, Node_cond_pair, yyvsp[0].nodeval) ); ;
break;}
-case 26:
-#line 291 "awk.y"
+case 27:
+#line 292 "awk.y"
{ ++want_regexp; ;
break;}
-case 27:
-#line 293 "awk.y"
+case 28:
+#line 294 "awk.y"
{
NODE *n;
size_t len;
@@ -1416,20 +1420,20 @@ case 27:
yyval.nodeval = n;
;
break;}
-case 28:
-#line 311 "awk.y"
+case 29:
+#line 312 "awk.y"
{ yyval.nodeval = yyvsp[-3].nodeval ; ;
break;}
-case 29:
-#line 313 "awk.y"
+case 30:
+#line 314 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
-case 30:
-#line 318 "awk.y"
+case 31:
+#line 319 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
-case 31:
-#line 320 "awk.y"
+case 32:
+#line 321 "awk.y"
{
if (yyvsp[-1].nodeval == NULL || yyvsp[-1].nodeval->type != Node_statement_list)
yyvsp[-1].nodeval = node(yyvsp[-1].nodeval, Node_statement_list,(NODE *)NULL);
@@ -1438,72 +1442,72 @@ case 31:
yyerrok;
;
break;}
-case 32:
-#line 328 "awk.y"
-{ yyval.nodeval = NULL; ;
- break;}
case 33:
-#line 330 "awk.y"
+#line 329 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
-case 36:
-#line 340 "awk.y"
+case 34:
+#line 331 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 37:
-#line 342 "awk.y"
+#line 341 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 38:
-#line 344 "awk.y"
-{ yyval.nodeval = yyvsp[-1].nodeval; ;
+#line 343 "awk.y"
+{ yyval.nodeval = NULL; ;
break;}
case 39:
-#line 346 "awk.y"
-{ yyval.nodeval = yyvsp[0].nodeval; ;
+#line 345 "awk.y"
+{ yyval.nodeval = yyvsp[-1].nodeval; ;
break;}
case 40:
-#line 348 "awk.y"
-{ yyval.nodeval = node (yyvsp[-3].nodeval, Node_K_while, yyvsp[0].nodeval); ;
+#line 347 "awk.y"
+{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
case 41:
-#line 350 "awk.y"
-{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_K_do, yyvsp[-5].nodeval); ;
+#line 349 "awk.y"
+{ yyval.nodeval = node (yyvsp[-3].nodeval, Node_K_while, yyvsp[0].nodeval); ;
break;}
case 42:
-#line 352 "awk.y"
+#line 351 "awk.y"
+{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_K_do, yyvsp[-5].nodeval); ;
+ break;}
+case 43:
+#line 353 "awk.y"
{
yyval.nodeval = node (yyvsp[0].nodeval, Node_K_arrayfor, make_for_loop(variable(yyvsp[-5].sval,1),
(NODE *)NULL, variable(yyvsp[-3].sval,1)));
;
break;}
-case 43:
-#line 357 "awk.y"
+case 44:
+#line 358 "awk.y"
{
yyval.nodeval = node(yyvsp[0].nodeval, Node_K_for, (NODE *)make_for_loop(yyvsp[-7].nodeval, yyvsp[-5].nodeval, yyvsp[-3].nodeval));
;
break;}
-case 44:
-#line 361 "awk.y"
+case 45:
+#line 362 "awk.y"
{
yyval.nodeval = node (yyvsp[0].nodeval, Node_K_for,
(NODE *)make_for_loop(yyvsp[-6].nodeval, (NODE *)NULL, yyvsp[-3].nodeval));
;
break;}
-case 45:
-#line 367 "awk.y"
+case 46:
+#line 368 "awk.y"
{ yyval.nodeval = node ((NODE *)NULL, Node_K_break, (NODE *)NULL); ;
break;}
-case 46:
-#line 370 "awk.y"
+case 47:
+#line 371 "awk.y"
{ yyval.nodeval = node ((NODE *)NULL, Node_K_continue, (NODE *)NULL); ;
break;}
-case 47:
-#line 372 "awk.y"
+case 48:
+#line 373 "awk.y"
{ yyval.nodeval = node (yyvsp[-3].nodeval, yyvsp[-5].nodetypeval, yyvsp[-1].nodeval); ;
break;}
-case 48:
-#line 374 "awk.y"
+case 49:
+#line 375 "awk.y"
{
if (yyvsp[-3].nodetypeval == Node_K_print && yyvsp[-2].nodeval == NULL)
yyvsp[-2].nodeval = node(node(make_number(0.0),
@@ -1515,8 +1519,8 @@ case 48:
yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-3].nodetypeval, yyvsp[-1].nodeval);
;
break;}
-case 49:
-#line 385 "awk.y"
+case 50:
+#line 386 "awk.y"
{ NODETYPE type;
if (yyvsp[-1].nodeval && yyvsp[-1].nodeval == lookup("file")) {
@@ -1544,24 +1548,24 @@ case 49:
yyval.nodeval = node ((NODE *)NULL, type, (NODE *)NULL);
;
break;}
-case 50:
-#line 412 "awk.y"
+case 51:
+#line 413 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_exit, (NODE *)NULL); ;
break;}
-case 51:
-#line 414 "awk.y"
+case 52:
+#line 415 "awk.y"
{ if (! can_return) yyerror("return used outside function context"); ;
break;}
-case 52:
-#line 416 "awk.y"
+case 53:
+#line 417 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_return, (NODE *)NULL); ;
break;}
-case 53:
-#line 418 "awk.y"
+case 54:
+#line 419 "awk.y"
{ yyval.nodeval = node (variable(yyvsp[-4].sval,1), Node_K_delete, yyvsp[-2].nodeval); ;
break;}
-case 54:
-#line 420 "awk.y"
+case 55:
+#line 421 "awk.y"
{
if (do_lint)
warning("`delete array' is a gawk extension");
@@ -1576,219 +1580,219 @@ case 54:
yyval.nodeval = node (variable(yyvsp[-1].sval,1), Node_K_delete, (NODE *) NULL);
;
break;}
-case 55:
-#line 434 "awk.y"
-{ yyval.nodeval = yyvsp[-1].nodeval; ;
- break;}
case 56:
-#line 439 "awk.y"
-{ yyval.nodetypeval = yyvsp[0].nodetypeval; ;
+#line 435 "awk.y"
+{ yyval.nodeval = yyvsp[-1].nodeval; ;
break;}
case 57:
-#line 441 "awk.y"
+#line 440 "awk.y"
{ yyval.nodetypeval = yyvsp[0].nodetypeval; ;
break;}
case 58:
-#line 446 "awk.y"
+#line 442 "awk.y"
+{ yyval.nodetypeval = yyvsp[0].nodetypeval; ;
+ break;}
+case 59:
+#line 447 "awk.y"
{
yyval.nodeval = node(yyvsp[-3].nodeval, Node_K_if,
node(yyvsp[0].nodeval, Node_if_branches, (NODE *)NULL));
;
break;}
-case 59:
-#line 452 "awk.y"
+case 60:
+#line 453 "awk.y"
{ yyval.nodeval = node (yyvsp[-6].nodeval, Node_K_if,
node (yyvsp[-3].nodeval, Node_if_branches, yyvsp[0].nodeval)); ;
break;}
-case 60:
-#line 458 "awk.y"
+case 61:
+#line 459 "awk.y"
{ want_assign = 0; ;
break;}
-case 64:
-#line 469 "awk.y"
-{ yyval.nodeval = NULL; ;
- break;}
case 65:
-#line 471 "awk.y"
-{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_input, (NODE *)NULL); ;
+#line 470 "awk.y"
+{ yyval.nodeval = NULL; ;
break;}
case 66:
-#line 476 "awk.y"
-{ yyval.nodeval = NULL; ;
+#line 472 "awk.y"
+{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_input, (NODE *)NULL); ;
break;}
case 67:
-#line 478 "awk.y"
-{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_output, (NODE *)NULL); ;
+#line 477 "awk.y"
+{ yyval.nodeval = NULL; ;
break;}
case 68:
-#line 480 "awk.y"
-{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_append, (NODE *)NULL); ;
+#line 479 "awk.y"
+{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_output, (NODE *)NULL); ;
break;}
case 69:
-#line 482 "awk.y"
-{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_pipe, (NODE *)NULL); ;
+#line 481 "awk.y"
+{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_append, (NODE *)NULL); ;
break;}
case 70:
-#line 487 "awk.y"
-{ yyval.nodeval = NULL; ;
+#line 483 "awk.y"
+{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_pipe, (NODE *)NULL); ;
break;}
case 71:
-#line 489 "awk.y"
-{ yyval.nodeval = yyvsp[0].nodeval; ;
+#line 488 "awk.y"
+{ yyval.nodeval = NULL; ;
break;}
case 72:
-#line 494 "awk.y"
-{ yyval.nodeval = make_param(yyvsp[0].sval); ;
+#line 490 "awk.y"
+{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
case 73:
-#line 496 "awk.y"
-{ yyval.nodeval = append_right(yyvsp[-2].nodeval, make_param(yyvsp[0].sval)); yyerrok; ;
+#line 495 "awk.y"
+{ yyval.nodeval = make_param(yyvsp[0].sval); ;
break;}
case 74:
-#line 498 "awk.y"
-{ yyval.nodeval = NULL; ;
+#line 497 "awk.y"
+{ yyval.nodeval = append_right(yyvsp[-2].nodeval, make_param(yyvsp[0].sval)); yyerrok; ;
break;}
case 75:
-#line 500 "awk.y"
+#line 499 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 76:
-#line 502 "awk.y"
+#line 501 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 77:
-#line 508 "awk.y"
+#line 503 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 78:
-#line 510 "awk.y"
-{ yyval.nodeval = yyvsp[0].nodeval; ;
+#line 509 "awk.y"
+{ yyval.nodeval = NULL; ;
break;}
case 79:
-#line 515 "awk.y"
-{ yyval.nodeval = NULL; ;
+#line 511 "awk.y"
+{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
case 80:
-#line 517 "awk.y"
-{ yyval.nodeval = yyvsp[0].nodeval; ;
+#line 516 "awk.y"
+{ yyval.nodeval = NULL; ;
break;}
case 81:
-#line 522 "awk.y"
-{ yyval.nodeval = node (yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL); ;
+#line 518 "awk.y"
+{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
case 82:
-#line 524 "awk.y"
+#line 523 "awk.y"
+{ yyval.nodeval = node (yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL); ;
+ break;}
+case 83:
+#line 525 "awk.y"
{
yyval.nodeval = append_right(yyvsp[-2].nodeval,
node( yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL));
yyerrok;
;
break;}
-case 83:
-#line 530 "awk.y"
-{ yyval.nodeval = NULL; ;
- break;}
case 84:
-#line 532 "awk.y"
+#line 531 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 85:
-#line 534 "awk.y"
+#line 533 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 86:
-#line 536 "awk.y"
+#line 535 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 87:
-#line 541 "awk.y"
+#line 537 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 88:
-#line 543 "awk.y"
-{ yyval.nodeval = yyvsp[0].nodeval; ;
+#line 542 "awk.y"
+{ yyval.nodeval = NULL; ;
break;}
case 89:
-#line 548 "awk.y"
-{ yyval.nodeval = node (yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL); ;
+#line 544 "awk.y"
+{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
case 90:
-#line 550 "awk.y"
+#line 549 "awk.y"
+{ yyval.nodeval = node (yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL); ;
+ break;}
+case 91:
+#line 551 "awk.y"
{
yyval.nodeval = append_right(yyvsp[-2].nodeval,
node( yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL));
yyerrok;
;
break;}
-case 91:
-#line 556 "awk.y"
-{ yyval.nodeval = NULL; ;
- break;}
case 92:
-#line 558 "awk.y"
+#line 557 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 93:
-#line 560 "awk.y"
+#line 559 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 94:
-#line 562 "awk.y"
+#line 561 "awk.y"
{ yyval.nodeval = NULL; ;
break;}
case 95:
-#line 567 "awk.y"
-{ want_assign = 0; ;
+#line 563 "awk.y"
+{ yyval.nodeval = NULL; ;
break;}
case 96:
-#line 569 "awk.y"
+#line 568 "awk.y"
+{ want_assign = 0; ;
+ break;}
+case 97:
+#line 570 "awk.y"
{
if (do_lint && yyvsp[0].nodeval->type == Node_regex)
warning("Regular expression on left of assignment.");
yyval.nodeval = node (yyvsp[-3].nodeval, yyvsp[-2].nodetypeval, yyvsp[0].nodeval);
;
break;}
-case 97:
-#line 575 "awk.y"
+case 98:
+#line 576 "awk.y"
{ yyval.nodeval = node (variable(yyvsp[0].sval,1), Node_in_array, yyvsp[-3].nodeval); ;
break;}
-case 98:
-#line 577 "awk.y"
+case 99:
+#line 578 "awk.y"
{
yyval.nodeval = node (yyvsp[0].nodeval, Node_K_getline,
node (yyvsp[-3].nodeval, Node_redirect_pipein, (NODE *)NULL));
;
break;}
-case 99:
-#line 582 "awk.y"
+case 100:
+#line 583 "awk.y"
{
if (do_lint && ! io_allowed && yyvsp[0].nodeval == NULL)
warning("non-redirected getline undefined inside BEGIN or END action");
yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_getline, yyvsp[0].nodeval);
;
break;}
-case 100:
-#line 588 "awk.y"
+case 101:
+#line 589 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_and, yyvsp[0].nodeval); ;
break;}
-case 101:
-#line 590 "awk.y"
+case 102:
+#line 591 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_or, yyvsp[0].nodeval); ;
break;}
-case 102:
-#line 592 "awk.y"
+case 103:
+#line 593 "awk.y"
{
if (yyvsp[-2].nodeval->type == Node_regex)
warning("Regular expression on left of MATCH operator.");
yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, mk_rexp(yyvsp[0].nodeval));
;
break;}
-case 103:
-#line 598 "awk.y"
+case 104:
+#line 599 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
-case 104:
-#line 600 "awk.y"
+case 105:
+#line 601 "awk.y"
{
yyval.nodeval = node(node(make_number(0.0),
Node_field_spec,
@@ -1797,144 +1801,144 @@ case 104:
yyvsp[0].nodeval);
;
break;}
-case 105:
-#line 608 "awk.y"
+case 106:
+#line 609 "awk.y"
{ yyval.nodeval = node (variable(yyvsp[0].sval,1), Node_in_array, yyvsp[-2].nodeval); ;
break;}
-case 106:
-#line 610 "awk.y"
+case 107:
+#line 611 "awk.y"
{
if (do_lint && yyvsp[0].nodeval->type == Node_regex)
warning("Regular expression on left of comparison.");
yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval);
;
break;}
-case 107:
-#line 616 "awk.y"
+case 108:
+#line 617 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_less, yyvsp[0].nodeval); ;
break;}
-case 108:
-#line 618 "awk.y"
+case 109:
+#line 619 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_greater, yyvsp[0].nodeval); ;
break;}
-case 109:
-#line 620 "awk.y"
+case 110:
+#line 621 "awk.y"
{ yyval.nodeval = node(yyvsp[-4].nodeval, Node_cond_exp, node(yyvsp[-2].nodeval, Node_if_branches, yyvsp[0].nodeval));;
break;}
-case 110:
-#line 622 "awk.y"
+case 111:
+#line 623 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
-case 111:
-#line 624 "awk.y"
+case 112:
+#line 625 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_concat, yyvsp[0].nodeval); ;
break;}
-case 112:
-#line 629 "awk.y"
+case 113:
+#line 630 "awk.y"
{ want_assign = 0; ;
break;}
-case 113:
-#line 631 "awk.y"
+case 114:
+#line 632 "awk.y"
{ yyval.nodeval = node (yyvsp[-3].nodeval, yyvsp[-2].nodetypeval, yyvsp[0].nodeval); ;
break;}
-case 114:
-#line 633 "awk.y"
+case 115:
+#line 634 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_and, yyvsp[0].nodeval); ;
break;}
-case 115:
-#line 635 "awk.y"
+case 116:
+#line 636 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_or, yyvsp[0].nodeval); ;
break;}
-case 116:
-#line 637 "awk.y"
+case 117:
+#line 638 "awk.y"
{
if (do_lint && ! io_allowed && yyvsp[0].nodeval == NULL)
warning("non-redirected getline undefined inside BEGIN or END action");
yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_getline, yyvsp[0].nodeval);
;
break;}
-case 117:
-#line 643 "awk.y"
+case 118:
+#line 644 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
-case 118:
-#line 645 "awk.y"
+case 119:
+#line 646 "awk.y"
{ yyval.nodeval = node((NODE *) NULL, Node_nomatch, yyvsp[0].nodeval); ;
break;}
-case 119:
-#line 647 "awk.y"
+case 120:
+#line 648 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, mk_rexp(yyvsp[0].nodeval)); ;
break;}
-case 120:
-#line 649 "awk.y"
+case 121:
+#line 650 "awk.y"
{ yyval.nodeval = node (variable(yyvsp[0].sval,1), Node_in_array, yyvsp[-2].nodeval); ;
break;}
-case 121:
-#line 651 "awk.y"
+case 122:
+#line 652 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
break;}
-case 122:
-#line 653 "awk.y"
+case 123:
+#line 654 "awk.y"
{ yyval.nodeval = node(yyvsp[-4].nodeval, Node_cond_exp, node(yyvsp[-2].nodeval, Node_if_branches, yyvsp[0].nodeval));;
break;}
-case 123:
-#line 655 "awk.y"
+case 124:
+#line 656 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
-case 124:
-#line 657 "awk.y"
+case 125:
+#line 658 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_concat, yyvsp[0].nodeval); ;
break;}
-case 126:
-#line 664 "awk.y"
-{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_exp, yyvsp[0].nodeval); ;
- break;}
case 127:
-#line 666 "awk.y"
-{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_times, yyvsp[0].nodeval); ;
+#line 665 "awk.y"
+{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_exp, yyvsp[0].nodeval); ;
break;}
case 128:
-#line 668 "awk.y"
-{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_quotient, yyvsp[0].nodeval); ;
+#line 667 "awk.y"
+{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_times, yyvsp[0].nodeval); ;
break;}
case 129:
-#line 670 "awk.y"
-{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_mod, yyvsp[0].nodeval); ;
+#line 669 "awk.y"
+{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_quotient, yyvsp[0].nodeval); ;
break;}
case 130:
-#line 672 "awk.y"
-{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_plus, yyvsp[0].nodeval); ;
+#line 671 "awk.y"
+{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_mod, yyvsp[0].nodeval); ;
break;}
case 131:
-#line 674 "awk.y"
-{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_minus, yyvsp[0].nodeval); ;
+#line 673 "awk.y"
+{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_plus, yyvsp[0].nodeval); ;
break;}
case 132:
-#line 676 "awk.y"
-{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_postincrement, (NODE *)NULL); ;
+#line 675 "awk.y"
+{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_minus, yyvsp[0].nodeval); ;
break;}
case 133:
-#line 678 "awk.y"
-{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_postdecrement, (NODE *)NULL); ;
+#line 677 "awk.y"
+{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_postincrement, (NODE *)NULL); ;
break;}
case 134:
-#line 683 "awk.y"
-{ yyval.nodeval = node (yyvsp[0].nodeval, Node_not,(NODE *) NULL); ;
+#line 679 "awk.y"
+{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_postdecrement, (NODE *)NULL); ;
break;}
case 135:
-#line 685 "awk.y"
-{ yyval.nodeval = yyvsp[-1].nodeval; ;
+#line 684 "awk.y"
+{ yyval.nodeval = node (yyvsp[0].nodeval, Node_not,(NODE *) NULL); ;
break;}
case 136:
-#line 688 "awk.y"
-{ yyval.nodeval = snode (yyvsp[-1].nodeval, Node_builtin, (int) yyvsp[-3].lval); ;
+#line 686 "awk.y"
+{ yyval.nodeval = yyvsp[-1].nodeval; ;
break;}
case 137:
-#line 690 "awk.y"
+#line 689 "awk.y"
{ yyval.nodeval = snode (yyvsp[-1].nodeval, Node_builtin, (int) yyvsp[-3].lval); ;
break;}
case 138:
-#line 692 "awk.y"
+#line 691 "awk.y"
+{ yyval.nodeval = snode (yyvsp[-1].nodeval, Node_builtin, (int) yyvsp[-3].lval); ;
+ break;}
+case 139:
+#line 693 "awk.y"
{
if (do_lint)
warning("call of `length' without parentheses is not portable");
@@ -1943,30 +1947,30 @@ case 138:
warning( "call of `length' without parentheses is deprecated by POSIX");
;
break;}
-case 139:
-#line 700 "awk.y"
+case 140:
+#line 701 "awk.y"
{
yyval.nodeval = node (yyvsp[-1].nodeval, Node_func_call, make_string(yyvsp[-3].sval, strlen(yyvsp[-3].sval)));
;
break;}
-case 141:
-#line 705 "awk.y"
-{ yyval.nodeval = node (yyvsp[0].nodeval, Node_preincrement, (NODE *)NULL); ;
- break;}
case 142:
-#line 707 "awk.y"
-{ yyval.nodeval = node (yyvsp[0].nodeval, Node_predecrement, (NODE *)NULL); ;
+#line 706 "awk.y"
+{ yyval.nodeval = node (yyvsp[0].nodeval, Node_preincrement, (NODE *)NULL); ;
break;}
case 143:
-#line 709 "awk.y"
-{ yyval.nodeval = yyvsp[0].nodeval; ;
+#line 708 "awk.y"
+{ yyval.nodeval = node (yyvsp[0].nodeval, Node_predecrement, (NODE *)NULL); ;
break;}
case 144:
-#line 711 "awk.y"
+#line 710 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
case 145:
-#line 714 "awk.y"
+#line 712 "awk.y"
+{ yyval.nodeval = yyvsp[0].nodeval; ;
+ break;}
+case 146:
+#line 715 "awk.y"
{ if (yyvsp[0].nodeval->type == Node_val) {
yyvsp[0].nodeval->numbr = -(force_number(yyvsp[0].nodeval));
yyval.nodeval = yyvsp[0].nodeval;
@@ -1974,24 +1978,28 @@ case 145:
yyval.nodeval = node (yyvsp[0].nodeval, Node_unary_minus, (NODE *)NULL);
;
break;}
-case 146:
-#line 721 "awk.y"
-{ yyval.nodeval = yyvsp[0].nodeval; ;
- break;}
case 147:
-#line 726 "awk.y"
-{ yyval.nodeval = NULL; ;
+#line 722 "awk.y"
+{
+ /* was: $$ = $2 */
+ /* POSIX semantics: force a conversion to numeric type */
+ yyval.nodeval = node (make_number(0.0), Node_plus, yyvsp[0].nodeval);
+ ;
break;}
case 148:
-#line 728 "awk.y"
-{ yyval.nodeval = yyvsp[0].nodeval; ;
+#line 731 "awk.y"
+{ yyval.nodeval = NULL; ;
break;}
case 149:
#line 733 "awk.y"
-{ yyval.nodeval = variable(yyvsp[0].sval,1); ;
+{ yyval.nodeval = yyvsp[0].nodeval; ;
break;}
case 150:
-#line 735 "awk.y"
+#line 738 "awk.y"
+{ yyval.nodeval = variable(yyvsp[0].sval,1); ;
+ break;}
+case 151:
+#line 740 "awk.y"
{
if (yyvsp[-1].nodeval->rnode == NULL) {
yyval.nodeval = node (variable(yyvsp[-3].sval,1), Node_subscript, yyvsp[-1].nodeval->lnode);
@@ -2000,24 +2008,24 @@ case 150:
yyval.nodeval = node (variable(yyvsp[-3].sval,1), Node_subscript, yyvsp[-1].nodeval);
;
break;}
-case 151:
-#line 743 "awk.y"
+case 152:
+#line 748 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_field_spec, (NODE *)NULL); ;
break;}
-case 153:
-#line 751 "awk.y"
+case 154:
+#line 756 "awk.y"
{ yyerrok; ;
break;}
-case 154:
-#line 755 "awk.y"
+case 155:
+#line 760 "awk.y"
{ yyerrok; ;
break;}
-case 157:
-#line 764 "awk.y"
+case 158:
+#line 769 "awk.y"
{ yyerrok; want_assign = 0; ;
break;}
-case 158:
-#line 767 "awk.y"
+case 159:
+#line 772 "awk.y"
{ yyerrok; ;
break;}
}
@@ -2214,7 +2222,7 @@ yyerrhandle:
yystate = yyn;
goto yynewstate;
}
-#line 770 "awk.y"
+#line 775 "awk.y"
struct token {
@@ -2300,7 +2308,7 @@ va_dcl
errcount++;
/* Find the current line in the input file */
- if (lexptr) {
+ if (lexptr && lexeme) {
if (!thisline) {
cp = lexeme;
if (*cp == '\n') {
@@ -2308,7 +2316,7 @@ va_dcl
mesg = "unexpected newline";
}
for ( ; cp != lexptr_begin && *cp != '\n'; --cp)
- ;
+ continue;
if (*cp == '\n')
cp++;
thisline = cp;
@@ -2356,12 +2364,22 @@ get_src_buf()
static int did_newline = 0;
# define SLOP 128 /* enough space to hold most source lines */
+again:
if (nextfile > numfiles)
return NULL;
if (srcfiles[nextfile].stype == CMDLINE) {
if (len == 0) {
len = strlen(srcfiles[nextfile].val);
+ if (len == 0) {
+ /*
+ * Yet Another Special case:
+ * gawk '' /path/name
+ * Sigh.
+ */
+ ++nextfile;
+ goto again;
+ }
sourceline = 1;
lexptr = lexptr_begin = srcfiles[nextfile].val;
lexend = lexptr + len;
@@ -2447,6 +2465,7 @@ get_src_buf()
if (n == 0) {
samefile = 0;
nextfile++;
+ *lexeme = '\0';
len = 0;
return get_src_buf();
}
@@ -2563,7 +2582,7 @@ yylex()
}
retry:
while ((c = nextc()) == ' ' || c == '\t')
- ;
+ continue;
lexeme = lexptr ? lexptr - 1 : lexptr;
thisline = NULL;
@@ -2878,7 +2897,7 @@ retry:
break;
if (c == '#') {
while ((c = nextc()) != '\n' && c != '\0')
- ;
+ continue;
if (c == '\0')
break;
}
@@ -2904,7 +2923,7 @@ retry:
break;
if (c == '#') {
while ((c = nextc()) != '\n' && c != '\0')
- ;
+ continue;
if (c == '\0')
break;
}
@@ -2972,6 +2991,7 @@ retry:
else
yylval.nodetypeval = tokentab[mid].value;
+ free(tokkey);
return tokentab[mid].class;
}
}
diff --git a/builtin.c b/builtin.c
index 487e692b..96411de7 100644
--- a/builtin.c
+++ b/builtin.c
@@ -27,7 +27,7 @@
#include "awk.h"
#ifndef SRANDOM_PROTO
-extern void srandom P((int seed));
+extern void srandom P((unsigned int seed));
#endif
#ifndef linux
extern char *initstate P((unsigned seed, char *state, int n));
@@ -39,6 +39,7 @@ extern NODE **fields_arr;
extern int output_is_tty;
static NODE *sub_common P((NODE *tree, int global));
+NODE *format_tree P((const char *, int, NODE *));
#ifdef _CRAY
/* Work around a problem in conversion of doubles to exact integers. */
@@ -58,6 +59,25 @@ double (*Log)() = log;
#define Ceil(n) ceil(n)
#endif
+#define DEFAULT_G_PRECISION 6
+
+#ifdef GFMT_WORKAROUND
+/* semi-temporary hack, mostly to gracefully handle VMS */
+static void sgfmt P((char *buf, const char *format, int alt,
+ int fwidth, int precision, double value));
+#endif /* GFMT_WORKAROUND */
+
+/*
+ * On the alpha, LONG_MAX is too big for doing rand().
+ * On the Cray (Y-MP, anyway), ints and longs are 64 bits, but
+ * random() does things in terms of 32 bits. So we have to chop
+ * LONG_MAX down.
+ */
+#if (defined(__alpha) && defined(__osf__)) || defined(_CRAY)
+#define GAWK_RANDOM_MAX (LONG_MAX & 0x7fffffff)
+#else
+#define GAWK_RANDOM_MAX LONG_MAX
+#endif
static void efwrite P((const void *ptr, size_t size, size_t count, FILE *fp,
const char *from, struct redirect *rp,int flush));
@@ -159,21 +179,30 @@ NODE *tree;
return tmp_number((AWKNUM) ret);
}
+double
+double_to_int(d)
+double d;
+{
+ double floor P((double));
+ double ceil P((double));
+
+ if (d >= 0)
+ d = Floor(d);
+ else
+ d = Ceil(d);
+ return d;
+}
+
NODE *
do_int(tree)
NODE *tree;
{
NODE *tmp;
- double floor P((double));
- double ceil P((double));
double d;
tmp = tree_eval(tree->lnode);
d = force_number(tmp);
- if (d >= 0)
- d = Floor(d);
- else
- d = Ceil(d);
+ d = double_to_int(d);
free_temp(tmp);
return tmp_number((AWKNUM) d);
}
@@ -211,21 +240,27 @@ NODE *tree;
}
/*
- * do_sprintf does the sprintf function. It is one of the uglier parts of
- * gawk. Thanks to Michal Jaegerman for taming this beast and making it
- * compatible with ANSI C.
+ * format_tree() formats nodes of a tree, starting with a left node,
+ * and accordingly to a fmt_string providing a format like in
+ * printf family from C library. Returns a string node which value
+ * is a formatted string. Called by sprintf function.
+ *
+ * It is one of the uglier parts of gawk. Thanks to Michal Jaegermann
+ * for taming this beast and making it compatible with ANSI C.
*/
NODE *
-do_sprintf(tree)
-NODE *tree;
+format_tree(fmt_string, n0, carg)
+const char *fmt_string;
+int n0;
+register NODE *carg;
{
/* copy 'l' bytes from 's' to 'obufout' checking for space in the process */
/* difference of pointers should be of ptrdiff_t type, but let us be kind */
#define bchunk(s,l) if(l) {\
while((l)>ofre) {\
long olen = obufout - obuf;\
- erealloc(obuf, char *, osiz*2, "do_sprintf");\
+ erealloc(obuf, char *, osiz*2, "format_tree");\
ofre+=osiz;\
osiz*=2;\
obufout = obuf + olen;\
@@ -238,7 +273,7 @@ NODE *tree;
#define bchunk_one(s) {\
if(ofre <= 0) {\
long olen = obufout - obuf;\
- erealloc(obuf, char *, osiz*2, "do_sprintf");\
+ erealloc(obuf, char *, osiz*2, "format_tree");\
ofre+=osiz;\
osiz*=2;\
obufout = obuf + olen;\
@@ -249,7 +284,9 @@ NODE *tree;
/* Is there space for something L big in the buffer? */
#define chksize(l) if((l)>ofre) {\
- erealloc(obuf, char *, osiz*2, "do_sprintf");\
+ long olen = obufout - obuf;\
+ erealloc(obuf, char *, osiz*2, "format_tree");\
+ obufout = obuf + olen;\
ofre+=osiz;\
osiz*=2;\
}
@@ -271,13 +308,11 @@ NODE *tree;
char *obuf, *obufout;
size_t osiz, ofre;
char *chbuf;
- char *s0, *s1;
+ const char *s0, *s1;
int cs1;
- int n0;
- NODE *sfmt, *arg;
- register NODE *carg;
+ NODE *arg;
long fw, prec;
- int lj, alt, big;
+ int lj, alt, big, have_prec;
long *cur;
long val;
#ifdef sun386 /* Can't cast unsigned (int/long) from ptr->value */
@@ -285,7 +320,7 @@ NODE *tree;
#endif
unsigned long uval;
int sgn;
- int base;
+ int base = 0;
char cpbuf[30]; /* if we have numbers bigger than 30 */
char *cend = &cpbuf[30];/* chars, we lose, but seems unlikely */
char *cp;
@@ -295,17 +330,16 @@ NODE *tree;
size_t len;
static char sp[] = " ";
static char zero_string[] = "0";
- static char lchbuf[] = "0123456789abcdefx";
- static char Uchbuf[] = "0123456789ABCDEFX";
+ static char lchbuf[] = "0123456789abcdef";
+ static char Uchbuf[] = "0123456789ABCDEF";
- emalloc(obuf, char *, 120, "do_sprintf");
+ emalloc(obuf, char *, 120, "format_tree");
obufout = obuf;
osiz = 120;
ofre = osiz - 1;
- sfmt = tree_eval(tree->lnode);
- sfmt = force_string(sfmt);
- carg = tree->rnode;
- for (s0 = s1 = sfmt->stptr, n0 = sfmt->stlen; n0-- > 0;) {
+
+ s0 = s1 = fmt_string;
+ while (n0-- > 0) {
if (*s1 != '%') {
s1++;
continue;
@@ -315,14 +349,21 @@ NODE *tree;
cur = &fw;
fw = 0;
prec = 0;
+ have_prec = 0;
lj = alt = big = 0;
fill = sp;
cp = cend;
+ chbuf = lchbuf;
s1++;
retry:
--n0;
switch (cs1 = *s1++) {
+ case (-1): /* dummy case to allow for checking */
+check_pos:
+ if (cur != &fw)
+ break; /* reject as a valid format */
+ goto retry;
case '%':
bchunk_one("%");
s0 = s1;
@@ -345,17 +386,19 @@ retry:
if (cur == 0)
/* goto lose; */
break;
- if (prec >= 0) /* this happens only when we have */
- /* a negative precision */
+ if (prec >= 0)
*cur = cs1 - '0';
+ /* with a negative precision *cur is already set */
+ /* to -1, so it will remain negative, but we have */
+ /* to "eat" precision digits in any case */
while (n0 > 0 && *s1 >= '0' && *s1 <= '9') {
--n0;
*cur = *cur * 10 + *s1++ - '0';
}
- if (prec < 0) { /* negative precision is discarded */
- prec = 0;
+ if (prec < 0) /* negative precision is discarded */
+ have_prec = 0;
+ if (cur == &prec)
cur = 0;
- }
goto retry;
case '*':
if (cur == 0)
@@ -364,39 +407,42 @@ retry:
parse_next_arg();
*cur = force_number(arg);
free_temp(arg);
+ if (cur == &prec)
+ cur = 0;
goto retry;
case ' ': /* print ' ' or '-' */
/* 'space' flag is ignored */
/* if '+' already present */
if (signchar != 0)
- goto retry;
+ goto check_pos;
/* FALL THROUGH */
case '+': /* print '+' or '-' */
signchar = cs1;
- goto retry;
+ goto check_pos;
case '-':
+ if (prec < 0)
+ break;
if (cur == &prec) {
prec = -1;
goto retry;
}
fill = sp; /* if left justified then other */
lj++; /* filling is ignored */
- goto retry;
+ goto check_pos;
case '.':
if (cur != &fw)
break;
cur = &prec;
+ have_prec++;
goto retry;
case '#':
- if (cur != &fw)
- break;
alt++;
- goto retry;
+ goto check_pos;
case 'l':
if (big)
break;
big++;
- goto retry;
+ goto check_pos;
case 'c':
parse_next_arg();
if (arg->flags & NUMBER) {
@@ -411,7 +457,7 @@ retry:
cp = cpbuf;
goto pr_tail;
}
- if (prec == 0)
+ if (have_prec == 0)
prec = 1;
else if (prec > arg->stlen)
prec = arg->stlen;
@@ -420,28 +466,41 @@ retry:
case 's':
parse_next_arg();
arg = force_string(arg);
- if (prec == 0 || prec > arg->stlen)
+ if (have_prec == 0 || prec > arg->stlen)
prec = arg->stlen;
cp = arg->stptr;
goto pr_tail;
case 'd':
case 'i':
parse_next_arg();
- val = (long) force_number(arg);
+ tmpval = force_number(arg);
+ if (tmpval > LONG_MAX || tmpval < LONG_MIN) {
+ /* out of range - emergency use of %g format */
+ cs1 = 'g';
+ goto format_float;
+ }
+ val = (long) tmpval;
+
if (val < 0) {
sgn = 1;
- val = -val;
- } else
+ if (val > LONG_MIN)
+ uval = (unsigned long) -val;
+ else
+ uval = (unsigned long)(-(LONG_MIN + 1))
+ + (unsigned long)1;
+ } else {
sgn = 0;
+ uval = (unsigned long) val;
+ }
do {
- *--cp = '0' + val % 10;
- val /= 10;
- } while (val);
+ *--cp = (char) ('0' + uval % 10);
+ uval /= 10;
+ } while (uval);
if (sgn)
*--cp = '-';
else if (signchar)
*--cp = signchar;
- if (prec != 0) /* ignore '0' flag if */
+ if (have_prec != 0) /* ignore '0' flag if */
fill = sp; /* precision given */
if (prec > fw)
fw = prec;
@@ -454,24 +513,24 @@ retry:
fw--;
}
goto pr_tail;
- case 'u':
- base = 10;
- goto pr_unsigned;
- case 'o':
- base = 8;
- goto pr_unsigned;
case 'X':
+ chbuf = Uchbuf; /* FALL THROUGH */
case 'x':
- base = 16;
- pr_unsigned:
- if (cs1 == 'X')
- chbuf = Uchbuf;
- else
- chbuf = lchbuf;
- if (prec != 0) /* ignore '0' flag if */
- fill = sp; /* precision given */
+ base += 6; /* FALL THROUGH */
+ case 'u':
+ base += 2; /* FALL THROUGH */
+ case 'o':
+ base += 8;
parse_next_arg();
- uval = (unsigned long) force_number(arg);
+ tmpval = force_number(arg);
+ if (tmpval > ULONG_MAX || tmpval < LONG_MIN) {
+ /* out of range - emergency use of %g format */
+ cs1 = 'g';
+ goto format_float;
+ }
+ uval = (unsigned long)tmpval;
+ if (have_prec != 0) /* ignore '0' flag if */
+ fill = sp; /* precision given */
do {
*--cp = chbuf[uval % base];
uval /= base;
@@ -488,6 +547,7 @@ retry:
} else if (base == 8)
*--cp = '0';
}
+ base = 0;
prec = cend - cp;
pr_tail:
if (! lj) {
@@ -504,14 +564,17 @@ retry:
s0 = s1;
free_temp(arg);
break;
+ case 'g':
+ case 'G':
case 'e':
case 'f':
- case 'g':
case 'E':
- case 'G':
parse_next_arg();
tmpval = force_number(arg);
+ format_float:
free_temp(arg);
+ if (have_prec == 0)
+ prec = DEFAULT_G_PRECISION;
chksize(fw + prec + 9); /* 9==slop */
cp = cpbuf;
@@ -527,14 +590,12 @@ retry:
cp = strcpy(cp, "*.*") + 3;
*cp++ = cs1;
*cp = '\0';
- if (prec <= 0)
- prec = DEFAULT_G_PRECISION;
#ifndef GFMT_WORKAROUND
(void) sprintf(obufout, cpbuf,
(int) fw, (int) prec, (double) tmpval);
#else /* GFMT_WORKAROUND */
if (cs1 == 'g' || cs1 == 'G')
- (void) sgfmt(obufout, cpbuf, (int) alt,
+ sgfmt(obufout, cpbuf, (int) alt,
(int) fw, (int) prec, (double) tmpval);
else
(void) sprintf(obufout, cpbuf,
@@ -551,19 +612,31 @@ retry:
if (toofew)
fatal("%s\n\t%s\n\t%*s%s",
"not enough arguments to satisfy format string",
- sfmt->stptr, s1 - sfmt->stptr - 2, "",
+ fmt_string, s1 - fmt_string - 2, "",
"^ ran out for this one"
);
}
if (do_lint && carg != NULL)
warning("too many arguments supplied for format string");
bchunk(s0, s1 - s0);
- free_temp(sfmt);
r = make_str_node(obuf, obufout - obuf, ALREADY_MALLOCED);
r->flags |= TEMP;
return r;
}
+NODE *
+do_sprintf(tree)
+NODE *tree;
+{
+ NODE *r;
+ NODE *sfmt = force_string(tree_eval(tree->lnode));
+
+ r = format_tree(sfmt->stptr, sfmt->stlen, tree->rnode);
+ free_temp(sfmt);
+ return r;
+}
+
+
void
do_printf(tree)
register NODE *tree;
@@ -718,6 +791,8 @@ NODE *tree;
return tmp_number((AWKNUM) ret);
}
+extern NODE **fmt_list; /* declared in eval.c */
+
void
do_print(tree)
register NODE *tree;
@@ -746,11 +821,18 @@ register NODE *tree;
if (OFMTidx == CONVFMTidx)
(void) force_string(t1);
else {
+#ifndef GFMT_WORKAROUND
char buf[100];
- NUMTOSTR(buf, OFMT, t1->numbr);
+ (void) sprintf(buf, OFMT, t1->numbr);
free_temp(t1);
t1 = tmp_string(buf, strlen(buf));
+#else /* GFMT_WORKAROUND */
+ free_temp(t1);
+ t1 = format_tree(OFMT,
+ fmt_list[OFMTidx]->stlen,
+ tree);
+#endif /* GFMT_WORKAROUND */
}
}
efwrite(t1->stptr, sizeof(char), t1->stlen, fp, "print", rp, 0);
@@ -759,7 +841,8 @@ register NODE *tree;
if (tree) {
s = OFS;
if (OFSlen)
- efwrite(s, sizeof(char), (size_t)OFSlen, fp, "print", rp, 0);
+ efwrite(s, sizeof(char), (size_t)OFSlen,
+ fp, "print", rp, 0);
}
}
s = ORS;
@@ -847,7 +930,7 @@ NODE *tree;
}
static int firstrand = 1;
-static char state[256];
+static char state[512];
/* ARGSUSED */
NODE *
@@ -859,7 +942,7 @@ NODE *tree;
srandom(1);
firstrand = 0;
}
- return tmp_number((AWKNUM) random() / LONG_MAX);
+ return tmp_number((AWKNUM) random() / GAWK_RANDOM_MAX);
}
NODE *
@@ -876,10 +959,10 @@ NODE *tree;
(void) setstate(state);
if (!tree)
- srandom((int) (save_seed = (long) time((time_t *) 0)));
+ srandom((unsigned int) (save_seed = (long) time((time_t *) 0)));
else {
tmp = tree_eval(tree->lnode);
- srandom((int) (save_seed = (long) force_number(tmp)));
+ srandom((unsigned int) (save_seed = (long) force_number(tmp)));
free_temp(tmp);
}
firstrand = 0;
@@ -952,12 +1035,11 @@ int global;
tmp = tree->lnode;
t = force_string(tree_eval(tmp));
- /* XXX - fix this in 2.16 */
/* do the search early to avoid work on non-match */
if (research(rp, t->stptr, 0, t->stlen, 1) == -1 ||
- ((RESTART(rp, t->stptr) > t->stlen) && (matches = 1))) {
+ RESTART(rp, t->stptr) > t->stlen) {
free_temp(t);
- return tmp_number((AWKNUM) matches);
+ return tmp_number((AWKNUM) 0.0);
}
if (tmp->type == Node_val)
@@ -986,7 +1068,9 @@ int global;
repl = s->stptr;
replend = repl + s->stlen;
repllen = replend - repl;
- emalloc(buf, char *, buflen, "do_sub");
+ emalloc(buf, char *, buflen + 2, "do_sub");
+ buf[buflen] = '\0';
+ buf[buflen + 1] = '\0';
ampersands = 0;
for (scan = repl; scan < replend; scan++) {
if (*scan == '&') {
@@ -1027,6 +1111,8 @@ int global;
*bp++ = *scan;
} else
*bp++ = *scan;
+
+ /* catch the case of gsub(//, "blah", whatever), i.e. empty regexp */
if (global && matchstart == matchend && matchend < text + textlen) {
*bp++ = *matchend;
matchend++;
@@ -1045,6 +1131,7 @@ int global;
}
for (scan = matchend; scan < text + textlen; scan++)
*bp++ = *scan;
+ *bp = '\0';
textlen = bp - buf;
free(t->stptr);
t->stptr = buf;
@@ -1083,7 +1170,7 @@ NODE *tree;
* caveat: don't use as argument to *printf()!
* 'format' string HAS to be of "<flags>*.*g" kind, or we bomb!
*/
-void
+static void
sgfmt(buf, format, alt, fwidth, prec, g)
char *buf; /* return buffer; assumed big enough to hold result */
const char *format;
diff --git a/config.in b/config.in
index 8b027574..b04f0e1b 100644
--- a/config.in
+++ b/config.in
@@ -92,6 +92,13 @@
*/
/* #define HAVE_UNDERSCORE_SETJMP 1 */
+/*
+ * LIMITS_H_MISSING
+ *
+ * You don't have a <limits.h> include file.
+ */
+/* #define LIMITS_H_MISSING 1 */
+
/***********************************************/
/* Missing library subroutines or system calls */
/***********************************************/
@@ -177,6 +184,15 @@
/* #define TZNAME_MISSING 1 */
/*
+ * TM_ZONE_MISSING
+ *
+ * Your "struct tm" is missing the tm_zone field.
+ * If this is the case *and* strftime() is missing *and* tzname is missing,
+ * define this.
+ */
+/* #define TM_ZONE_MISSING 1 */
+
+/*
* STDC_HEADERS
*
* If your system does have ANSI compliant header files that
diff --git a/config/cray60 b/config/cray60
index 043f5dd7..7253277b 100644
--- a/config/cray60
+++ b/config/cray60
@@ -3,3 +3,6 @@ SIGTYPE void
RANDOM_MISSING 1
STDC_HEADERS 1
CHAR_UNSIGNED 1
+GETPGRP_NOARG 1
+MAKE_ALLOCA_C
+MAKE_CC
diff --git a/config/next20 b/config/next20
index 4e903ce7..29528a94 100644
--- a/config/next20
+++ b/config/next20
@@ -2,6 +2,7 @@ NeXT running 2.0
STRTOD_MISSING 1 /* NeXT strtod() is buggy */
STDC_HEADERS 1
ALLOCA_PROTO 1
+SRANDOM_PROTO 1
SZTC (size_t)
INTC (int)
MAKE_NeXT
diff --git a/config/next21 b/config/next21
index 5007d337..f29aa951 100644
--- a/config/next21
+++ b/config/next21
@@ -1,6 +1,7 @@
NeXT running 2.1 or higher
STDC_HEADERS 1
ALLOCA_PROTO 1
+SRANDOM_PROTO 1
SZTC (size_t)
INTC (int)
MAKE_NeXT
diff --git a/config/next30 b/config/next30
index 5007d337..f29aa951 100644
--- a/config/next30
+++ b/config/next30
@@ -1,6 +1,7 @@
NeXT running 2.1 or higher
STDC_HEADERS 1
ALLOCA_PROTO 1
+SRANDOM_PROTO 1
SZTC (size_t)
INTC (int)
MAKE_NeXT
diff --git a/config/osf1.dec b/config/osf1.dec
new file mode 100644
index 00000000..c7aaec67
--- /dev/null
+++ b/config/osf1.dec
@@ -0,0 +1,4 @@
+For DEC OSF/1 2.0
+STDC_HEADERS 1
+HAVE_UNDERSCORE_SETJMP 1
+SRANDOM_PROTO 1
diff --git a/config/sco b/config/sco
new file mode 100644
index 00000000..5123b0e7
--- /dev/null
+++ b/config/sco
@@ -0,0 +1,6 @@
+SCO UNIX
+RANDOM_MISSING 1
+STRCASE_MISSING 1
+STDC_HEADERS 1
+MAKE_ALLOCA_C
+HAVE_STRING_H 1
diff --git a/config/sgi405 b/config/sgi405
index 1f72a329..93d72a77 100644
--- a/config/sgi405
+++ b/config/sgi405
@@ -2,4 +2,3 @@ SGI Personal Iris (Sys V derived) (this works with gcc)
BLKSIZE_MISSING 1
STDC_HEADERS 1
GETPGRP_NOARG 1
-MAKE_ALLOCA_C
diff --git a/config/utek b/config/utek
new file mode 100644
index 00000000..101daef7
--- /dev/null
+++ b/config/utek
@@ -0,0 +1,18 @@
+For a Tektronix 4300 running UTek 4.0 (BSD based.)
+SIGTYPE int
+MEMCMP_MISSING 1
+MEMCPY_MISSING 1
+MEMSET_MISSING 1
+STRCASE_MISSING 1
+STRERROR_MISSING 1
+STRFTIME_MISSING 1
+STRTOD_MISSING 1
+STRTOL_MISSING 1
+NON_STD_SPRINTF 1
+VPRINTF_MISSING 1
+BSDSTDIO 1
+TZNAME_MISSING 1
+TZSET_MISSING 1
+LIMITS_H_MISSING 1
+TM_ZONE_MISSING 1
+MAKE_CC
diff --git a/dfa.c b/dfa.c
index 1b7ca131..47ad35e9 100644
--- a/dfa.c
+++ b/dfa.c
@@ -84,6 +84,9 @@ extern void free();
typedef void *ptr_t;
#else
typedef char *ptr_t;
+#ifndef const
+#define const
+#endif
#endif
static void dfamust _RE_ARGS((struct dfa *dfa));
@@ -981,7 +984,7 @@ insert(p, s)
position t1, t2;
for (i = 0; i < s->nelem && p.index < s->elems[i].index; ++i)
- ;
+ continue;
if (i < s->nelem && p.index == s->elems[i].index)
s->elems[i].constraint |= p.constraint;
else
@@ -1565,7 +1568,7 @@ dfastate(s, d, trans)
/* If there are no characters left, there's no point in going on. */
for (j = 0; j < CHARCLASS_INTS && !matches[j]; ++j)
- ;
+ continue;
if (j == CHARCLASS_INTS)
continue;
}
@@ -1583,7 +1586,7 @@ dfastate(s, d, trans)
matches. */
intersectf = 0;
for (k = 0; k < CHARCLASS_INTS; ++k)
- (intersect[k] = matches[k] & labels[j][k]) ? intersectf = 1 : 0;
+ (intersect[k] = matches[k] & labels[j][k]) ? (intersectf = 1) : 0;
if (! intersectf)
continue;
@@ -1594,8 +1597,8 @@ dfastate(s, d, trans)
/* Even an optimizing compiler can't know this for sure. */
int match = matches[k], label = labels[j][k];
- (leftovers[k] = ~match & label) ? leftoversf = 1 : 0;
- (matches[k] = match & ~label) ? matchesf = 1 : 0;
+ (leftovers[k] = ~match & label) ? (leftoversf = 1) : 0;
+ (matches[k] = match & ~label) ? (matchesf = 1) : 0;
}
/* If there were leftovers, create a new group labeled with them. */
@@ -2029,9 +2032,9 @@ dfafree(d)
free((ptr_t) d->trans[i]);
else if (d->fails[i])
free((ptr_t) d->fails[i]);
- free((ptr_t) d->realtrans);
- free((ptr_t) d->fails);
- free((ptr_t) d->newlines);
+ if (d->realtrans) free((ptr_t) d->realtrans);
+ if (d->fails) free((ptr_t) d->fails);
+ if (d->newlines) free((ptr_t) d->newlines);
for (dm = d->musts; dm; dm = ndm)
{
ndm = dm->next;
@@ -2259,7 +2262,7 @@ comsubs(left, right)
while (rcp != NULL)
{
for (i = 1; lcp[i] != '\0' && lcp[i] == rcp[i]; ++i)
- ;
+ continue;
if (i > len)
len = i;
rcp = index(rcp + 1, *lcp);
diff --git a/eval.c b/eval.c
index 543d1298..18f67fd2 100644
--- a/eval.c
+++ b/eval.c
@@ -137,6 +137,10 @@ register NODE *volatile tree;
NODE *volatile stable_tree;
int volatile traverse = 1; /* True => loop thru tree (Node_rule_list) */
+ /* avoid false source indications */
+ source = NULL;
+ sourceline = 0;
+
if (tree == NULL)
return 1;
sourceline = tree->source_line;
@@ -381,7 +385,7 @@ register NODE *tree;
register int di;
AWKNUM x, x1, x2;
long lx;
-#ifdef CRAY
+#ifdef _CRAY
long lx2;
#endif
@@ -396,14 +400,18 @@ register NODE *tree;
if ((char)tree->var_value->stref <= 0) cant_happen();
return tree->var_value;
}
+#endif
+
if (tree->type == Node_param_list) {
- if (stack_ptr[tree->param_cnt] == NULL)
+ tree = stack_ptr[tree->param_cnt];
+ if (tree == NULL)
return Nnull_string;
- else
- return stack_ptr[tree->param_cnt]->var_value;
}
-#endif
+
switch (tree->type) {
+ case Node_var:
+ return tree->var_value;
+
case Node_and:
return tmp_number((AWKNUM) (eval_condition(tree->lnode)
&& eval_condition(tree->rnode)));
@@ -446,7 +454,7 @@ register NODE *tree;
return *lhs;
case Node_var_array:
- fatal("attempt to use an array in a scalar context");
+ fatal("attempt to use array `%s' in a scalar context", tree->vname);
case Node_unary_minus:
t1 = tree_eval(tree->subnode);
@@ -530,6 +538,7 @@ register NODE *tree;
}
*strp = NULL;
emalloc(str, char *, len+2, "tree_eval");
+ str[len] = str[len+1] = '\0'; /* for good measure */
dest = str;
strp = strlist;
while (*strp) {
@@ -651,7 +660,7 @@ register NODE *tree;
return tmp_number(x1 - x2);
case Node_var_array:
- fatal("attempt to use an array in a scalar context");
+ fatal("attempt to use array `%s' in a scalar context", tree->vname);
default:
fatal("illegal type (%d) in tree_eval", tree->type);
@@ -966,12 +975,14 @@ NODE *arg_list; /* Node_expression_list of calling args. */
if (arg->type == Node_param_list)
arg = stack_ptr[arg->param_cnt];
n = *sp++;
- if (arg->type == Node_var && n->type == Node_var_array) {
+ if ((arg->type == Node_var || arg->type == Node_var_array)
+ && n->type == Node_var_array) {
/* should we free arg->var_value ? */
arg->var_array = n->var_array;
arg->type = Node_var_array;
arg->array_size = n->array_size;
arg->table_size = n->table_size;
+ arg->flags = n->flags;
}
/* n->lnode overlays the array size, don't unref it if array */
if (n->type != Node_var_array)
@@ -1018,7 +1029,7 @@ Func_ptr *assign;
switch (ptr->type) {
case Node_var_array:
- fatal("attempt to use an array in a scalar context");
+ fatal("attempt to use array `%s' in a scalar context", ptr->vname);
case Node_var:
aptr = &(ptr->var_value);
#ifdef DEBUG
@@ -1194,7 +1205,7 @@ set_ORS()
ORS[ORSlen] = '\0';
}
-static NODE **fmt_list = NULL;
+NODE **fmt_list = NULL;
static int fmt_ok P((NODE *n));
static int fmt_index P((NODE *n));
diff --git a/field.c b/field.c
index 18d73906..17dce9b6 100644
--- a/field.c
+++ b/field.c
@@ -27,26 +27,26 @@
typedef void (* Setfunc) P((int, char*, int, NODE *));
-static int (*parse_field) P((int, char **, int, NODE *,
+static long (*parse_field) P((int, char **, int, NODE *,
Regexp *, Setfunc, NODE *));
static void rebuild_record P((void));
-static int re_parse_field P((int, char **, int, NODE *,
+static long re_parse_field P((int, char **, int, NODE *,
Regexp *, Setfunc, NODE *));
-static int def_parse_field P((int, char **, int, NODE *,
+static long def_parse_field P((int, char **, int, NODE *,
Regexp *, Setfunc, NODE *));
-static int sc_parse_field P((int, char **, int, NODE *,
+static long sc_parse_field P((int, char **, int, NODE *,
Regexp *, Setfunc, NODE *));
-static int fw_parse_field P((int, char **, int, NODE *,
+static long fw_parse_field P((int, char **, int, NODE *,
Regexp *, Setfunc, NODE *));
static void set_element P((int, char *, int, NODE *));
-static void grow_fields_arr P((int num));
+static void grow_fields_arr P((long num));
static void set_field P((int num, char *str, int len, NODE *dummy));
static Regexp *FS_regexp = NULL;
static char *parse_extent; /* marks where to restart parse of record */
-static int parse_high_water=0; /* field number that we have parsed so far */
-static int nf_high_water = 0; /* size of fields_arr */
+static long parse_high_water=0; /* field number that we have parsed so far */
+static long nf_high_water = 0; /* size of fields_arr */
static int resave_fs;
static NODE *save_FS; /* save current value of FS when line is read,
* to be used in deferred parsing
@@ -76,7 +76,7 @@ init_fields()
static void
grow_fields_arr(num)
-int num;
+long num;
{
register int t;
register NODE *n;
@@ -134,7 +134,7 @@ rebuild_record()
tlen += (NF - 1) * ofslen;
if ((long)tlen < 0)
tlen = 0;
- emalloc(ops, char *, tlen + 2, "fix_fields");
+ emalloc(ops, char *, tlen + 2, "rebuild_record");
cops = ops;
ops[0] = '\0';
for (ptr = &fields_arr[1]; ptr <= &fields_arr[NF]; ptr++) {
@@ -206,7 +206,7 @@ set_NF()
{
register int i;
- NF = (int) force_number(NF_node->var_value);
+ NF = (long) force_number(NF_node->var_value);
if (NF > nf_high_water)
grow_fields_arr(NF);
for (i = parse_high_water + 1; i <= NF; i++) {
@@ -221,7 +221,7 @@ set_NF()
* via (*parse_field)(). This variation is for when FS is a regular
* expression -- either user-defined or because RS=="" and FS==" "
*/
-static int
+static long
re_parse_field(up_to, buf, len, fs, rp, set, n)
int up_to; /* parse only up to this field number */
char **buf; /* on input: string to parse; on output: point to start next */
@@ -242,7 +242,7 @@ NODE *n;
return nf;
if (*RS == 0 && default_FS)
- while (scan < end && isspace(*scan))
+ while (scan < end && (*scan == ' ' || *scan == '\t' || *scan == '\n'))
scan++;
field = scan;
while (scan < end
@@ -277,7 +277,7 @@ NODE *n;
* via (*parse_field)(). This variation is for when FS is a single space
* character.
*/
-static int
+static long
def_parse_field(up_to, buf, len, fs, rp, set, n)
int up_to; /* parse only up to this field number */
char **buf; /* on input: string to parse; on output: point to start next */
@@ -331,7 +331,7 @@ NODE *n;
* via (*parse_field)(). This variation is for when FS is a single character
* other than space.
*/
-static int
+static long
sc_parse_field(up_to, buf, len, fs, rp, set, n)
int up_to; /* parse only up to this field number */
char **buf; /* on input: string to parse; on output: point to start next */
@@ -363,14 +363,18 @@ NODE *n;
/* because it will be destroyed now: */
*end = fschar; /* sentinel character */
- for (; nf < up_to; scan++) {
+ for (; nf < up_to;) {
field = scan;
- while (*scan++ != fschar)
- ;
- scan--;
+ while (*scan != fschar)
+ scan++;
(*set)(++nf, field, (int)(scan - field), n);
if (scan == end)
break;
+ scan++;
+ if (scan == end) { /* FS at end of record */
+ (*set)(++nf, field, 0, n);
+ break;
+ }
}
/* everything done, restore original char at *end */
@@ -384,7 +388,7 @@ NODE *n;
* this is called both from get_field() and from do_split()
* via (*parse_field)(). This variation is for fields are fixed widths.
*/
-static int
+static long
fw_parse_field(up_to, buf, len, fs, rp, set, n)
int up_to; /* parse only up to this field number */
char **buf; /* on input: string to parse; on output: point to start next */
@@ -395,7 +399,7 @@ Setfunc set; /* routine to set the value of the parsed field */
NODE *n;
{
register char *scan = *buf;
- register int nf = parse_high_water;
+ register long nf = parse_high_water;
register char *end = scan + len;
if (up_to == HUGE)
@@ -515,11 +519,21 @@ NODE *tree;
NODE *t1, *t2, *t3, *tmp;
NODE *fs;
char *s;
- int (*parseit)P((int, char **, int, NODE *,
+ long (*parseit)P((int, char **, int, NODE *,
Regexp *, Setfunc, NODE *));
Regexp *rp = NULL;
- t1 = tree_eval(tree->lnode);
+
+ /*
+ * do dupnode(), to avoid problems like
+ * x = split(a[1], a, "blah")
+ * since we assoc_clear the array. gack.
+ * this also gives up complete call by value semantics.
+ */
+ tmp = tree_eval(tree->lnode);
+ t1 = dupnode(tmp);
+ free_temp(tmp);
+
t2 = tree->rnode->lnode;
t3 = tree->rnode->rnode->lnode;
@@ -552,7 +566,7 @@ NODE *tree;
s = t1->stptr;
tmp = tmp_number((AWKNUM) (*parseit)(HUGE, &s, (int)t1->stlen,
fs, rp, set_element, t2));
- free_temp(t1);
+ unref(t1);
free_temp(t3);
return tmp;
}
@@ -563,6 +577,13 @@ set_FS()
char buf[10];
NODE *fs;
+ /*
+ * If changing the way fields are split, obey least-suprise
+ * semantics, and force $0 to be split totally.
+ */
+ if (fields_arr != NULL)
+ (void) get_field(HUGE - 1, 0);
+
buf[0] = '\0';
default_FS = 0;
if (FS_regexp) {
@@ -588,6 +609,9 @@ set_FS()
else if (fs->stptr[0] != ' ' && fs->stlen == 1) {
if (IGNORECASE == 0)
parse_field = sc_parse_field;
+ else if (fs->stptr[0] == '\\')
+ /* yet another special case */
+ strcpy(buf, "[\\\\]");
else
sprintf(buf, "[%c]", fs->stptr[0]);
}
@@ -627,6 +651,13 @@ set_FIELDWIDTHS()
if (do_unix) /* quick and dirty, does the trick */
return;
+ /*
+ * If changing the way fields are split, obey least-suprise
+ * semantics, and force $0 to be split totally.
+ */
+ if (fields_arr != NULL)
+ (void) get_field(HUGE - 1, 0);
+
parse_field = fw_parse_field;
scan = force_string(FIELDWIDTHS_node->var_value)->stptr;
end = scan + 1;
diff --git a/gawk.1 b/gawk.1
index 67940393..a98c99d1 100644
--- a/gawk.1
+++ b/gawk.1
@@ -1,7 +1,7 @@
.ds PX \s-1POSIX\s+1
.ds UX \s-1UNIX\s+1
.ds AN \s-1ANSI\s+1
-.TH GAWK 1 "Dec 24 1993" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "Apr 18 1994" "Free Software Foundation" "Utility Commands"
.SH NAME
gawk \- pattern scanning and processing language
.SH SYNOPSIS
@@ -290,7 +290,7 @@ In normal operation, as long as program text has been supplied, unknown
options are passed on to the AWK program in the
.B ARGV
array for processing. This is particularly useful for running AWK
-programs via the ``#!'' executable interpreter mechansim.
+programs via the ``#!'' executable interpreter mechanism.
.SH AWK PROGRAM EXECUTION
.PP
An AWK program consists of a sequence of pattern-action statements
@@ -1671,7 +1671,7 @@ block was run. Applications came to depend on this ``feature.''
When
.I awk
was changed to match its documentation, this option was added to
-accomodate applications that depended upon the old behavior.
+accommodate applications that depended upon the old behavior.
(This feature was agreed upon by both the AT&T and GNU developers.)
.PP
The
@@ -1883,6 +1883,19 @@ statement.
will support this usage if
.B "\-W posix"
has not been specified.
+.SH ENVIRONMENT VARIABLES
+If
+.B POSIXLY_CORRECT
+exists in the environment, then
+.I gawk
+behaves exactly as if
+.B \-\-posix
+had been specified on the command line.
+If
+.B \-\-lint
+has been specified,
+.I gawk
+will issue a warning message to this effect.
.SH BUGS
The
.B \-F
diff --git a/getopt.c b/getopt.c
index ec802309..fd142f5a 100644
--- a/getopt.c
+++ b/getopt.c
@@ -3,7 +3,7 @@
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
before changing it!
- Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
+ Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 1994
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
@@ -59,11 +59,13 @@
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
-#if defined(__GNU_LIBRARY__) || defined(OS2) || defined(MSDOS) || defined(atarist)
+#if defined(__GNU_LIBRARY__) || defined(STDC_HEADERS)
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
-#endif /* GNU C library. */
+#else
+extern char *getenv ();
+#endif /* __GNU_LIBRARY || STDC_HEADERS */
/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
long-named option. Because this is not POSIX.2 compliant, it is
@@ -163,7 +165,7 @@ static enum
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;
-#if defined(__GNU_LIBRARY__) || defined(OS2) || defined(MSDOS) || defined(atarist)
+#if defined(__GNU_LIBRARY__) || defined(STDC_HEADERS)
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
@@ -175,8 +177,6 @@ static enum
/* Avoid depending on library functions or files
whose names are inconsistent. */
-char *getenv ();
-
static char *
my_index (str, chr)
const char *str;
@@ -204,7 +204,7 @@ my_index (str, chr)
extern size_t strlen (const char *);
#endif
-#endif /* GNU C library. */
+#endif /* __GNU_LIBRARY__ || STDC_HEADERS */
/* Handle permutation of arguments. */
diff --git a/io.c b/io.c
index abcb7f4f..7fe21ecf 100644
--- a/io.c
+++ b/io.c
@@ -36,6 +36,10 @@
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
+#ifndef ENFILE
+#define ENFILE EMFILE
+#endif
+
#ifndef atarist
#define INVALID_HANDLE (-1)
#else
@@ -51,7 +55,7 @@ static int inrec P((IOBUF *iop));
static int iop_close P((IOBUF *iop));
struct redirect *redirect P((NODE *tree, int *errflg));
static void close_one P((void));
-static int close_redir P((struct redirect *rp));
+static int close_redir P((struct redirect *rp, int exitwarn));
#ifndef PIPES_SIMULATED
static int wait_any P((int interesting));
#endif
@@ -159,13 +163,13 @@ int skipping;
void
set_FNR()
{
- FNR = (int) FNR_node->var_value->numbr;
+ FNR = (long) FNR_node->var_value->numbr;
}
void
set_NR()
{
- NR = (int) NR_node->var_value->numbr;
+ NR = (long) NR_node->var_value->numbr;
}
/*
@@ -256,12 +260,12 @@ do_input()
IOBUF *iop;
extern int exiting;
- if (setjmp(filebuf) != 0) {
- }
+ (void) setjmp(filebuf);
+
while ((iop = nextfile(0)) != NULL) {
if (inrec(iop) == 0)
while (interpret(expression_value) && inrec(iop) == 0)
- ;
+ continue;
/* recover any space from C based alloca */
(void) alloca(0);
@@ -409,7 +413,7 @@ int *errflg;
}
if (rp->fp == NULL && rp->iop == NULL) {
/* too many files open -- close one and try again */
- if (errno == EMFILE)
+ if (errno == EMFILE || errno == ENFILE)
close_one();
else {
/*
@@ -479,16 +483,18 @@ NODE *tree;
if (rp == NULL) /* no match */
return tmp_number((AWKNUM) 0.0);
fflush(stdout); /* synchronize regular output */
- tmp = tmp_number((AWKNUM)close_redir(rp));
+ tmp = tmp_number((AWKNUM)close_redir(rp, 0));
rp = NULL;
return tmp;
}
static int
-close_redir(rp)
+close_redir(rp, exitwarn)
register struct redirect *rp;
+int exitwarn;
{
int status = 0;
+ char *what;
if (rp == NULL)
return 0;
@@ -507,14 +513,19 @@ register struct redirect *rp;
rp->iop = NULL;
}
}
+
+ what = (rp->flag & RED_PIPE) ? "pipe" : "file";
+
+ if (exitwarn)
+ warning("no explicit close of %s \"%s\" provided",
+ what, rp->value);
+
/* SVR4 awk checks and warns about status of close */
if (status) {
char *s = strerror(errno);
- warning("failure status (%d) on %s close of \"%s\" (%s).",
- status,
- (rp->flag & RED_PIPE) ? "pipe" :
- "file", rp->value, s);
+ warning("failure status (%d) on %s close of \"%s\" (%s)",
+ status, what, rp->value, s);
if (! do_unix) {
/* set ERRNO too so that program can get at it */
@@ -572,7 +583,8 @@ close_io ()
for (rp = red_head; rp != NULL; rp = next) {
next = rp->next;
/* close_redir() will print a message if needed */
- if (close_redir(rp))
+ /* if do_lint, warn about lack of explicit close */
+ if (close_redir(rp, do_lint))
status++;
rp = NULL;
}
@@ -794,7 +806,7 @@ const char *name, *mode;
char tbuf[BUFSIZ], *cp;
int i;
#if defined(NGROUPS_MAX) && NGROUPS_MAX > 0
-#if defined(atarist) || defined(__svr4__)
+#if defined(atarist) || defined(__svr4__) || defined(__osf__)
gid_t groupset[NGROUPS_MAX];
#else
int groupset[NGROUPS_MAX];
diff --git a/iop.c b/iop.c
index 6e6b7890..897daefb 100644
--- a/iop.c
+++ b/iop.c
@@ -149,8 +149,10 @@ int *errcode;
char rs;
int saw_newline = 0, eat_whitespace = 0; /* used iff grRS==0 */
- if (iop->cnt == EOF) /* previous read hit EOF */
+ if (iop->cnt == EOF) { /* previous read hit EOF */
+ *out = NULL;
return EOF;
+ }
if (grRS == 0) { /* special case: grRS == "" */
rs = '\n';
@@ -178,9 +180,6 @@ int *errcode;
char *oldsplit = iop->buf + iop->secsiz;
long len; /* record length so far */
- if ((iop->flag & IOP_IS_INTERNAL) != 0)
- cant_happen();
-
len = bp - start;
if (len > iop->secsiz) {
/* expand secondary buffer */
@@ -242,7 +241,8 @@ int *errcode;
extern int default_FS;
if (default_FS && (bp == start || eat_whitespace)) {
- while (bp < iop->end && isspace(*bp))
+ while (bp < iop->end
+ && (*bp == ' ' || *bp == '\t' || *bp == '\n'))
bp++;
if (bp == iop->end) {
eat_whitespace = 1;
@@ -272,8 +272,10 @@ int *errcode;
iop->cnt = bp - start;
}
if (iop->cnt == EOF
- && (((iop->flag & IOP_IS_INTERNAL) != 0) || start == bp))
+ && (((iop->flag & IOP_IS_INTERNAL) != 0) || start == bp)) {
+ *out = NULL;
return EOF;
+ }
iop->off = bp;
bp--;
@@ -281,6 +283,10 @@ int *errcode;
bp++;
*bp = '\0';
if (grRS == 0) {
+ /* there could be more newlines left, clean 'em out now */
+ while (*(iop->off) == rs && iop->off <= iop->end)
+ (iop->off)++;
+
if (*--bp == rs)
*bp = '\0';
else
diff --git a/main.c b/main.c
index 6adab095..23e3dc78 100644
--- a/main.c
+++ b/main.c
@@ -55,9 +55,9 @@ NODE *ENVIRON_node, *IGNORECASE_node;
NODE *ARGC_node, *ARGV_node, *ARGIND_node;
NODE *FIELDWIDTHS_node;
-int NF;
-int NR;
-int FNR;
+long NF;
+long NR;
+long FNR;
int IGNORECASE;
char *RS;
char *OFS;
@@ -134,11 +134,13 @@ char **argv;
{
int c;
char *scan;
+ /* the + on the front tells GNU getopt not to rearrange argv */
+ const char *optlist = "+F:f:v:W:m:";
+ int stopped_early = 0;
+ int old_optind;
extern int optind;
extern int opterr;
extern char *optarg;
- const char *optlist = "+F:f:v:W:m:";
- int stopped_early = 0;
#ifdef __EMX__
_response(&argc, &argv);
@@ -188,10 +190,10 @@ char **argv;
/* we do error messages ourselves on invalid options */
opterr = 0;
- /* the + on the front tells GNU getopt not to rearrange argv */
- for (optopt = 0;
+ /* option processing. ready, set, go! */
+ for (optopt = 0, old_optind = 1;
(c = getopt_long(argc, argv, optlist, optab, NULL)) != EOF;
- optopt = 0) {
+ optopt = 0, old_optind = optind) {
if (do_posix)
opterr = 1;
switch (c) {
@@ -254,7 +256,7 @@ char **argv;
break;
case 's':
- if (strlen(optarg) == 0)
+ if (optarg[0] == '\0')
warning("empty argument to --source ignored");
else {
srcfiles[++numfiles].stype = CMDLINE;
@@ -291,7 +293,12 @@ char **argv;
*/
if (! do_posix
&& (optopt == 0 || strchr(optlist, optopt) == NULL)) {
- optind--;
+ /*
+ * can't just do optind--. In case of an
+ * option with >=2 letters, getopt_long
+ * won't have incremented optind.
+ */
+ optind = old_optind;
stopped_early = 1;
goto out;
} else if (optopt)
@@ -309,6 +316,14 @@ out:
if (do_nostalgia)
nostalgia();
+ /* check for POSIXLY_CORRECT environment variable */
+ if (! do_posix && getenv("POSIXLY_CORRECT") != NULL) {
+ do_posix = 1;
+ if (do_lint)
+ warning(
+ "environment variable `POSIXLY_CORRECT' set: turning on --posix");
+ }
+
/* POSIX compliance also implies no Unix extensions either */
if (do_posix)
do_unix = 1;
@@ -336,6 +351,10 @@ out:
/* Set up the field variables */
init_fields();
+ if (do_lint && begin_block == NULL && expression_value == NULL
+ && end_block == NULL)
+ warning("no program");
+
if (begin_block) {
in_begin_rule = 1;
(void) interpret(begin_block);
@@ -718,7 +737,7 @@ char *optstr;
if (strncasecmp(cp, "source=", 7) != 0)
goto unknown;
cp += 7;
- if (strlen(cp) == 0)
+ if (cp[0] == '\0')
warning("empty argument to -Wsource ignored");
else {
srcfiles[++numfiles].stype = CMDLINE;
diff --git a/missing/strftime.3 b/missing/strftime.3
index 88d1a222..9efe8408 100644
--- a/missing/strftime.3
+++ b/missing/strftime.3
@@ -220,7 +220,8 @@ day of week 1) as a decimal number
.RB ( 01 - 53 ).
The method for determining the week number is as specified by ISO 8601
(to wit: if the week containing January 1 has four or more days in the
-new year, then it is week 1, otherwise it is week 53 of the previous year
+new year, then it is week 1, otherwise it is the highest numbered
+week of the previous year (52 or 53)
and the next week is week 1).
.LP
The text of the POSIX standard for the
@@ -242,12 +243,8 @@ in week 0.
is replaced by the week number of the year (the first Monday as the first
day of week 1) as a decimal number
.RB ( 00 - 53 ).
-All days in a new year preceding the first Sunday are considered to be
+All days in a new year preceding the first Monday are considered to be
in week 0.
-(Note: this last statement is quoted verbatim from the POSIX standard.
-It probably means to say ``all days in a new year preceding the first
-.I Monday
-are considered to be in week 0.'')
.LP
In addition, the alternate representations
.BR %Ec ,
@@ -315,3 +312,5 @@ Thanks to Geoff Clare <gwc@root.co.uk> for helping debug earlier
versions of this routine, and for advice about POSIX semantics.
Additional thanks to Arthur David Olsen <ado@elsie.nci.nih.gov>
for some code improvements.
+Thanks also to Tor Lillqvist <tml@tik.vtt.fi>
+for code fixes to the ISO 8601 code.
diff --git a/missing/strftime.c b/missing/strftime.c
index 5bd18828..629eb5f2 100644
--- a/missing/strftime.c
+++ b/missing/strftime.c
@@ -1,8 +1,7 @@
/*
* strftime.c
*
- * Public-domain relatively quick-and-dirty implementation of
- * ANSI library routine for System V Unix systems.
+ * Public-domain implementation of ANSI C library routine.
*
* It's written in old-style C for maximal portability.
* However, since I'm used to prototypes, I've included them too.
@@ -10,6 +9,7 @@
* If you want stuff in the System V ascftime routine, add the SYSV_EXT define.
* For extensions from SunOS, add SUNOS_EXT.
* For stuff needed to implement the P1003.2 date command, add POSIX2_DATE.
+ * For VMS dates, add VMS_EXT.
* For complete POSIX semantics, add POSIX_SEMANTICS.
*
* The code for %c, %x, and %X is my best guess as to what's "appropriate".
@@ -24,19 +24,35 @@
* January, February, March, 1991
* Updated March, April 1992
* Updated April, 1993
+ * Updated February, 1994
+ * Updated May, 1994
*
* Fixes from ado@elsie.nci.nih.gov
* February 1991, May 1992
- * Fixes from Tor Lillqvist tor@tik.vtt.fi
+ * Fixes from Tor Lillqvist tml@tik.vtt.fi
* May, 1993
+ * Further fixes from ado@elsie.nci.nih.gov
+ * February 1994
*/
+/************ for gawk 2.15.5 ***************/
+#ifndef TZNAME_MISSING
+#define HAVE_TZNAME
+#endif
+#ifndef TM_ZONE_MISSING
+#define HAVE_TM_ZONE
+#endif
+/*********** end of for gawk 2.15.5 *********/
+
#ifndef GAWK
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
+#endif
+#if defined(TM_IN_SYS_TIME) || ! defined(GAWK)
#include <sys/types.h>
+#include <sys/time.h>
#endif
/* defaults: season to taste */
@@ -92,7 +108,7 @@ adddecl(static int iso8601wknum(const struct tm *timeptr);)
#define range(low, item, hi) max(low, min(item, hi))
-#if !defined(OS2) && !defined(MSDOS) && !defined(TZNAME_MISSING)
+#if !defined(OS2) && !defined(MSDOS) && defined(HAVE_TZNAME)
extern char *tzname[2];
extern int daylight;
#endif
@@ -141,7 +157,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
{
char *endp = s + maxsize;
char *start = s;
- char tbuf[100];
+ auto char tbuf[100];
int i;
static short first = 1;
#ifdef POSIX_SEMANTICS
@@ -149,6 +165,11 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
static int savetzlen = 0;
char *tz;
#endif /* POSIX_SEMANTICS */
+#ifndef HAVE_TM_ZONE
+ extern char *timezone();
+ struct timeval tv;
+ struct timezone zone;
+#endif /* HAVE_TM_ZONE */
/* various tables, useful in North America */
static const char *days_a[] = {
@@ -173,6 +194,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
if (s == NULL || format == NULL || timeptr == NULL || maxsize == 0)
return 0;
+ /* quick check if we even need to bother */
if (strchr(format, '%') == NULL && strlen(format) + 1 >= maxsize)
return 0;
@@ -316,7 +338,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
break;
case 'U': /* week of year, Sunday is first day of week */
- sprintf(tbuf, "%d", weeknumber(timeptr, 0));
+ sprintf(tbuf, "%02d", weeknumber(timeptr, 0));
break;
case 'w': /* weekday, Sunday == 0, 0 - 6 */
@@ -325,7 +347,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
break;
case 'W': /* week of year, Monday is first day of week */
- sprintf(tbuf, "%d", weeknumber(timeptr, 1));
+ sprintf(tbuf, "%02d", weeknumber(timeptr, 1));
break;
case 'x': /* appropriate date representation */
@@ -345,7 +367,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
case 'y': /* year without a century, 00 - 99 */
i = timeptr->tm_year % 100;
- sprintf(tbuf, "%d", i);
+ sprintf(tbuf, "%02d", i);
break;
case 'Y': /* year with century */
@@ -353,17 +375,17 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
break;
case 'Z': /* time zone name or abbrevation */
- i = 0;
- if (
-#ifndef TZNAME_MISSING
- daylight &&
-#endif
- timeptr->tm_isdst)
- i = 1;
-#ifdef TZNAME_MISSING
+#ifdef HAVE_TZNAME
+ i = (daylight && timeptr->tm_isdst); /* 0 or 1 */
+ strcpy(tbuf, tzname[i]);
+#else
+#ifdef HAVE_TM_ZONE
strcpy(tbuf, timeptr->tm_zone);
#else
- strcpy(tbuf, tzname[i]);
+ gettimeofday(& tv, & zone);
+ strcpy(tbuf, timezone(zone.tz_minuteswest,
+ timeptr->tm_isdst));
+#endif
#endif
break;
@@ -417,7 +439,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
#ifdef VMS_EXT
case 'v': /* date as dd-bbb-YYYY */
- sprintf(tbuf, "%2d-%3.3s-%4d",
+ sprintf(tbuf, "%02d-%3.3s-%4d",
range(1, timeptr->tm_mday, 31),
months_a[range(0, timeptr->tm_mon, 11)],
timeptr->tm_year + 1900);
@@ -449,11 +471,11 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
if (! warned && do_lint) {
warned = 1;
warning(
- "conversion %%V added in P1003.2/11.3; for VMS style date, use %%v");
+ "conversion %%V added in P1003.2; for VMS style date, use %%v");
}
}
#endif
- sprintf(tbuf, "%d", iso8601wknum(timeptr));
+ sprintf(tbuf, "%02d", iso8601wknum(timeptr));
break;
case 'u':
@@ -469,12 +491,13 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
break;
}
i = strlen(tbuf);
- if (i)
+ if (i) {
if (s + i < endp - 1) {
strcpy(s, tbuf);
s += i;
} else
return 0;
+ }
}
out:
if (s < endp && *format == '\0') {
@@ -484,6 +507,21 @@ out:
return 0;
}
+/* isleap --- is a year a leap year? */
+
+#ifndef __STDC__
+static int
+isleap(year)
+int year;
+#else
+static int
+isleap(int year)
+#endif
+{
+ return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
+}
+
+
#ifdef POSIX2_DATE
/* iso8601wknum --- compute week number according to ISO 8601 */
@@ -497,20 +535,23 @@ iso8601wknum(const struct tm *timeptr)
#endif
{
/*
- * From 1003.2 D11.3:
+ * From 1003.2:
* If the week (Monday to Sunday) containing January 1
* has four or more days in the new year, then it is week 1;
- * otherwise it is week 53 of the previous year, and the
- * next week is week 1.
+ * otherwise it is the highest numbered week of the previous
+ * (52 or 53) year, and the next week is week 1.
*
* ADR: This means if Jan 1 was Monday through Thursday,
- * it was week 1, otherwise week 53.
+ * it was week 1, otherwise week 52 or 53.
+ *
+ * XPG4 erroneously included POSIX.2 rationale text in the
+ * main body of the standard. Thus it requires week 53.
*/
- int simple_wknum, jan1day, diff, ret;
+ int weeknum, jan1day, diff;
/* get week number, Monday as first day of the week */
- simple_wknum = weeknumber(timeptr, 1) + 1;
+ weeknum = weeknumber(timeptr, 1);
/*
* With thanks and tip of the hatlo to tml@tik.vtt.fi
@@ -531,17 +572,47 @@ iso8601wknum(const struct tm *timeptr)
/*
* If Jan 1 was a Monday through Thursday, it was in
- * week 1. Otherwise it was last year's week 53, which is
+ * week 1. Otherwise it was last year's highest week, which is
* this year's week 0.
+ *
+ * What does that mean?
+ * If Jan 1 was Monday, the week number is exactly right, it can
+ * never be 0.
+ * If it was Tuesday through Thursday, the weeknumber is one
+ * less than it should be, so we add one.
+ * Otherwise, Friday, Saturday or Sunday, the week number is
+ * OK, but if it is 0, it needs to be 52 or 53.
*/
- if (jan1day >= 1 && jan1day <= 4)
- diff = 0;
- else
- diff = 1;
- ret = simple_wknum - diff;
- if (ret == 0) /* we're in the first week of the year */
- ret = 53;
- return ret;
+ switch (jan1day) {
+ case 1: /* Monday */
+ break;
+ case 2: /* Tuesday */
+ case 3: /* Wednedsday */
+ case 4: /* Thursday */
+ weeknum++;
+ break;
+ case 5: /* Friday */
+ case 6: /* Saturday */
+ case 0: /* Sunday */
+ if (weeknum == 0) {
+#ifdef USE_BROKEN_XPG4
+ /* XPG4 (as of March 1994) says 53 unconditionally */
+ weeknum = 53;
+#else
+ /* get week number of last week of last year */
+ struct tm dec31ly; /* 12/31 last year */
+ dec31ly = *timeptr;
+ dec31ly.tm_year--;
+ dec31ly.tm_mon = 11;
+ dec31ly.tm_mday = 31;
+ dec31ly.tm_wday = (jan1day == 0) ? 6 : jan1day - 1;
+ dec31ly.tm_yday = 364 + isleap(dec31ly.tm_year + 1900);
+ weeknum = iso8601wknum(& dec31ly);
+#endif
+ }
+ break;
+ }
+ return weeknum;
}
#endif
@@ -559,11 +630,19 @@ static int
weeknumber(const struct tm *timeptr, int firstweekday)
#endif
{
- if (firstweekday == 0)
- return (timeptr->tm_yday + 7 - timeptr->tm_wday) / 7;
- else
- return (timeptr->tm_yday + 7 -
- (timeptr->tm_wday ? (timeptr->tm_wday - 1) : 6)) / 7;
+ int wday = timeptr->tm_wday;
+ int ret;
+
+ if (firstweekday == 1) {
+ if (wday == 0) /* sunday */
+ wday = 6;
+ else
+ wday--;
+ }
+ ret = ((timeptr->tm_yday + 7 - wday) / 7);
+ if (ret < 0)
+ ret = 0;
+ return ret;
}
#if 0
@@ -666,14 +745,14 @@ static char *array[] =
"(%%p) locale's AM or PM based on 12-hour clock %p",
"(%%r) time, 12-hour (same as %%I:%%M:%%S %%p) %r",
"(%%u) ISO 8601: Weekday as decimal number [1 (Monday) - 7] %u",
- "(%%v) VAX date (dd-bbb-YYYY) %v",
+ "(%%v) VMS date (dd-bbb-YYYY) %v",
"(%%w) day of week (0..6, Sunday == 0) %w",
"(%%x) appropriate locale date representation %x",
"(%%y) last two digits of year (00..99) %y",
(char *) NULL
};
-/* Main routine. */
+/* main routine. */
int
main(argc, argv)
diff --git a/msg.c b/msg.c
index 28bee2b0..4bd9f901 100644
--- a/msg.c
+++ b/msg.c
@@ -52,7 +52,7 @@ va_list argp;
(void) putc('(', stderr);
if (file)
(void) fprintf(stderr, "FILENAME=%s ", file);
- (void) fprintf(stderr, "FNR=%d) ", FNR);
+ (void) fprintf(stderr, "FNR=%ld) ", FNR);
}
(void) fprintf(stderr, s);
vfprintf(stderr, emsg, argp);
diff --git a/node.c b/node.c
index bef53910..dca4ad19 100644
--- a/node.c
+++ b/node.c
@@ -122,7 +122,7 @@ register NODE *s;
{
char buf[128];
register char *sp = buf;
- register long num = 0;
+ double val;
#ifdef DEBUG
if (s == NULL) cant_happen();
@@ -132,10 +132,43 @@ register NODE *s;
if (s->stref != 0) ; /*cant_happen();*/
#endif
- /* avoids floating point exception in DOS*/
- if ( s->numbr <= LONG_MAX && s->numbr >= -LONG_MAX)
- num = (long)s->numbr;
- if ((AWKNUM) num == s->numbr) { /* integral value */
+ /* not an integral value, or out of range */
+ if ((val = double_to_int(s->numbr)) != s->numbr
+ || val < LONG_MIN || val > LONG_MAX) {
+#ifdef GFMT_WORKAROUND
+ NODE *dummy, *r;
+ unsigned short oflags;
+ extern NODE *format_tree P((const char *, int, NODE *));
+ extern NODE **fmt_list; /* declared in eval.c */
+
+ /* create dummy node for a sole use of format_tree */
+ getnode(dummy);
+ dummy->lnode = s;
+ dummy->rnode = NULL;
+ oflags = s->flags;
+ s->flags |= PERM; /* prevent from freeing by format_tree() */
+ r = format_tree(CONVFMT, fmt_list[CONVFMTidx]->stlen, dummy);
+ s->flags = oflags;
+ s->stfmt = (char)CONVFMTidx;
+ s->stlen = r->stlen;
+ s->stptr = r->stptr;
+ freenode(r); /* Do not free_temp(r)! We want */
+ freenode(dummy); /* to keep s->stptr == r->stpr. */
+
+ goto no_malloc;
+#else
+ /*
+ * no need for a "replacement" formatting by gawk,
+ * just use sprintf
+ */
+ sprintf(sp, CONVFMT, s->numbr);
+ s->stlen = strlen(sp);
+ s->stfmt = (char)CONVFMTidx;
+#endif /* GFMT_WORKAROUND */
+ } else {
+ /* integral value */
+ /* force conversion to long only once */
+ register long num = (long) val;
if (num < NVAL && num >= 0) {
sp = (char *) values[num];
s->stlen = 1;
@@ -144,14 +177,11 @@ register NODE *s;
s->stlen = strlen(sp);
}
s->stfmt = -1;
- } else {
- NUMTOSTR(sp, CONVFMT, s->numbr);
- s->stlen = strlen(sp);
- s->stfmt = (char)CONVFMTidx;
}
- s->stref = 1;
emalloc(s->stptr, char *, s->stlen + 2, "force_string");
memcpy(s->stptr, sp, s->stlen+1);
+no_malloc:
+ s->stref = 1;
s->flags |= STR;
return s;
}
@@ -183,7 +213,8 @@ NODE *n;
if (n->type == Node_val && (n->flags & STR)) {
r->stref = 1;
emalloc(r->stptr, char *, r->stlen + 2, "dupnode");
- memcpy(r->stptr, n->stptr, r->stlen+1);
+ memcpy(r->stptr, n->stptr, r->stlen);
+ r->stptr[r->stlen] = '\0';
}
return r;
}
@@ -286,8 +317,10 @@ more_nodes()
/* get more nodes and initialize list */
emalloc(nextfree, NODE *, NODECHUNK * sizeof(NODE), "newnode");
- for (np = nextfree; np < &nextfree[NODECHUNK - 1]; np++)
+ for (np = nextfree; np < &nextfree[NODECHUNK - 1]; np++) {
+ np->flags = 0;
np->nextp = np + 1;
+ }
np->nextp = NULL;
np = nextfree;
nextfree = nextfree->nextp;
diff --git a/patchlevel.h b/patchlevel.h
index ccb0c85f..c80ca154 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -1 +1 @@
-#define PATCHLEVEL 4
+#define PATCHLEVEL 5
diff --git a/protos.h b/protos.h
index e3ecda86..1d4ac998 100644
--- a/protos.h
+++ b/protos.h
@@ -32,14 +32,16 @@ extern aptr_t malloc P((MALLOC_ARG_T));
extern aptr_t realloc P((aptr_t, MALLOC_ARG_T));
extern aptr_t calloc P((MALLOC_ARG_T, MALLOC_ARG_T));
+#if !defined(sun) && !defined(__sun__)
extern void free P((aptr_t));
-extern char *getenv P((char *));
+#endif
+extern char *getenv P((const char *));
extern char *strcpy P((char *, const char *));
extern char *strcat P((char *, const char *));
-extern char *strncpy P((char *, const char *, int));
extern int strcmp P((const char *, const char *));
-extern int strncmp P((const char *, const char *, int));
+extern char *strncpy P((char *, const char *, size_t));
+extern int strncmp P((const char *, const char *, size_t));
#ifndef VMS
extern char *strerror P((int));
#else
@@ -48,12 +50,16 @@ extern char *strerror P((int,...));
extern char *strchr P((const char *, int));
extern char *strrchr P((const char *, int));
extern char *strstr P((const char *s1, const char *s2));
-extern int strlen P((const char *));
+extern size_t strlen P((const char *));
extern long strtol P((const char *, char **, int));
#if !defined(_MSC_VER) && !defined(__GNU_LIBRARY__)
extern size_t strftime P((char *, size_t, const char *, const struct tm *));
#endif
+#ifdef __STDC__
extern time_t time P((time_t *));
+#else
+extern long time();
+#endif
extern aptr_t memset P((aptr_t, int, size_t));
extern aptr_t memcpy P((aptr_t, const aptr_t, size_t));
extern aptr_t memmove P((aptr_t, const aptr_t, size_t));
@@ -62,7 +68,11 @@ extern int memcmp P((const aptr_t, const aptr_t, size_t));
extern int fprintf P((FILE *, const char *, ...));
#if !defined(MSDOS) && !defined(__GNU_LIBRARY__)
-extern size_t fwrite P((const void *, size_t, size_t, FILE *));
+#ifdef __STDC__
+extern size_t fwrite P((const aptr_t, size_t, size_t, FILE *));
+#else
+extern int fwrite();
+#endif
extern int fputs P((const char *, FILE *));
extern int unlink P((const char *));
#endif
@@ -83,7 +93,7 @@ extern int tolower P((int));
#endif
extern double pow P((double x, double y));
-extern double atof P((char *));
+extern double atof P((const char *));
extern double strtod P((const char *, char **));
extern int fstat P((int, struct stat *));
extern int stat P((const char *, struct stat *));
@@ -97,18 +107,16 @@ extern int dup P((int));
extern int dup2 P((int,int));
extern int fork P(());
extern int execl P((/* char *, char *, ... */));
+#ifndef __STDC__
extern int read P((int, char *, int));
+#endif
extern int wait P((int *));
extern void _exit P((int));
-#ifndef __STDC__
-extern long time P((long *));
-#endif
-
#ifdef NON_STD_SPRINTF
-extern char *sprintf();
+extern char *sprintf P((char *, const char*, ...));
#else
-extern int sprintf();
+extern int sprintf P((char *, const char*, ...));
#endif /* SPRINTF_INT */
#undef aptr_t
diff --git a/test/Makefile b/test/Makefile
index 8f10d339..0cd4397c 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -7,7 +7,7 @@ basic: msg swaplns messages argarray longwrds \
fsbs negexp asgext anchgsub splitargv awkpath nfset reparse
gawk.extensions: fieldwdth ignrcase posix manyfiles igncfs argtest \
- badargtest
+ badargs
extra: regtest inftest
@@ -69,6 +69,7 @@ posix::
cmp posix.good tmp && rm -f tmp
manyfiles::
+ @rm -rf junk
@mkdir junk
@../gawk 'BEGIN { for (i = 1; i <= 300; i++) print i, i}' >tmp
@../gawk -f manyfiles.awk tmp tmp
@@ -137,9 +138,9 @@ argtest::
@../gawk -f argtest.awk -x -y abc >tmp
cmp argtest.good tmp && rm -f tmp
-badargtest::
+badargs::
@-../gawk -f 2>&1 | grep -v patchlevel > tmp
cmp badargs.good tmp && rm -f tmp
clean:
- rm -f tmp core
+ rm -fr tmp core junk
diff --git a/test/manyfiles.awk b/test/manyfiles.awk
index 212e88d7..8651a3a4 100644
--- a/test/manyfiles.awk
+++ b/test/manyfiles.awk
@@ -1 +1 @@
-{ print $2 > "junk/" $1 }
+{ print $2 > ("junk/" $1) }
diff --git a/test/rs.good b/test/rs.good
index 7e14cc14..9dd6bd39 100644
--- a/test/rs.good
+++ b/test/rs.good
@@ -1,4 +1,3 @@
a b
c d
e
-
diff --git a/vms/descrip.mms b/vms/descrip.mms
index 679dd17e..f5872409 100644
--- a/vms/descrip.mms
+++ b/vms/descrip.mms
@@ -109,7 +109,7 @@ VMSOTHR = $(VMSDIR)Descrip.MMS,$(VMSDIR)vmsbuild.com,$(VMSDIR)version.com,\
# Release of gawk
REL=2.15
-PATCHLVL=3
+PATCHLVL=5
# dummy target to allow building "gawk" in addition to explicit "gawk.exe"
gawk : gawk.exe
@@ -132,19 +132,20 @@ gawk.opt : $(MAKEFILE) # create linker options file
write opt "identification=""V$(REL).$(PATCHLVL)"""
close opt
-$(AWKOBJS) : awk.h config.h
-$(VMSCODE) : awk.h config.h $(VMSDIR)vms.h
vms_misc.obj : $(VMSDIR)vms_misc.c
vms_popen.obj : $(VMSDIR)vms_popen.c
vms_fwrite.obj : $(VMSDIR)vms_fwrite.c
vms_args.obj : $(VMSDIR)vms_args.c
vms_gawk.obj : $(VMSDIR)vms_gawk.c
vms_cli.obj : $(VMSDIR)vms_cli.c
+$(VMSCODE) : awk.h config.h $(VMSDIR)vms.h
+
dfa.obj : awk.h config.h dfa.h
regex.obj : awk.h config.h regex.h
getopt.obj : getopt.h
main.obj : patchlevel.h
awktab.obj : awk.h awktab.c
+$(AWKOBJS) : awk.h config.h
# bison or yacc required
awktab.c : awk.y # foo.y :: yacc => y[_]tab.c, bison => foo_tab.c
diff --git a/vms/vmsbuild.com b/vms/vmsbuild.com
index d255fe15..de01cc74 100644
--- a/vms/vmsbuild.com
+++ b/vms/vmsbuild.com
@@ -5,7 +5,7 @@ $! gawk 2.14 revised, Sep'92
$! gawk 2.15 revised, Oct'93
$!
$ REL = "2.15" !release version number
-$ PATCHLVL = "4"
+$ PATCHLVL = "5"
$!
$! [ remove "/optimize=noinline" for VAX C V2.x or DEC C ]
$! [ add "/standard=VAXC" for DEC C and "/g_float" for Alpha ]