gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, feature/namespaces, updated. gawk-4.1.0-


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, feature/namespaces, updated. gawk-4.1.0-2649-g4a0fb4a
Date: Wed, 26 Jul 2017 13:54:51 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, feature/namespaces has been updated
       via  4a0fb4aa64dd9d07a072ef530bf0b50e2f5a5447 (commit)
       via  a2fc2b8fe26ea240b9ce520be5101e85c329e2f9 (commit)
      from  4138bc1e488b8dcb91de9cc3235d0294a0106d64 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=4a0fb4aa64dd9d07a072ef530bf0b50e2f5a5447

commit 4a0fb4aa64dd9d07a072ef530bf0b50e2f5a5447
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Jul 26 20:54:25 2017 +0300

    More namespace doc improvements.

diff --git a/doc/ChangeLog b/doc/ChangeLog
index 63cedae..65257a4 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2017-07-26         Arnold D. Robbins     <address@hidden>
+
+       * gawktexi.in (Namespaces): More edits.
+
 2017-07-21         Arnold D. Robbins     <address@hidden>
 
        * gawktexi.in: Fix a spelling error.
diff --git a/doc/gawk.info b/doc/gawk.info
index 27779e5..c81269f 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -22565,9 +22565,9 @@ File: gawk.info,  Node: Qualified Names,  Next: Default 
Namespace,  Prev: Global
 ====================
 
 A "qualified name" is an identifier that includes a namespace name, the
-namespace separator '::', and a component name.  For example, one might
-have a function named 'posix::getpid()'.  Here, the namespace is 'posix'
-and the function name within the namespace (the component) is
+namespace separator '::', and a "component" name.  For example, one
+might have a function named 'posix::getpid()'.  Here, the namespace is
+'posix' and the function name within the namespace (the component) is
 'getpid()'.  The namespace and component names are separated by a
 double-colon.  Only one such separator is allowed in a qualified name.
 
@@ -22628,10 +22628,11 @@ with '-e' has such an implicit initial statement 
(*note Options::).
 
    Files included with '@include' (*note Include Files::) "push" and
 "pop" the current namespace.  That is, each '@include' saves the current
-namespace and starts over with an implicit '@namespace "awk"' until an
-explicit '@namespace' statement is seen.  When 'gawk' finishes
-processing the included file, the saved namespace is restored and
-processing continues where it left off in the original file.
+namespace and starts over with an implicit '@namespace "awk"' which
+remains in effect until an explicit '@namespace' statement is seen.
+When 'gawk' finishes processing the included file, the saved namespace
+is restored and processing continues where it left off in the original
+file.
 
    The use of '@namespace' has no influence upon the order of execution
 of 'BEGIN', 'BEGINFILE', 'END', and 'ENDFILE' rules.
@@ -22807,7 +22808,8 @@ namespace.
 *note Library Names::, whereby global variable and function names start
 with a capital letter.
 
