From b51edf37c4271bf5ec5dcad9d35169f55e38efa9 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Tue, 20 Mar 2012 10:46:03 -0400 Subject: - Add new environment variable AWKLIBPATH to use when searching for shared libraries. - Instead of hardcoding the default ".so" suffix for shared libraries, use autoconf to get the right value for this platform. - Build and install some of the bundled shared library extensions so that they will now be available using the default AWKLIBPATH. --- doc/gawk.1 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'doc/gawk.1') diff --git a/doc/gawk.1 b/doc/gawk.1 index 07a8d0e3..cc0ccae2 100644 --- a/doc/gawk.1 +++ b/doc/gawk.1 @@ -330,11 +330,10 @@ these options cause an immediate, successful exit.) Load a shared library .IR lib . This searches for the library using the -.B AWKPATH -environment variable. The suffix -.I .so -in the library name is optional, and -the library initialization routine is expected to be named +.B AWKLIBPATH +environment variable. If the initial search fails, another attempt will +be made after appending the default shared library suffix for the platform. +The library initialization routine is expected to be named .BR dlload() . .TP .PD 0 @@ -3596,6 +3595,16 @@ and options. .PP The +.B AWKLIBPATH +environment variable can be used to provide a list of directories that +.I gawk +searches when looking for files named via the +.B \-l +and +.B \-\^\-load +options. +.PP +The .B GAWK_READ_TIMEOUT environment variable can be used to specify a timeout in milliseconds for reading input from a terminal, pipe -- cgit v1.2.3 From 700b6ddbe8f6c0a84cb61abac6fd94a4fe9221ca Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Wed, 21 Mar 2012 21:01:11 -0400 Subject: New @load keyword to load shared libraries. --- doc/gawk.1 | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'doc/gawk.1') diff --git a/doc/gawk.1 b/doc/gawk.1 index cc0ccae2..2e039521 100644 --- a/doc/gawk.1 +++ b/doc/gawk.1 @@ -563,6 +563,9 @@ and optional function definitions. .RS .PP \fB@include "\fIfilename\fB" +.br +\fB@load "\fIfilename\fB" +.br \fIpattern\fB { \fIaction statements\fB }\fR .br \fBfunction \fIname\fB(\fIparameter list\fB) { \fIstatements\fB }\fR @@ -594,6 +597,13 @@ In addition, lines beginning with may be used to include other source files into your program, making library use even easier. .PP +Lines beginning with +.B @load +may be used to load shared libraries into your program. This is equivalent +to using the +.B \-l +option. +.PP The environment variable .B AWKPATH specifies a search path to use when finding source files named with -- cgit v1.2.3 From cdf892a07fa67c635997e41ee8fe175aaafb2431 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Sat, 19 May 2012 23:45:07 -0400 Subject: Add -i option, append .awk if initial search fails, and allow -f repeats. --- doc/gawk.1 | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'doc/gawk.1') diff --git a/doc/gawk.1 b/doc/gawk.1 index dbc2582b..dbc527e1 100644 --- a/doc/gawk.1 +++ b/doc/gawk.1 @@ -323,6 +323,19 @@ the standard output. these options cause an immediate, successful exit.) .TP .PD 0 +.BI "\-i " include-file +.TP +.PD +.BI \-\^\-include " include-file" +Load an awk source library. +This searches for the library using the +.B AWKPATH +environment variable. If the initial search fails, another attempt will +be made after appending the ".awk" suffix. The file will be loaded only +once (i.e. duplicates are eliminated), and the code does not constitute +the main program source. +.TP +.PD 0 .BI "\-l " lib .TP .PD @@ -619,7 +632,9 @@ The environment variable specifies a search path to use when finding source files named with the .B \-f -option. If this variable does not exist, the default path is +and +.B \-i +options. If this variable does not exist, the default path is \fB".:/usr/local/share/awk"\fR. (The actual directory may vary, depending upon how .I gawk @@ -3643,9 +3658,14 @@ environment variable can be used to provide a list of directories that .I gawk searches when looking for files named via the .B \-f -and +, .B \-\^\-file -options. +, +.B \-i +and +.B \-\^\-include +options. If the initial search fails, the path is searched again after +appending ".awk" to the filename. .PP The .B AWKLIBPATH -- cgit v1.2.3 From 577c3fc31a2718461fba2e599d162de96fe838fa Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Thu, 24 May 2012 15:34:17 -0400 Subject: First working version of new API mechanism (probably has memory leaks). --- doc/gawk.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/gawk.1') diff --git a/doc/gawk.1 b/doc/gawk.1 index dbc527e1..a2cfab6e 100644 --- a/doc/gawk.1 +++ b/doc/gawk.1 @@ -347,7 +347,7 @@ This searches for the library using the environment variable. If the initial search fails, another attempt will be made after appending the default shared library suffix for the platform. The library initialization routine is expected to be named -.BR dlload() . +.BR dl_load() . .TP .PD 0 .BR "\-L " [ \fIvalue\fR ] -- cgit v1.2.3 From e1749c3c853ace06796efd7dd3bd3e9bf025a549 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 9 Jul 2012 21:11:54 +0300 Subject: Extend or(), and(), xor() to N arguments, N >= 2. --- doc/gawk.1 | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'doc/gawk.1') diff --git a/doc/gawk.1 b/doc/gawk.1 index a2cfab6e..4a19219a 100644 --- a/doc/gawk.1 +++ b/doc/gawk.1 @@ -2977,11 +2977,9 @@ integers, doing the operation, and then converting the result back to floating point. The functions are: .TP "\w'\fBrshift(\fIval\fB, \fIcount\fB)\fR'u+2n" -\fBand(\fIv1\fB, \fIv2\fB)\fR -Return the bitwise AND of the values provided by -.I v1 -and -.IR v2 . +\fBand(\fIv1\fB, \fIv2 \fR[, ...]\fB)\fR +Return the bitwise AND of the values provided in the argument list. +There must be at least two. .TP \fBcompl(\fIval\fB)\fR Return the bitwise complement of @@ -2994,11 +2992,9 @@ shifted left by .I count bits. .TP -\fBor(\fIv1\fB, \fIv2\fB)\fR -Return the bitwise OR of the values provided by -.I v1 -and -.IR v2 . +\fBor(\fIv1\fB, \fIv2 \fR[, ...]\fB)\fR +Return the bitwise OR of the values provided in the argument list. +There must be at least two. .TP \fBrshift(\fIval\fB, \fIcount\fB)\fR Return the value of @@ -3007,11 +3003,9 @@ shifted right by .I count bits. .TP -\fBxor(\fIv1\fB, \fIv2\fB)\fR -Return the bitwise XOR of the values provided by -.I v1 -and -.IR v2 . +\fBxor(\fIv1\fB, \fIv2 \fR[, ...]\fB)\fR +Return the bitwise XOR of the values provided in the argument list. +There must be at least two. .PP .SS Type Function The following function is for use with multidimensional arrays. -- cgit v1.2.3 From 4319d9141a56cb8ed878d44d0e74bedee51085a6 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 12 Jul 2012 22:28:49 +0300 Subject: Minor doc updates. --- doc/gawk.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/gawk.1') diff --git a/doc/gawk.1 b/doc/gawk.1 index 4a19219a..c0a0a413 100644 --- a/doc/gawk.1 +++ b/doc/gawk.1 @@ -3886,7 +3886,7 @@ We thank him. .SH COPYING PERMISSIONS Copyright \(co 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2007, 2009, -2010, 2011 +2010, 2011, 2012 Free Software Foundation, Inc. .PP Permission is granted to make and distribute verbatim copies of -- cgit v1.2.3 From 35716c6aaa573dc15012fe1cba8d18b242367fd0 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 10 Aug 2012 11:53:37 +0300 Subject: Doc updates. Mostly about the API. --- doc/gawk.1 | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'doc/gawk.1') diff --git a/doc/gawk.1 b/doc/gawk.1 index c0a0a413..494ab16d 100644 --- a/doc/gawk.1 +++ b/doc/gawk.1 @@ -14,7 +14,7 @@ . if \w'\(rq' .ds rq "\(rq . \} .\} -.TH GAWK 1 "Nov 10 2011" "Free Software Foundation" "Utility Commands" +.TH GAWK 1 "Aug 09 2012" "Free Software Foundation" "Utility Commands" .SH NAME gawk \- pattern scanning and processing language .SH SYNOPSIS @@ -3181,24 +3181,11 @@ may be used in place of .SH DYNAMICALLY LOADING NEW FUNCTIONS You can dynamically add new built-in functions to the running .I gawk -interpreter. +interpreter with the +.B @load +statement. The full details are beyond the scope of this manual page; -see \*(EP for the details. -.PP -.TP 8 -\fBextension(\fIobject\fB, \fIfunction\fB)\fR -Dynamically link the shared object file named by -.IR object , -and invoke -.I function -in that object, to perform initialization. -These should both be provided as strings. -Return the value returned by -.IR function . -.PP -Using this feature at the C level is not pretty, but -it is unlikely to go away. Additional mechanisms may -be added at some point. +see \*(EP. .SH SIGNALS The .I gawk @@ -3727,7 +3714,7 @@ status is 2. On non-POSIX systems, this value may be mapped to .SH VERSION INFORMATION This man page documents .IR gawk , -version 4.0. +version 4.1. .SH AUTHORS The original version of \*(UX .I awk @@ -3805,6 +3792,7 @@ While the developers occasionally read this newsgroup, posting bug reports there is an unreliable way to report bugs. Instead, please use the electronic mail addresses given above. +Really. .PP If you're using a GNU/Linux or BSD-based system, you may wish to submit a bug report to the vendor of your distribution. @@ -3824,6 +3812,7 @@ are surprisingly difficult to diagnose in the completely general case, and the effort to do so really is not worth it. .SH SEE ALSO .IR egrep (1), +.IR sed (1), .IR getpid (2), .IR getppid (2), .IR getpgrp (2), @@ -3839,7 +3828,7 @@ Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger, Addison-Wesley, 1988. ISBN 0-201-07981-X. .PP \*(EP, -Edition 4.0, shipped with the +Edition 4.1, shipped with the .I gawk source. The current version of this document is available online at -- cgit v1.2.3 From 9e2703f7ca0b35129a94465654d0e18d14048dbc Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 2 Oct 2012 16:26:15 +0200 Subject: Document SYMTAB and FUNCTAB. Disable for --posix. --- doc/gawk.1 | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) (limited to 'doc/gawk.1') diff --git a/doc/gawk.1 b/doc/gawk.1 index 494ab16d..30524e5a 100644 --- a/doc/gawk.1 +++ b/doc/gawk.1 @@ -14,7 +14,7 @@ . if \w'\(rq' .ds rq "\(rq . \} .\} -.TH GAWK 1 "Aug 09 2012" "Free Software Foundation" "Utility Commands" +.TH GAWK 1 "Oct 02 2012" "Free Software Foundation" "Utility Commands" .SH NAME gawk \- pattern scanning and processing language .SH SYNOPSIS @@ -989,6 +989,12 @@ The input field separator, a space by default. See .BR Fields , above. .TP +.B FUNCTAB +An array whose indices are the names of all the user-defined +or extension functions in the program. +.BR NOTE : +The array values cannot currently be used. +.TP .B IGNORECASE Controls the case-sensitivity of all regular expression and string operations. If @@ -1108,6 +1114,35 @@ or \fB"FIELDWIDTHS"\fP if field splitting with .B FIELDWIDTHS is in effect. .TP +\fBPROCINFO["identifiers"]\fP +A subarray, indexed by the names of all identifiers used in the +text of the AWK program. For each identifier, the value of the element is one of the following: +.RS +.TP +\fB"array"\fR +The identifier is an array. +.TP +\fB"extension"\fR +The identifier is an extension function loaded via +.BR @load . +.TP +\fB"scalar"\fR +The identifier is a scalar. +.TP +\fB"untyped"\fR +The identifier is untyped (could be used as a scalar or array, +.I gawk +doesn't know yet). +.TP +\fB"user"\fR +The identifier is a user-defined function. +.RE +The values indicate what +.I gawk +knows about the identifiers after it has finished parsing the program; they are +.I not +updated while the program runs. +.TP \fBPROCINFO["gid"]\fP the value of the .IR getgid (2) @@ -1236,6 +1271,25 @@ The length of the string matched by The character used to separate multiple subscripts in array elements, by default \fB"\e034"\fR. .TP +.B SYMTAB +An array whose indices are the names of all currently defined +global variables and arrays in the program. The array may be used +for indirect access to read or write the value of a variable: +.PP +.RS +.ft B +foo = 5 +SYMTAB["foo"] = 4 +print foo # prints 4 +.ft R +.RE +.PP +The +.B isarray() +function may be used to test if an element in +.B SYMTAB +is an array. +.TP .B TEXTDOMAIN The text domain of the \*(AK program; used to find the localized translations for the program's strings. -- cgit v1.2.3 From 3d9b832439afeb1b05c60831e0865df585dc55ac Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 3 Oct 2012 10:23:15 +0200 Subject: More SYMTAB and FUNCTAB improvements. --- doc/gawk.1 | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'doc/gawk.1') diff --git a/doc/gawk.1 b/doc/gawk.1 index 30524e5a..31fcef1f 100644 --- a/doc/gawk.1 +++ b/doc/gawk.1 @@ -994,6 +994,11 @@ An array whose indices are the names of all the user-defined or extension functions in the program. .BR NOTE : The array values cannot currently be used. +Also, you may not use the +.B delete +statment with the +.B FUNCTAB +array. .TP .B IGNORECASE Controls the case-sensitivity of all regular expression @@ -1289,6 +1294,11 @@ The function may be used to test if an element in .B SYMTAB is an array. +You may not use the +.B delete +statment with the +.B SYMTAB +array. .TP .B TEXTDOMAIN The text domain of the \*(AK program; used to find the localized -- cgit v1.2.3