Skip to content

Commit

Permalink
Document SYMTAB and FUNCTAB. Disable for --posix.
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoldrobbins committed Oct 2, 2012
1 parent b9a8285 commit 9e2703f
Show file tree
Hide file tree
Showing 7 changed files with 471 additions and 280 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2012-10-02 Arnold D. Robbins <arnold@skeeve.com>

* symbol.c (lookup): If do_posix, skip the global table.

2012-09-25 Arnold D. Robbins <arnold@skeeve.com>

First cut at SYMTAB and FUNCTAB. This does the following:
Expand Down
5 changes: 5 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2012-10-02 Arnold D. Robbins <arnold@skeeve.com>

* gawk.texi, gawk.1, awkcard.in: Document FUNCTAB, SYMTAB, and
PROCINFO["identifiers"].

2012-09-23 Arnold D. Robbins <arnold@skeeve.com>

* gawk.texi (Nextfile Statement): Document that it's now part of POSIX
Expand Down
24 changes: 17 additions & 7 deletions doc/awkcard.in
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,8 @@ variables, each element being the value of
that variable.
T}
\*(CB\*(FCERRNO\fP T{
String describing the error if a
... String describing the error if a
String error value if a
\*(FCgetline\*(FR
redirection or read
fails, or if
Expand Down Expand Up @@ -580,6 +581,10 @@ T}
Input field separator, a space by default
(see \fHFields\fP above).
T}
\*(CB\*(FCFUNCTAB\fP T{
An array indexed by the names of all user-defined
and extension functions.\*(CD
T}
\*(CB\*(FCIGNORECASE\fP T{
If non-zero, all regular expression and string
operations ignore case.
Expand All @@ -594,13 +599,13 @@ T}
\*(CB\*(FCLINT\fP T{
Provides dynamic control of the \*(FC\-\^\-lint\fP
option from within an AWK program.
When true, \*(GK
prints lint warnings.
When assigned the string value \*(FC"fatal"\*(FR,
lint warnings become fatal errors.
Any other true value just prints warnings.\*(CD
... When true, \*(GK
... prints lint warnings.
... When assigned the string value \*(FC"fatal"\*(FR,
... lint warnings become fatal errors.
... Any other true value just prints warnings.
T}
\*(FCNF\fP T{
\*(CD\*(FCNF\fP T{
Number of fields in the current input record.
T}
\*(FCNR\fP T{
Expand Down Expand Up @@ -650,6 +655,11 @@ Character(s) used to separate multiple subscripts
in array elements, by default \*(FC"\e034"\*(FR. (See
\fHArrays\fP below).
T}
\*(CB\*(FCSYMTAB\fP T{
An array indexed by the names of all global
variables and arrays. May be used to indirectly
set variable and array values.\*(CD
T}
\*(CB\*(FCTEXTDOMAIN\fP T{
The internationalization text domain,
for finding the localized
Expand Down
56 changes: 55 additions & 1 deletion doc/gawk.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 9e2703f

Please sign in to comment.