-   Here is a simple test program:
+   Here is a simple test program.  Since it's in a separate file,
+unadorned identifiers are sought for in the 'awk' namespace:
 
      BEGIN {
          while ((p = getpwent()) != "")
@@ -22830,12 +22832,12 @@ File: gawk.info,  Node: Namespace And Features,  
Prev: Namespace Example,  Up: N
 15.8 Namespaces and Other 'gawk' Features
 =========================================
 
-This minor node looks at how the namespace facility interacts with other
-important 'gawk' features.
+This minor node looks briefly at how the namespace facility interacts
+with other important 'gawk' features.
 
    The profiler and pretty-printer (*note Profiling::) have been
 enhanced to understand namespaces and the namespace naming rules
-described in *note Naming Rules::.  In particular, the output groups
+presented in *note Naming Rules::.  In particular, the output groups
 functions in the same namespace together, and has '@namespace'
 directives in front of rules as necessary.  This allows component names
 to be simple identifiers, instead of using qualified identifiers
@@ -22847,12 +22849,12 @@ changed in order to accommodate namespaces, and the 
debugger's 'dump'
 command was adjusted to match.
 
    The extension API (*note Dynamic Extensions::) has always allowed for
-placing functions into a different namespace, although this was never
-implemented.  However, the symbol lookup and symbol update routines did
-not have provision for including a namespace.  That has now been
-corrected.  *Note Extension Sample Inplace::, for a nice example of an
-extension that leverages a namespace used by cooperating 'awk' and C
-code.
+placing functions into a different namespace, although this was not
+previously implemented.  However, the symbol lookup and symbol update
+routines did not have provision for including a namespace.  That has now
+been corrected (*note Symbol table by name::).  *Note Extension Sample
+Inplace::, for a nice example of an extension that leverages a namespace
+shared by cooperating 'awk' and C code.
 
 
 File: gawk.info,  Node: Arbitrary Precision Arithmetic,  Next: Dynamic 
Extensions,  Prev: Namespaces,  Up: Top
@@ -36558,186 +36560,186 @@ Node: Debugging Summary911106
 Node: Namespaces912385
 Node: Global Namespace913147
 Node: Qualified Names914501
-Node: Default Namespace915498
-Node: Changing The Namespace916239
-Node: Naming Rules917827
-Node: Internal Name Management919676
-Node: Namespace Example920718
-Node: Namespace And Features923187
-Node: Arbitrary Precision Arithmetic924546
-Node: Computer Arithmetic926033
-Ref: table-numeric-ranges929624
-Ref: Computer Arithmetic-Footnote-1930346
-Node: Math Definitions930403
-Ref: table-ieee-formats933717
-Ref: Math Definitions-Footnote-1934320
-Node: MPFR features934425
-Node: FP Math Caution936142
-Ref: FP Math Caution-Footnote-1937214
-Node: Inexactness of computations937583
-Node: Inexact representation938543
-Node: Comparing FP Values939903
-Node: Errors accumulate940985
-Node: Getting Accuracy942418
-Node: Try To Round945128
-Node: Setting precision946027
-Ref: table-predefined-precision-strings946724
-Node: Setting the rounding mode948554
-Ref: table-gawk-rounding-modes948928
-Ref: Setting the rounding mode-Footnote-1952336
-Node: Arbitrary Precision Integers952515
-Ref: Arbitrary Precision Integers-Footnote-1957420
-Node: Checking for MPFR957569
-Node: POSIX Floating Point Problems958866
-Ref: POSIX Floating Point Problems-Footnote-1962737
-Node: Floating point summary962775
-Node: Dynamic Extensions964965
-Node: Extension Intro966518
-Node: Plugin License967784
-Node: Extension Mechanism Outline968581
-Ref: figure-load-extension969020
-Ref: figure-register-new-function970585
-Ref: figure-call-new-function971677
-Node: Extension API Description973739
-Node: Extension API Functions Introduction975381
-Node: General Data Types980715
-Ref: General Data Types-Footnote-1987920
-Node: Memory Allocation Functions988219
-Ref: Memory Allocation Functions-Footnote-1991371
-Node: Constructor Functions991470
-Node: Registration Functions994469
-Node: Extension Functions995154
-Node: Exit Callback Functions1000367
-Node: Extension Version String1001617
-Node: Input Parsers1002280
-Node: Output Wrappers1014987
-Node: Two-way processors1019499
-Node: Printing Messages1021764
-Ref: Printing Messages-Footnote-11022935
-Node: Updating ERRNO1023088
-Node: Requesting Values1023827
-Ref: table-value-types-returned1024564
-Node: Accessing Parameters1025500
-Node: Symbol Table Access1026735
-Node: Symbol table by name1027247
-Ref: Symbol table by name-Footnote-11030137
-Node: Symbol table by cookie1030265
-Ref: Symbol table by cookie-Footnote-11034450
-Node: Cached values1034514
-Ref: Cached values-Footnote-11038050
-Node: Array Manipulation1038141
-Ref: Array Manipulation-Footnote-11039232
-Node: Array Data Types1039269
-Ref: Array Data Types-Footnote-11041927
-Node: Array Functions1042019
-Node: Flattening Arrays1046418
-Node: Creating Arrays1053359
-Node: Redirection API1058128
-Node: Extension API Variables1060970
-Node: Extension Versioning1061603
-Ref: gawk-api-version1062040
-Node: Extension API Informational Variables1063768
-Node: Extension API Boilerplate1064832
-Node: Changes from API V11068694
-Node: Finding Extensions1069354
-Node: Extension Example1069913
-Node: Internal File Description1070711
-Node: Internal File Ops1074791
-Ref: Internal File Ops-Footnote-11086191
-Node: Using Internal File Ops1086331
-Ref: Using Internal File Ops-Footnote-11088714
-Node: Extension Samples1088988
-Node: Extension Sample File Functions1090517
-Node: Extension Sample Fnmatch1098166
-Node: Extension Sample Fork1099653
-Node: Extension Sample Inplace1100871
-Node: Extension Sample Ord1104175
-Node: Extension Sample Readdir1105011
-Ref: table-readdir-file-types1105900
-Node: Extension Sample Revout1106705
-Node: Extension Sample Rev2way1107294
-Node: Extension Sample Read write array1108034
-Node: Extension Sample Readfile1109976
-Node: Extension Sample Time1111071
-Node: Extension Sample API Tests1112419
-Node: gawkextlib1112911
-Node: Extension summary1115358
-Node: Extension Exercises1119060
-Node: Language History1120558
-Node: V7/SVR3.11122214
-Node: SVR41124366
-Node: POSIX1125800
-Node: BTL1127179
-Node: POSIX/GNU1127908
-Node: Feature History1133800
-Node: Common Extensions1148224
-Node: Ranges and Locales1149507
-Ref: Ranges and Locales-Footnote-11154123
-Ref: Ranges and Locales-Footnote-21154150
-Ref: Ranges and Locales-Footnote-31154385
-Node: Contributors1154606
-Node: History summary1160166
-Node: Installation1161546
-Node: Gawk Distribution1162490
-Node: Getting1162974
-Node: Extracting1163935
-Node: Distribution contents1165573
-Node: Unix Installation1171915
-Node: Quick Installation1172597
-Node: Shell Startup Files1175011
-Node: Additional Configuration Options1176100
-Node: Configuration Philosophy1178089
-Node: Non-Unix Installation1180458
-Node: PC Installation1180918
-Node: PC Binary Installation1181756
-Node: PC Compiling1182191
-Node: PC Using1183308
-Node: Cygwin1186353
-Node: MSYS1187123
-Node: VMS Installation1187624
-Node: VMS Compilation1188415
-Ref: VMS Compilation-Footnote-11189644
-Node: VMS Dynamic Extensions1189702
-Node: VMS Installation Details1191387
-Node: VMS Running1193640
-Node: VMS GNV1197919
-Node: VMS Old Gawk1198654
-Node: Bugs1199125
-Node: Bug address1199788
-Node: Usenet1202185
-Node: Maintainers1202962
-Node: Other Versions1204338
-Node: Installation summary1210922
-Node: Notes1211957
-Node: Compatibility Mode1212822
-Node: Additions1213604
-Node: Accessing The Source1214529
-Node: Adding Code1215964
-Node: New Ports1222182
-Node: Derived Files1226670
-Ref: Derived Files-Footnote-11232155
-Ref: Derived Files-Footnote-21232190
-Ref: Derived Files-Footnote-31232788
-Node: Future Extensions1232902
-Node: Implementation Limitations1233560
-Node: Extension Design1234743
-Node: Old Extension Problems1235897
-Ref: Old Extension Problems-Footnote-11237415
-Node: Extension New Mechanism Goals1237472
-Ref: Extension New Mechanism Goals-Footnote-11240836
-Node: Extension Other Design Decisions1241025
-Node: Extension Future Growth1243138
-Node: Old Extension Mechanism1243974
-Node: Notes summary1245737
-Node: Basic Concepts1246919
-Node: Basic High Level1247600
-Ref: figure-general-flow1247882
-Ref: figure-process-flow1248567
-Ref: Basic High Level-Footnote-11251868
-Node: Basic Data Typing1252053
-Node: Glossary1255381
-Node: Copying1287328
-Node: GNU Free Documentation License1324867
-Node: Index1349985
+Node: Default Namespace915500
+Node: Changing The Namespace916241
+Node: Naming Rules917852
+Node: Internal Name Management919701
+Node: Namespace Example920743
+Node: Namespace And Features923305
+Node: Arbitrary Precision Arithmetic924714
+Node: Computer Arithmetic926201
+Ref: table-numeric-ranges929792
+Ref: Computer Arithmetic-Footnote-1930514
+Node: Math Definitions930571
+Ref: table-ieee-formats933885
+Ref: Math Definitions-Footnote-1934488
+Node: MPFR features934593
+Node: FP Math Caution936310
+Ref: FP Math Caution-Footnote-1937382
+Node: Inexactness of computations937751
+Node: Inexact representation938711
+Node: Comparing FP Values940071
+Node: Errors accumulate941153
+Node: Getting Accuracy942586
+Node: Try To Round945296
+Node: Setting precision946195
+Ref: table-predefined-precision-strings946892
+Node: Setting the rounding mode948722
+Ref: table-gawk-rounding-modes949096
+Ref: Setting the rounding mode-Footnote-1952504
+Node: Arbitrary Precision Integers952683
+Ref: Arbitrary Precision Integers-Footnote-1957588
+Node: Checking for MPFR957737
+Node: POSIX Floating Point Problems959034
+Ref: POSIX Floating Point Problems-Footnote-1962905
+Node: Floating point summary962943
+Node: Dynamic Extensions965133
+Node: Extension Intro966686
+Node: Plugin License967952
+Node: Extension Mechanism Outline968749
+Ref: figure-load-extension969188
+Ref: figure-register-new-function970753
+Ref: figure-call-new-function971845
+Node: Extension API Description973907
+Node: Extension API Functions Introduction975549
+Node: General Data Types980883
+Ref: General Data Types-Footnote-1988088
+Node: Memory Allocation Functions988387
+Ref: Memory Allocation Functions-Footnote-1991539
+Node: Constructor Functions991638
+Node: Registration Functions994637
+Node: Extension Functions995322
+Node: Exit Callback Functions1000535
+Node: Extension Version String1001785
+Node: Input Parsers1002448
+Node: Output Wrappers1015155
+Node: Two-way processors1019667
+Node: Printing Messages1021932
+Ref: Printing Messages-Footnote-11023103
+Node: Updating ERRNO1023256
+Node: Requesting Values1023995
+Ref: table-value-types-returned1024732
+Node: Accessing Parameters1025668
+Node: Symbol Table Access1026903
+Node: Symbol table by name1027415
+Ref: Symbol table by name-Footnote-11030305
+Node: Symbol table by cookie1030433
+Ref: Symbol table by cookie-Footnote-11034618
+Node: Cached values1034682
+Ref: Cached values-Footnote-11038218
+Node: Array Manipulation1038309
+Ref: Array Manipulation-Footnote-11039400
+Node: Array Data Types1039437
+Ref: Array Data Types-Footnote-11042095
+Node: Array Functions1042187
+Node: Flattening Arrays1046586
+Node: Creating Arrays1053527
+Node: Redirection API1058296
+Node: Extension API Variables1061138
+Node: Extension Versioning1061771
+Ref: gawk-api-version1062208
+Node: Extension API Informational Variables1063936
+Node: Extension API Boilerplate1065000
+Node: Changes from API V11068862
+Node: Finding Extensions1069522
+Node: Extension Example1070081
+Node: Internal File Description1070879
+Node: Internal File Ops1074959
+Ref: Internal File Ops-Footnote-11086359
+Node: Using Internal File Ops1086499
+Ref: Using Internal File Ops-Footnote-11088882
+Node: Extension Samples1089156
+Node: Extension Sample File Functions1090685
+Node: Extension Sample Fnmatch1098334
+Node: Extension Sample Fork1099821
+Node: Extension Sample Inplace1101039
+Node: Extension Sample Ord1104343
+Node: Extension Sample Readdir1105179
+Ref: table-readdir-file-types1106068
+Node: Extension Sample Revout1106873
+Node: Extension Sample Rev2way1107462
+Node: Extension Sample Read write array1108202
+Node: Extension Sample Readfile1110144
+Node: Extension Sample Time1111239
+Node: Extension Sample API Tests1112587
+Node: gawkextlib1113079
+Node: Extension summary1115526
+Node: Extension Exercises1119228
+Node: Language History1120726
+Node: V7/SVR3.11122382
+Node: SVR41124534
+Node: POSIX1125968
+Node: BTL1127347
+Node: POSIX/GNU1128076
+Node: Feature History1133968
+Node: Common Extensions1148392
+Node: Ranges and Locales1149675
+Ref: Ranges and Locales-Footnote-11154291
+Ref: Ranges and Locales-Footnote-21154318
+Ref: Ranges and Locales-Footnote-31154553
+Node: Contributors1154774
+Node: History summary1160334
+Node: Installation1161714
+Node: Gawk Distribution1162658
+Node: Getting1163142
+Node: Extracting1164103
+Node: Distribution contents1165741
+Node: Unix Installation1172083
+Node: Quick Installation1172765
+Node: Shell Startup Files1175179
+Node: Additional Configuration Options1176268
+Node: Configuration Philosophy1178257
+Node: Non-Unix Installation1180626
+Node: PC Installation1181086
+Node: PC Binary Installation1181924
+Node: PC Compiling1182359
+Node: PC Using1183476
+Node: Cygwin1186521
+Node: MSYS1187291
+Node: VMS Installation1187792
+Node: VMS Compilation1188583
+Ref: VMS Compilation-Footnote-11189812
+Node: VMS Dynamic Extensions1189870
+Node: VMS Installation Details1191555
+Node: VMS Running1193808
+Node: VMS GNV1198087
+Node: VMS Old Gawk1198822
+Node: Bugs1199293
+Node: Bug address1199956
+Node: Usenet1202353
+Node: Maintainers1203130
+Node: Other Versions1204506
+Node: Installation summary1211090
+Node: Notes1212125
+Node: Compatibility Mode1212990
+Node: Additions1213772
+Node: Accessing The Source1214697
+Node: Adding Code1216132
+Node: New Ports1222350
+Node: Derived Files1226838
+Ref: Derived Files-Footnote-11232323
+Ref: Derived Files-Footnote-21232358
+Ref: Derived Files-Footnote-31232956
+Node: Future Extensions1233070
+Node: Implementation Limitations1233728
+Node: Extension Design1234911
+Node: Old Extension Problems1236065
+Ref: Old Extension Problems-Footnote-11237583
+Node: Extension New Mechanism Goals1237640
+Ref: Extension New Mechanism Goals-Footnote-11241004
+Node: Extension Other Design Decisions1241193
+Node: Extension Future Growth1243306
+Node: Old Extension Mechanism1244142
+Node: Notes summary1245905
+Node: Basic Concepts1247087
+Node: Basic High Level1247768
+Ref: figure-general-flow1248050
+Ref: figure-process-flow1248735
+Ref: Basic High Level-Footnote-11252036
+Node: Basic Data Typing1252221
+Node: Glossary1255549
+Node: Copying1287496
+Node: GNU Free Documentation License1325035
+Node: Index1350153
 
 End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 5a6ffcc..141ca42 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -31237,6 +31237,8 @@ program being debugged, but occasionally it can.
 @node Namespaces
 @chapter Namespaces in @command{gawk}
 
address@hidden FIXME: Need to add indexing for this chapter
+
 This @value{CHAPTER} describes a feature that is specific to @command{gawk}.
 
 @menu
@@ -31280,7 +31282,7 @@ simple mechanism to put functions and global variables 
into separate namespaces.
 @section Qualified Names
 
 A @dfn{qualified name} is an identifier that includes a namespace name,
-the namespace separator @code{::}, and a component name.  For example, one
+the namespace separator @code{::}, and a @dfn{component} name.  For example, 
one
 might have a function named @code{posix::getpid()}.  Here, the namespace
 is @code{posix} and the function name within the namespace (the component)
 is @code{getpid()}.  The namespace and component names are separated by
@@ -31314,7 +31316,7 @@ It also keeps your code looking natural.
 @node Changing The Namespace
 @section Changing The Namespace
 
-In order to set the current namespace, use an @samp{@@namespace} directive
+In order to set the current namespace, use an @code{@@namespace} directive
 at the top level of your program:
 
 @example
@@ -31343,15 +31345,15 @@ an implicit @samp{@@namespace "awk"}.  Similarly, 
each chunk of
 command-line code supplied with @option{-e} has such an implicit
 initial statement (@pxref{Options}).
 
-Files included with @code{@@include} (@pxref{Include Files}) ``push'' and
-``pop'' the current namespace. That is, each @code{@@include} saves the
-current namespace and starts over with an implicit @samp{@@namespace
-"awk"} until an explicit @samp{@@namespace} statement is seen.
-When @command{gawk} finishes processing the included file, the saved
-namespace is restored and processing continues where it left off in the
-original file.
+Files included with @code{@@include} (@pxref{Include Files}) ``push''
+and ``pop'' the current namespace. That is, each @code{@@include} saves
+the current namespace and starts over with an implicit @samp{@@namespace
+"awk"} which remains in effect until an explicit @code{@@namespace}
+statement is seen.  When @command{gawk} finishes processing the included
+file, the saved namespace is restored and processing continues where it
+left off in the original file.
 
-The use of @samp{@@namespace} has no influence upon the order of execution
+The use of @code{@@namespace} has no influence upon the order of execution
 of @code{BEGIN}, @code{BEGINFILE}, @code{END}, and @code{ENDFILE} rules.
 
 @node Naming Rules
@@ -31548,7 +31550,8 @@ As you can see, this version also follows the 
convention mentioned in
 @ref{Library Names}, whereby global variable and function names
 start with a capital letter.
 
-Here is a simple test program:
+Here is a simple test program. Since it's in a separate file, unadorned
+identifiers are sought for in the @code{awk} namespace:
 
 @example
 BEGIN @{
@@ -31573,13 +31576,13 @@ $ @kbd{gawk -f ns_passwd.awk -f testpasswd.awk}
 @node Namespace And Features
 @section Namespaces and Other @command{gawk} Features
 
-This @value{SECTION} looks at how the namespace facility interacts
+This @value{SECTION} looks briefly at how the namespace facility interacts
 with other important @command{gawk} features.
 
 The profiler and pretty-printer (@pxref{Profiling}) have been enhanced
-to understand namespaces and the namespace naming rules described in
+to understand namespaces and the namespace naming rules presented in
 @ref{Naming Rules}.  In particular, the output groups functions in the same
-namespace together, and has @samp{@@namespace} directives in front
+namespace together, and has @code{@@namespace} directives in front
 of rules as necessary. This allows component names to be
 simple identifiers, instead of using qualified identifiers everywhere.
 
@@ -31589,12 +31592,12 @@ in order to accommodate namespaces, and the 
debugger's @code{dump} command
 was adjusted to match.
 
 The extension API (@pxref{Dynamic Extensions}) has always allowed for
-placing functions into a different namespace, although this was
-never implemented.  However, the symbol lookup and symbol update routines
-did not have provision for including a namespace. That has now been
-corrected. @xref{Extension Sample Inplace}, for a nice example of
-an extension that leverages a namespace used by cooperating @command{awk}
-and C code.
+placing functions into a different namespace, although this was not
+previously implemented.  However, the symbol lookup and symbol update
+routines did not have provision for including a namespace. That has now
+been corrected (@pxref{Symbol table by name}).
address@hidden Sample Inplace}, for a nice example of an extension that
+leverages a namespace shared by cooperating @command{awk} and C code.
 
 @node Arbitrary Precision Arithmetic
 @chapter Arithmetic and Arbitrary-Precision Arithmetic with @command{gawk}
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index fc1cd11..2e514f9 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -30251,6 +30251,8 @@ program being debugged, but occasionally it can.
 @node Namespaces
 @chapter Namespaces in @command{gawk}
 
address@hidden FIXME: Need to add indexing for this chapter
+
 This @value{CHAPTER} describes a feature that is specific to @command{gawk}.
 
 @menu
@@ -30294,7 +30296,7 @@ simple mechanism to put functions and global variables 
into separate namespaces.
 @section Qualified Names
 
 A @dfn{qualified name} is an identifier that includes a namespace name,
-the namespace separator @code{::}, and a component name.  For example, one
+the namespace separator @code{::}, and a @dfn{component} name.  For example, 
one
 might have a function named @code{posix::getpid()}.  Here, the namespace
 is @code{posix} and the function name within the namespace (the component)
 is @code{getpid()}.  The namespace and component names are separated by
@@ -30328,7 +30330,7 @@ It also keeps your code looking natural.
 @node Changing The Namespace
 @section Changing The Namespace
 
-In order to set the current namespace, use an @samp{@@namespace} directive
+In order to set the current namespace, use an @code{@@namespace} directive
 at the top level of your program:
 
 @example
@@ -30357,15 +30359,15 @@ an implicit @samp{@@namespace "awk"}.  Similarly, 
each chunk of
 command-line code supplied with @option{-e} has such an implicit
 initial statement (@pxref{Options}).
 
-Files included with @code{@@include} (@pxref{Include Files}) ``push'' and
-``pop'' the current namespace. That is, each @code{@@include} saves the
-current namespace and starts over with an implicit @samp{@@namespace
-"awk"} until an explicit @samp{@@namespace} statement is seen.
-When @command{gawk} finishes processing the included file, the saved
-namespace is restored and processing continues where it left off in the
-original file.
+Files included with @code{@@include} (@pxref{Include Files}) ``push''
+and ``pop'' the current namespace. That is, each @code{@@include} saves
+the current namespace and starts over with an implicit @samp{@@namespace
+"awk"} which remains in effect until an explicit @code{@@namespace}
+statement is seen.  When @command{gawk} finishes processing the included
+file, the saved namespace is restored and processing continues where it
+left off in the original file.
 
-The use of @samp{@@namespace} has no influence upon the order of execution
+The use of @code{@@namespace} has no influence upon the order of execution
 of @code{BEGIN}, @code{BEGINFILE}, @code{END}, and @code{ENDFILE} rules.
 
 @node Naming Rules
@@ -30562,7 +30564,8 @@ As you can see, this version also follows the 
convention mentioned in
 @ref{Library Names}, whereby global variable and function names
 start with a capital letter.
 
-Here is a simple test program:
+Here is a simple test program. Since it's in a separate file, unadorned
+identifiers are sought for in the @code{awk} namespace:
 
 @example
 BEGIN @{
@@ -30587,13 +30590,13 @@ $ @kbd{gawk -f ns_passwd.awk -f testpasswd.awk}
 @node Namespace And Features
 @section Namespaces and Other @command{gawk} Features
 
-This @value{SECTION} looks at how the namespace facility interacts
+This @value{SECTION} looks briefly at how the namespace facility interacts
 with other important @command{gawk} features.
 
 The profiler and pretty-printer (@pxref{Profiling}) have been enhanced
-to understand namespaces and the namespace naming rules described in
+to understand namespaces and the namespace naming rules presented in
 @ref{Naming Rules}.  In particular, the output groups functions in the same
-namespace together, and has @samp{@@namespace} directives in front
+namespace together, and has @code{@@namespace} directives in front
 of rules as necessary. This allows component names to be
 simple identifiers, instead of using qualified identifiers everywhere.
 
@@ -30603,12 +30606,12 @@ in order to accommodate namespaces, and the 
debugger's @code{dump} command
 was adjusted to match.
 
 The extension API (@pxref{Dynamic Extensions}) has always allowed for
-placing functions into a different namespace, although this was
-never implemented.  However, the symbol lookup and symbol update routines
-did not have provision for including a namespace. That has now been
-corrected. @xref{Extension Sample Inplace}, for a nice example of
-an extension that leverages a namespace used by cooperating @command{awk}
-and C code.
+placing functions into a different namespace, although this was not
+previously implemented.  However, the symbol lookup and symbol update
+routines did not have provision for including a namespace. That has now
+been corrected (@pxref{Symbol table by name}).
address@hidden Sample Inplace}, for a nice example of an extension that
+leverages a namespace shared by cooperating @command{awk} and C code.
 
 @node Arbitrary Precision Arithmetic
 @chapter Arithmetic and Arbitrary-Precision Arithmetic with @command{gawk}

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=a2fc2b8fe26ea240b9ce520be5101e85c329e2f9

commit a2fc2b8fe26ea240b9ce520be5101e85c329e2f9
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Jul 26 20:53:49 2017 +0300

    Improvements in indirect function call handling with namespaces, more tests.

diff --git a/ChangeLog b/ChangeLog
index ff2c31f..ac038e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2017-07-26         Arnold D. Robbins     <address@hidden>
 
+       * awk.h (validate_qualified_name): Return type back to bool.
+       * awkgram.y (validate_qualified_name): Return type back to bool.
+       (lookup_builtin): Make allowances for `awk::' prefix on name.
+       * interpret.h (r_interpret): For indirect call, always pass true
+       for do_qualify argument of lookup.
+       * main.c (main): Make note of errors in -v values, use this
+       to exit failure if any happen.  Only change current_namespace
+       to 'awk::' if doing pretty printing.
+       (arg_assign): If validate_qualified name returns false, error out.
+
+2017-07-26         Arnold D. Robbins     <address@hidden>
+
        * awkgram.y (set_namespace): Change return type void, adjust
        all return statements.
        address@hidden: Don't YYABORT on bad namespace so that we can check
diff --git a/awk.h b/awk.h
index 44d72c3..7c80117 100644
--- a/awk.h
+++ b/awk.h
@@ -1430,7 +1430,7 @@ extern bool is_alnum(int c);
 extern bool is_letter(int c);
 extern bool is_identchar(int c);
 extern NODE *make_regnode(int type, NODE *exp);
-extern void validate_qualified_name(char *token);
+extern bool validate_qualified_name(char *token);
 extern int check_qualified_name(char *token);
 /* builtin.c */
 extern double double_to_int(double d);
diff --git a/awkgram.c b/awkgram.c
index 77119b0..f45f700 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -6632,7 +6632,7 @@ retry:
        tokadd('\0');
        pushback();
 
-       validate_qualified_name(tokstart);
+       (void) validate_qualified_name(tokstart);
 
        /* See if it is a special token. */
        if ((mid = check_qualified_name(tokstart)) >= 0) {
@@ -8736,6 +8736,9 @@ one_line_close(int fd)
 builtin_func_t
 lookup_builtin(const char *name)
 {
+       if (strncmp(name, "awk::", 5) == 0)
+               name += 5;
+
        int mid = check_special(name);
 
        if (mid == -1)
@@ -8887,38 +8890,40 @@ set_profile_text(NODE *n, const char *str, size_t len)
  * conflicting / confusing error messages.
  */
 
-void
+bool
 validate_qualified_name(char *token)
 {
        char *cp, *cp2;
 
        // no colon, by definition it's well formed
        if ((cp = strchr(token, ':')) == NULL)
-               return;
+               return true;
 
        if (do_traditional || do_posix) {
                error_ln(sourceline, _("identifier %s: qualified names not 
allowed in traditional / POSIX mode"), token);
-               return;
+               return false;
        }
 
        if (cp[1] != ':') {     // could happen from command line
                error_ln(sourceline, _("identifier %s: namespace separator is 
two colons, not one"), token);
-               return;
+               return false;
        }
 
        if (! is_letter(cp[2])) {
                error_ln(sourceline,
                                _("qualified identifier `%s' is badly formed"),
                                token);
-               return;
+               return false;
        }
 
        if ((cp2 = strchr(cp+2, ':')) != NULL) {
                error_ln(sourceline,
                        _("identifier `%s': namespace separator can only appear 
once in a qualified name"),
                        token);
-               return;
+               return false;
        }
+
+       return true;
 }
 
 /* check_qualified_name --- decide if a name is special or not */
diff --git a/awkgram.y b/awkgram.y
index 90249e2..8cb3edb 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -4198,7 +4198,7 @@ retry:
        tokadd('\0');
        pushback();
 
-       validate_qualified_name(tokstart);
+       (void) validate_qualified_name(tokstart);
 
        /* See if it is a special token. */
        if ((mid = check_qualified_name(tokstart)) >= 0) {
@@ -6302,6 +6302,9 @@ one_line_close(int fd)
 builtin_func_t
 lookup_builtin(const char *name)
 {
+       if (strncmp(name, "awk::", 5) == 0)
+               name += 5;
+
        int mid = check_special(name);
 
        if (mid == -1)
@@ -6453,38 +6456,40 @@ set_profile_text(NODE *n, const char *str, size_t len)
  * conflicting / confusing error messages.
  */
 
-void
+bool
 validate_qualified_name(char *token)
 {
        char *cp, *cp2;
 
        // no colon, by definition it's well formed
        if ((cp = strchr(token, ':')) == NULL)
-               return;
+               return true;
 
        if (do_traditional || do_posix) {
                error_ln(sourceline, _("identifier %s: qualified names not 
allowed in traditional / POSIX mode"), token);
-               return;
+               return false;
        }
 
        if (cp[1] != ':') {     // could happen from command line
                error_ln(sourceline, _("identifier %s: namespace separator is 
two colons, not one"), token);
-               return;
+               return false;
        }
 
        if (! is_letter(cp[2])) {
                error_ln(sourceline,
                                _("qualified identifier `%s' is badly formed"),
                                token);
-               return;
+               return false;
        }
 
        if ((cp2 = strchr(cp+2, ':')) != NULL) {
                error_ln(sourceline,
                        _("identifier `%s': namespace separator can only appear 
once in a qualified name"),
                        token);
-               return;
+               return false;
        }
+
+       return true;
 }
 
 /* check_qualified_name --- decide if a name is special or not */
diff --git a/interpret.h b/interpret.h
index 391715b..2edce6b 100644
--- a/interpret.h
+++ b/interpret.h
@@ -1076,8 +1076,7 @@ match_re:
                                        ni = setup_frame(pc);
                                        JUMPTO(ni);     /* Op_func */
                                }
-                               bool do_qualify = (strchr(t1->stptr, ':') == 
NULL);
-                               f = lookup(t1->stptr, do_qualify);
+                               f = lookup(t1->stptr, true);
                        }
 
                        if (f == NULL) {
diff --git a/main.c b/main.c
index 16b8212..e380408 100644
--- a/main.c
+++ b/main.c
@@ -389,9 +389,10 @@ main(int argc, char **argv)
        init_fields();
 
        /* Now process the pre-assignments */
+       int dash_v_errs = 0;    // bad stuff for -v
        for (i = 0; i <= numassigns; i++) {
                if (preassigns[i].type == PRE_ASSIGN)
-                       (void) arg_assign(preassigns[i].val, true);
+                       dash_v_errs += (arg_assign(preassigns[i].val, true) == 
false);
                else    /* PRE_ASSIGN_FS */
                        cmdline_fs(preassigns[i].val);
                efree(preassigns[i].val);
@@ -455,7 +456,7 @@ main(int argc, char **argv)
        setlocale(LC_NUMERIC, "C");
 #endif
        /* Read in the program */
-       if (parse_program(& code_block) != 0)
+       if (parse_program(& code_block) != 0 || dash_v_errs > 0)
                exit(EXIT_FAILURE);
 
        if (do_intl)
@@ -463,7 +464,7 @@ main(int argc, char **argv)
 
        if (current_namespace != awk_namespace) {
                efree((char *) current_namespace);
-               current_namespace = "awk::";    // for pretty printer
+               current_namespace = awk_namespace;
        }
 
        install_builtins();
@@ -510,6 +511,7 @@ main(int argc, char **argv)
                interpret(code_block);
 
        if (do_pretty_print) {
+               current_namespace = "awk::";    // for pretty printer
                dump_prog(code_block);
                dump_funcs();
        }
@@ -1148,7 +1150,10 @@ arg_assign(char *arg, bool initing)
                        lintwarn(_("`%s' is not a variable name, looking for 
file `%s=%s'"),
                                arg, arg, cp);
        } else {
-               validate_qualified_name(arg);
+               if (! validate_qualified_name(arg)) {
+                       badvar = true;
+                       goto done;
+               }
 
                if (check_qualified_name(arg) >= 0)
                        fatal(_("cannot use gawk builtin `%s' as variable 
name"), arg);
@@ -1199,6 +1204,7 @@ arg_assign(char *arg, bool initing)
                        var->var_assign();
        }
 
+done:
        if (! initing)
                *--cp = '=';    /* restore original text of ARGV */
        FNR = save_FNR;
diff --git a/test/ChangeLog b/test/ChangeLog
index 41b5c92..e9ce5dc 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,5 +1,11 @@
 2017-07-26         Arnold D. Robbins     <address@hidden>
 
+       * Makefile.am (nsbad_cmd, nsindirect1, nsindirect2): New tests.
+       * nsbad_cmd.ok, nsindirect1.awk, nsindirect1.ok, nsindirect2.awk,
+       nsindirect2.ok: New files.
+
+2017-07-26         Arnold D. Robbins     <address@hidden>
+
        * Makefile.am (nsbad): New test.
        * nsbad.awk, nsbad.ok: New files.
 
diff --git a/test/Makefile.am b/test/Makefile.am
index f6e0b6b..db98798 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -742,6 +742,11 @@ EXTRA_DIST = \
        nors.ok \
        nsbad.awk \
        nsbad.ok \
+       nsbad_cmd.ok \
+       nsindirect1.awk \
+       nsindirect1.ok \
+       nsindirect2.awk \
+       nsindirect2.ok \
        nsprof1.awk \
        nsprof1.ok \
        nsprof2.awk \
@@ -1267,7 +1272,7 @@ GAWK_EXT_TESTS = \
        muldimposix \
        nastyparm negtime next nondec nondec2 \
        nonfatal1 nonfatal2 nonfatal3 \
-       nsbad nsprof1 nsprof2 \
+       nsbad nsbad_cmd nsindirect1 nsindirect2 nsprof1 nsprof2 \
        patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge 
procinfs \
        profile0 profile1 profile2 profile3 profile4 profile5 profile6 profile7 
\
        profile8 profile9 profile10 pty1 \
@@ -2446,6 +2451,11 @@ eofsrc1:
        @AWKPATH="$(srcdir)" $(AWK) -f "$(srcdir)"/address@hidden -f 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+nsbad_cmd:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -v foo:bar=3 -v foo:::blat=4 1 /dev/null 
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 # Targets generated for other tests:
 include Maketests
 
diff --git a/test/Makefile.in b/test/Makefile.in
index a6ff60c..96c3dcd 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1000,6 +1000,11 @@ EXTRA_DIST = \
        nors.ok \
        nsbad.awk \
        nsbad.ok \
+       nsbad_cmd.ok \
+       nsindirect1.awk \
+       nsindirect1.ok \
+       nsindirect2.awk \
+       nsindirect2.ok \
        nsprof1.awk \
        nsprof1.ok \
        nsprof2.awk \
@@ -1524,7 +1529,7 @@ GAWK_EXT_TESTS = \
        muldimposix \
        nastyparm negtime next nondec nondec2 \
        nonfatal1 nonfatal2 nonfatal3 \
-       nsbad nsprof1 nsprof2 \
+       nsbad nsbad_cmd nsindirect1 nsindirect2 nsprof1 nsprof2 \
        patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge 
procinfs \
        profile0 profile1 profile2 profile3 profile4 profile5 profile6 profile7 
\
        profile8 profile9 profile10 pty1 \
@@ -2883,6 +2888,11 @@ eofsrc1:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f "$(srcdir)"/address@hidden -f 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+nsbad_cmd:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -v foo:bar=3 -v foo:::blat=4 1 /dev/null 
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 Gt-dummy:
 # file Maketests, generated from Makefile.am by the Gentests program
 addcomma:
@@ -4282,6 +4292,16 @@ nsbad:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+nsindirect1:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+nsindirect2:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 patsplit:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 87c811b..c676f7e 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1397,6 +1397,16 @@ nsbad:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+nsindirect1:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+nsindirect2:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 patsplit:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
diff --git a/test/nsbad_cmd.ok b/test/nsbad_cmd.ok
new file mode 100644
index 0000000..cbca6ea
--- /dev/null
+++ b/test/nsbad_cmd.ok
@@ -0,0 +1,3 @@
+gawk: error: identifier foo:bar: namespace separator is two colons, not one
+gawk: error: qualified identifier `foo:::blat' is badly formed
+EXIT CODE: 1
diff --git a/test/nsindirect1.awk b/test/nsindirect1.awk
new file mode 100644
index 0000000..d04863f
--- /dev/null
+++ b/test/nsindirect1.awk
@@ -0,0 +1,13 @@
address@hidden "test"
+
+BEGIN {
+       bar = 3
+}
+
address@hidden "awk"
+
+BEGIN {
+       print "before change, direct =", test::bar, "indirect =", 
SYMTAB["test::bar"]
+       SYMTAB["test::bar"] = 4
+       print "after change, direct =", test::bar, "indirect =", 
SYMTAB["test::bar"]
+}
diff --git a/test/nsindirect1.ok b/test/nsindirect1.ok
new file mode 100644
index 0000000..ab2e31b
--- /dev/null
+++ b/test/nsindirect1.ok
@@ -0,0 +1,2 @@
+before change, direct = 3 indirect = 3
+after change, direct = 4 indirect = 4
diff --git a/test/nsindirect2.awk b/test/nsindirect2.awk
new file mode 100644
index 0000000..8017e8f
--- /dev/null
+++ b/test/nsindirect2.awk
@@ -0,0 +1,44 @@
+BEGIN {
+       stftime::gensub = 3     # should be OK, not related to indirect calls
+}
+
+
+BEGIN { base_time = systime() }        # in awk namespace
+
address@hidden "testing"
+
+function strftime(mesg)
+{
+       printf("strftime(%s) - this is not the function you are looking for\n",
+               mesg)
+       return 0
+}
+
+BEGIN {
+       strftime("from 'testing'")
+       gensub = "gensub"
+       print "gensub =", gensub
+}
+
+function systime()
+{
+       return awk::base_time
+}
+
+BEGIN {
+       st = "systime"
+       now[1] = @st()
+
+       st = "awk::systime"
+       now[2] = @st()
+
+       st = "testing::systime"
+       now[3] = @st()
+
+       for (i = 1; i <= 3; i++) {
+               if (now[i] == awk::base_time || now[i] == awk::base_time + 1)
+                       printf "iteration %d, got good result from systime\n", i
+               else
+                       printf "iteration %d, got bad result from systime, now 
%d, base_time %d\n", i, now, awk::base_time
+       }
+}
diff --git a/test/nsindirect2.ok b/test/nsindirect2.ok
new file mode 100644
index 0000000..9b71cd9
--- /dev/null
+++ b/test/nsindirect2.ok
@@ -0,0 +1,5 @@
+strftime() - this is not the function you are looking for
+gensub = gensub
+iteration 1, got good result from systime
+iteration 2, got good result from systime
+iteration 3, got good result from systime

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog            |  12 ++
 awk.h                |   2 +-
 awkgram.c            |  19 ++-
 awkgram.y            |  19 ++-
 doc/ChangeLog        |   4 +
 doc/gawk.info        | 398 ++++++++++++++++++++++++++-------------------------
 doc/gawk.texi        |  43 +++---
 doc/gawktexi.in      |  43 +++---
 interpret.h          |   3 +-
 main.c               |  14 +-
 test/ChangeLog       |   6 +
 test/Makefile.am     |  12 +-
 test/Makefile.in     |  22 ++-
 test/Maketests       |  10 ++
 test/nsbad_cmd.ok    |   3 +
 test/nsindirect1.awk |  13 ++
 test/nsindirect1.ok  |   2 +
 test/nsindirect2.awk |  44 ++++++
 test/nsindirect2.ok  |   5 +
 19 files changed, 413 insertions(+), 261 deletions(-)
 create mode 100644 test/nsbad_cmd.ok
 create mode 100644 test/nsindirect1.awk
 create mode 100644 test/nsindirect1.ok
 create mode 100644 test/nsindirect2.awk
 create mode 100644 test/nsindirect2.ok


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]