gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4033-gcc6c57a


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4033-gcc6c57a
Date: Wed, 15 Jul 2020 13:28:58 -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, gawk-5.1-stable has been updated
       via  cc6c57ad36d1eb12cd6fac15c3b43e4b6f2ae46e (commit)
      from  d10a27cb61fbbbe09490e46f379411a4a90b74f8 (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=cc6c57ad36d1eb12cd6fac15c3b43e4b6f2ae46e

commit cc6c57ad36d1eb12cd6fac15c3b43e4b6f2ae46e
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Jul 15 20:28:41 2020 +0300

    Finish up MPFR valgrind issues.

diff --git a/ChangeLog b/ChangeLog
index fab7fef..ea2e040 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2020-07-15         Arnold D. Robbins     <arnold@skeeve.com>
+
+       Finish cleaning up MPFR valgrind issues.
+
+       * awk.h (struct block_header): Remove MPFR and GMP enums.
+       * gawkapi.c (getmpfr, freempfr, getmpz, freempz): Removed
+       (api_get_mpfr): Use emalloc instead of getmpfr.
+       (api_get_mpz): Use emalloc instead of getmpz.
+       * gawkapi.h: Add comments on MPFR and MPZ
+       (make_number_mpfr, make_number_mpz): Update comments.
+       * node.c (nextfree): Remove mpfr and mpz entries.
+       * NEWS: Updated.
+
 2020-07-13         Arnold D. Robbins     <arnold@skeeve.com>
 
        * mpfr.c (mpg_interpret): Small speedup. If do_itrace and opcode is
diff --git a/NEWS b/NEWS
index 87f5b9e..4de4ec2 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,10 @@ Changes from 5.0.1 to 5.0.2
 4. A number of subtle bugs relating to MPFR mode that caused differences
    between regular operation and MPFR mode have been fixed.
 
+5. The API now handles MPFR/GMP values slightly differently, requiring
+   different memory management for those values. See the manual for the
+   details if you have an extension using those values.
+
 Changes from 5.0.1 to 5.1.0
 ---------------------------
 
diff --git a/awk.h b/awk.h
index 4ff1141..ed6a6ee 100644
--- a/awk.h
+++ b/awk.h
@@ -1074,8 +1074,6 @@ struct block_header {
 enum block_id {
        BLOCK_NODE = 0,
        BLOCK_BUCKET,
-       BLOCK_MPFR,
-       BLOCK_MPZ,
        BLOCK_MAX       /* count */
 };
 
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 47f57ee..e79b297 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2020-07-15         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * gawktexi.in: Document how to handle MPFR and GMP values
+       from an extension function.
+
 2020-07-13         Arnold D. Robbins     <arnold@skeeve.com>
 
        * gawktexi.in (General Data Types): Document that MPFR
diff --git a/doc/gawk.info b/doc/gawk.info
index 3b65140..5b731a6 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -562,6 +562,7 @@ in (a) below.  A copy of the license is included in the 
section entitled
 * Extension API Functions Introduction:: Introduction to the API functions.
 * General Data Types::                  The data types.
 * Memory Allocation Functions::         Functions for allocating memory.
+* API Ownership of MPFR and GMP Values:: Managing MPFR and GMP Values.
 * Constructor Functions::               Functions for creating values.
 * Registration Functions::              Functions to register things with
                                         'gawk'.
@@ -24628,6 +24629,7 @@ API in detail.
 * General Data Types::                   The data types.
 * Memory Allocation Functions::          Functions for allocating memory.
 * Constructor Functions::                Functions for creating values.
+* API Ownership of MPFR and GMP Values:: Managing MPFR and GMP Values.
 * Registration Functions::               Functions to register things with
                                          'gawk'.
 * Printing Messages::                    Functions for printing messages.
@@ -24738,10 +24740,17 @@ operations:
      and include a 'config.h' file in your extensions.
 
    * All pointers filled in by 'gawk' point to memory managed by 'gawk'
-     and should be treated by the extension as read-only.  Memory for
-     _all_ strings passed into 'gawk' from the extension _must_ come
-     from calling one of 'gawk_malloc()', 'gawk_calloc()', or
-     'gawk_realloc()', and is managed by 'gawk' from then on.
+     and should be treated by the extension as read-only.
+
+     Memory for _all_ strings passed into 'gawk' from the extension
+     _must_ come from calling one of 'gawk_malloc()', 'gawk_calloc()',
+     or 'gawk_realloc()', and is managed by 'gawk' from then on.
+
+     Memory for MPFR/GMP values that come from 'gawk' should also be
+     treated as read-only.  However, unlike strings, memory for MPFR/GMP
+     values allocated by an extension and passed into 'gawk' is _copied_
+     by 'gawk'; the extension should then free the values itself to
+     avoid memory leaks.  This is discussed further in *FIXME*.
 
    * The API defines several simple 'struct's that map values as seen
      from 'awk'.  A value can be a 'double', a string, or an array (as
@@ -24896,7 +24905,7 @@ use them.
      integer (type 'mpz_ptr'), or an MPFR floating-point value (type
      'mpfr_ptr_t'), and cast it appropriately.
 
-          CAUTION:: Any MPFR or MPZ values that you create and pass to
+          CAUTION: Any MPFR or MPZ values that you create and pass to
           'gawk' to save are _copied_.  This means you are responsible
           to release the storage once you're done with it.  See the
           sample 'intdiv' extension for some example code.
@@ -25094,7 +25103,7 @@ correct types.
 Unix-like systems as well.
 
 
-File: gawk.info,  Node: Constructor Functions,  Next: Registration Functions,  
Prev: Memory Allocation Functions,  Up: Extension API Description
+File: gawk.info,  Node: Constructor Functions,  Next: API Ownership of MPFR 
and GMP Values,  Prev: Memory Allocation Functions,  Up: Extension API 
Description
 
 17.4.4 Constructor Functions
 ----------------------------
@@ -25135,13 +25144,12 @@ code would use them:
 'make_number_mpz(void *mpz, awk_value_t *result);'
      This function creates a GMP number value in 'result'.  The 'mpz'
      must be from a call to 'get_mpz_ptr()' (and thus be of real
-     underlying type 'mpz_ptr').  'gawk' takes ownership of this memory.
+     underlying type 'mpz_ptr').
 
 'static inline awk_value_t *'
 'make_number_mpfr(void *mpfr, awk_value_t *result);'
      This function creates an MPFR number value in 'result'.  The 'mpfr'
-     must be from a call to 'get_mpfr_ptr()'.  (and thus be of real
-     underlying type 'mpfr_ptr') 'gawk' takes ownership of this memory.
+     must be from a call to 'get_mpfr_ptr()'.
 
 'static inline awk_value_t *'
 'make_const_user_input(const char *string, size_t length, awk_value_t 
*result);'
@@ -25169,9 +25177,48 @@ code would use them:
      'gawk_malloc()', 'gawk_calloc()', or 'gawk_realloc()'.
 
 
-File: gawk.info,  Node: Registration Functions,  Next: Printing Messages,  
Prev: Constructor Functions,  Up: Extension API Description
+File: gawk.info,  Node: API Ownership of MPFR and GMP Values,  Next: 
Registration Functions,  Prev: Constructor Functions,  Up: Extension API 
Description
+
+17.4.5 Managing MPFR and GMP Values
+-----------------------------------
+
+MPFR and GMP values are different from string values, where you can
+"take ownership" of the value simply by assigning pointers.  For
+example:
+
+     char *p = gawk_malloc(42);      p "owns" the memory
+     char *q = p;
+     p = NULL;                       now q "owns" it
+
+   MPFR and GMP objects are indeed allocated on the stack or
+dynamically, but the MPFR and GMP libraries treat these objects as
+values, the same way that you would pass an 'int' or a 'double' by
+value.  There is no way to "transfer ownership" of MPFR and GMP objects.
+Thus, code in an extension should look like this:
+
+     part1 = get_mpz_ptr();                  have gawk allocate a GMP value
+     part2 = get_mpz_ptr();
+     answer = get_mpz_ptr();
+
+     mpz_set_si(part1, 21);                  do some computations
+     mpz_set_si(part2, 21);
+     mpz_add(answer, part1, part2);
+     ...
+     // assume that result is a parameter of type (awk_value_t *).
+     make_number_mpz(answer, & result);      set it with final GMP value
 
-17.4.5 Registration Functions
+     mpz_clear(part1);                       release intermediate values
+     gawk_free(part1);                       and free memory
+
+     mpz_clear(part2);
+     gawk_free(part2);
+
+     return result;
+
+
+File: gawk.info,  Node: Registration Functions,  Next: Printing Messages,  
Prev: API Ownership of MPFR and GMP Values,  Up: Extension API Description
+
+17.4.6 Registration Functions
 -----------------------------
 
 This minor node describes the API functions for registering parts of
@@ -25189,7 +25236,7 @@ your extension with 'gawk'.
 
 File: gawk.info,  Node: Extension Functions,  Next: Exit Callback Functions,  
Up: Registration Functions
 
-17.4.5.1 Registering An Extension Function
+17.4.6.1 Registering An Extension Function
 ..........................................
 
 Extension functions are described by the following record:
@@ -25304,7 +25351,7 @@ A minimum number of arguments is required, and no more 
than a maximum is allowed
 
 File: gawk.info,  Node: Exit Callback Functions,  Next: Extension Version 
String,  Prev: Extension Functions,  Up: Registration Functions
 
-17.4.5.2 Registering An Exit Callback Function
+17.4.6.2 Registering An Exit Callback Function
 ..............................................
 
 An "exit callback" function is a function that 'gawk' calls before it
@@ -25334,7 +25381,7 @@ order--that is, in the reverse order in which they are 
registered with
 
 File: gawk.info,  Node: Extension Version String,  Next: Input Parsers,  Prev: 
Exit Callback Functions,  Up: Registration Functions
 
-17.4.5.3 Registering An Extension Version String
+17.4.6.3 Registering An Extension Version String
 ................................................
 
 You can register a version string that indicates the name and version of
@@ -25351,7 +25398,7 @@ invoked with the '--version' option.
 
 File: gawk.info,  Node: Input Parsers,  Next: Output Wrappers,  Prev: 
Extension Version String,  Up: Registration Functions
 
-17.4.5.4 Customized Input Parsers
+17.4.6.4 Customized Input Parsers
 .................................
 
 By default, 'gawk' reads text files as its input.  It uses the value of
@@ -25629,7 +25676,7 @@ example.
 
 File: gawk.info,  Node: Output Wrappers,  Next: Two-way processors,  Prev: 
Input Parsers,  Up: Registration Functions
 
-17.4.5.5 Customized Output Wrappers
+17.4.6.5 Customized Output Wrappers
 ...................................
 
 An "output wrapper" is the mirror image of an input parser.  It allows
@@ -25735,7 +25782,7 @@ just use normally.
 
 File: gawk.info,  Node: Two-way processors,  Prev: Output Wrappers,  Up: 
Registration Functions
 
-17.4.5.6 Customized Two-way Processors
+17.4.6.6 Customized Two-way Processors
 ......................................
 
 A "two-way processor" combines an input parser and an output wrapper for
@@ -25789,7 +25836,7 @@ and 'XXX_take_control_of()'.
 
 File: gawk.info,  Node: Printing Messages,  Next: Updating ERRNO,  Prev: 
Registration Functions,  Up: Extension API Description
 
-17.4.6 Printing Messages
+17.4.7 Printing Messages
 ------------------------
 
 You can print different kinds of warning messages from your extension,
@@ -25823,7 +25870,7 @@ the pity.
 
 File: gawk.info,  Node: Updating ERRNO,  Next: Requesting Values,  Prev: 
Printing Messages,  Up: Extension API Description
 
-17.4.7 Updating 'ERRNO'
+17.4.8 Updating 'ERRNO'
 -----------------------
 
 The following functions allow you to update the 'ERRNO' variable:
@@ -25844,7 +25891,7 @@ The following functions allow you to update the 'ERRNO' 
variable:
 
 File: gawk.info,  Node: Requesting Values,  Next: Accessing Parameters,  Prev: 
Updating ERRNO,  Up: Extension API Description
 
-17.4.8 Requesting Values
+17.4.9 Requesting Values
 ------------------------
 
 All of the functions that return values from 'gawk' work in the same
@@ -25875,8 +25922,8 @@ Table 17.2: API value types returned
 
 File: gawk.info,  Node: Accessing Parameters,  Next: Symbol Table Access,  
Prev: Requesting Values,  Up: Extension API Description
 
-17.4.9 Accessing and Updating Parameters
-----------------------------------------
+17.4.10 Accessing and Updating Parameters
+-----------------------------------------
 
 Two functions give you access to the arguments (parameters) passed to
 your extension function.  They are:
@@ -25901,7 +25948,7 @@ your extension function.  They are:
 
 File: gawk.info,  Node: Symbol Table Access,  Next: Array Manipulation,  Prev: 
Accessing Parameters,  Up: Extension API Description
 
-17.4.10 Symbol Table Access
+17.4.11 Symbol Table Access
 ---------------------------
 
 Two sets of routines provide access to global variables, and one set
@@ -25916,7 +25963,7 @@ allows you to create and release cached values.
 
 File: gawk.info,  Node: Symbol table by name,  Next: Symbol table by cookie,  
Up: Symbol Table Access
 
-17.4.10.1 Variable Access and Update by Name
+17.4.11.1 Variable Access and Update by Name
 ............................................
 
 The following routines provide the ability to access and update global
@@ -25980,7 +26027,7 @@ been too confusing to document, and to code and test.
 
 File: gawk.info,  Node: Symbol table by cookie,  Next: Cached values,  Prev: 
Symbol table by name,  Up: Symbol Table Access
 
-17.4.10.2 Variable Access and Update by Cookie
+17.4.11.2 Variable Access and Update by Cookie
 ..............................................
 
 A "scalar cookie" is an opaque handle that provides access to a global
@@ -26094,7 +26141,7 @@ like this:
 
 File: gawk.info,  Node: Cached values,  Prev: Symbol table by cookie,  Up: 
Symbol Table Access
 
-17.4.10.3 Creating and Using Cached Values
+17.4.11.3 Creating and Using Cached Values
 ..........................................
 
 The routines in this minor node allow you to create and release cached
@@ -26192,7 +26239,7 @@ memory.
 
 File: gawk.info,  Node: Array Manipulation,  Next: Redirection API,  Prev: 
Symbol Table Access,  Up: Extension API Description
 
-17.4.11 Array Manipulation
+17.4.12 Array Manipulation
 --------------------------
 
 The primary data structure(1) in 'awk' is the associative array (*note
@@ -26219,7 +26266,7 @@ arrays of arrays (*note General Data Types::).
 
 File: gawk.info,  Node: Array Data Types,  Next: Array Functions,  Up: Array 
Manipulation
 
-17.4.11.1 Array Data Types
+17.4.12.1 Array Data Types
 ..........................
 
 The data types associated with arrays are as follows:
@@ -26286,7 +26333,7 @@ overuse this term.
 
 File: gawk.info,  Node: Array Functions,  Next: Flattening Arrays,  Prev: 
Array Data Types,  Up: Array Manipulation
 
-17.4.11.2 Array Functions
+17.4.12.2 Array Functions
 .........................
 
 The following functions relate to individual array elements:
@@ -26376,7 +26423,7 @@ The following functions relate to individual array 
elements:
 
 File: gawk.info,  Node: Flattening Arrays,  Next: Creating Arrays,  Prev: 
Array Functions,  Up: Array Manipulation
 
-17.4.11.3 Working With All The Elements of an Array
+17.4.12.3 Working With All The Elements of an Array
 ...................................................
 
 To "flatten" an array is to create a structure that represents the full
@@ -26550,7 +26597,7 @@ return value to success, and returns:
 
 File: gawk.info,  Node: Creating Arrays,  Prev: Flattening Arrays,  Up: Array 
Manipulation
 
-17.4.11.4 How To Create and Populate Arrays
+17.4.12.4 How To Create and Populate Arrays
 ...........................................
 
 Besides working with arrays created by 'awk' code, you can create arrays
@@ -26689,7 +26736,7 @@ environment variable.)
 
 File: gawk.info,  Node: Redirection API,  Next: Extension API Variables,  
Prev: Array Manipulation,  Up: Extension API Description
 
-17.4.12 Accessing and Manipulating Redirections
+17.4.13 Accessing and Manipulating Redirections
 -----------------------------------------------
 
 The following function allows extensions to access and manipulate
@@ -26759,7 +26806,7 @@ I/O multiplexing and a socket library.
 
 File: gawk.info,  Node: Extension API Variables,  Next: Extension API 
Boilerplate,  Prev: Redirection API,  Up: Extension API Description
 
-17.4.13 API Variables
+17.4.14 API Variables
 ---------------------
 
 The API provides two sets of variables.  The first provides information
@@ -26777,7 +26824,7 @@ information about how 'gawk' was invoked.
 
 File: gawk.info,  Node: Extension Versioning,  Next: Extension GMP/MPFR 
Versioning,  Up: Extension API Variables
 
-17.4.13.1 API Version Constants and Variables
+17.4.14.1 API Version Constants and Variables
 .............................................
 
 The API provides both a "major" and a "minor" version number.  The API
@@ -26829,7 +26876,7 @@ Boilerplate::).
 
 File: gawk.info,  Node: Extension GMP/MPFR Versioning,  Next: Extension API 
Informational Variables,  Prev: Extension Versioning,  Up: Extension API 
Variables
 
-17.4.13.2 GMP and MPFR Version Information
+17.4.14.2 GMP and MPFR Version Information
 ..........................................
 
 The API also includes information about the versions of GMP and MPFR
@@ -26871,7 +26918,7 @@ match those of 'gawk' with the following macro:
 
 File: gawk.info,  Node: Extension API Informational Variables,  Prev: 
Extension GMP/MPFR Versioning,  Up: Extension API Variables
 
-17.4.13.3 Informational Variables
+17.4.14.3 Informational Variables
 .................................
 
 The API provides access to several variables that describe whether the
@@ -26906,7 +26953,7 @@ change during execution.
 
 File: gawk.info,  Node: Extension API Boilerplate,  Next: Changes from API V1, 
 Prev: Extension API Variables,  Up: Extension API Description
 
-17.4.14 Boilerplate Code
+17.4.15 Boilerplate Code
 ------------------------
 
 As mentioned earlier (*note Extension Mechanism Outline::), the function
@@ -27010,7 +27057,7 @@ does the following:
 
 File: gawk.info,  Node: Changes from API V1,  Prev: Extension API Boilerplate, 
 Up: Extension API Description
 
-17.4.15 Changes From Version 1 of the API
+17.4.16 Changes From Version 1 of the API
 -----------------------------------------
 
 The current API is _not_ binary compatible with version 1 of the API.
@@ -34255,6 +34302,8 @@ Index
                                                               (line   6)
 * API, informational variables:          Extension API Informational Variables.
                                                               (line   6)
+* API, ownership of MPFR and GMP values: API Ownership of MPFR and GMP Values.
+                                                              (line   6)
 * arbitrary precision:                   Arbitrary Precision Arithmetic.
                                                               (line   6)
 * arbitrary precision <1>:               Computer Arithmetic. (line  61)
@@ -35779,6 +35828,8 @@ Index
 * git utility <3>:                       Adding Code.         (line 112)
 * Git, use of for gawk source code:      Derived Files.       (line   6)
 * global variables, show in debugger:    Debugger Info.       (line  48)
+* GMP values, API ownership of:          API Ownership of MPFR and GMP Values.
+                                                              (line   6)
 * GNITS mailing list:                    Acknowledgments.     (line  52)
 * GNU awk:                               Preface.             (line  51)
 * GNU Free Documentation License:        GNU Free Documentation License.
@@ -36136,6 +36187,8 @@ Index
 * module, definition of:                 Global Namespace.    (line  18)
 * monetary information, localization:    Explaining gettext.  (line 104)
 * Moore, Duncan:                         Getline Notes.       (line  40)
+* MPFR values, API ownership of:         API Ownership of MPFR and GMP Values.
+                                                              (line   6)
 * MPFR, checking for:                    Checking for MPFR.   (line   6)
 * msgfmt utility:                        I18N Example.        (line  80)
 * multiple precision:                    Arbitrary Precision Arithmetic.
@@ -37334,600 +37387,601 @@ Index
 
 Tag Table:
 Node: Top1200
-Node: Foreword344403
-Node: Foreword448845
-Node: Preface50377
-Ref: Preface-Footnote-153236
-Ref: Preface-Footnote-253345
-Ref: Preface-Footnote-353579
-Node: History53721
-Node: Names56073
-Ref: Names-Footnote-157177
-Node: This Manual57324
-Ref: This Manual-Footnote-163963
-Node: Conventions64063
-Node: Manual History66432
-Ref: Manual History-Footnote-169429
-Ref: Manual History-Footnote-269470
-Node: How To Contribute69544
-Node: Acknowledgments70470
-Node: Getting Started75407
-Node: Running gawk77846
-Node: One-shot79036
-Node: Read Terminal80299
-Node: Long82292
-Node: Executable Scripts83805
-Ref: Executable Scripts-Footnote-186438
-Node: Comments86541
-Node: Quoting89025
-Node: DOS Quoting94551
-Node: Sample Data Files96607
-Node: Very Simple99202
-Node: Two Rules104104
-Node: More Complex105989
-Node: Statements/Lines108855
-Ref: Statements/Lines-Footnote-1113339
-Node: Other Features113604
-Node: When114540
-Ref: When-Footnote-1116294
-Node: Intro Summary116359
-Node: Invoking Gawk117243
-Node: Command Line118757
-Node: Options119555
-Ref: Options-Footnote-1137435
-Ref: Options-Footnote-2137666
-Node: Other Arguments137691
-Node: Naming Standard Input140998
-Node: Environment Variables142208
-Node: AWKPATH Variable142766
-Ref: AWKPATH Variable-Footnote-1146178
-Ref: AWKPATH Variable-Footnote-2146212
-Node: AWKLIBPATH Variable146583
-Ref: AWKLIBPATH Variable-Footnote-1148280
-Node: Other Environment Variables148655
-Node: Exit Status152476
-Node: Include Files153153
-Node: Loading Shared Libraries156843
-Node: Obsolete158271
-Node: Undocumented158963
-Node: Invoking Summary159260
-Node: Regexp162101
-Node: Regexp Usage163555
-Node: Escape Sequences165592
-Node: Regexp Operators171833
-Node: Regexp Operator Details172318
-Ref: Regexp Operator Details-Footnote-1178750
-Node: Interval Expressions178897
-Ref: Interval Expressions-Footnote-1180318
-Node: Bracket Expressions180416
-Ref: table-char-classes182892
-Node: Leftmost Longest186218
-Node: Computed Regexps187521
-Node: GNU Regexp Operators190948
-Node: Case-sensitivity194685
-Ref: Case-sensitivity-Footnote-1197551
-Ref: Case-sensitivity-Footnote-2197786
-Node: Regexp Summary197894
-Node: Reading Files199360
-Node: Records201629
-Node: awk split records202704
-Node: gawk split records207979
-Ref: gawk split records-Footnote-1212712
-Node: Fields212749
-Node: Nonconstant Fields215490
-Ref: Nonconstant Fields-Footnote-1217726
-Node: Changing Fields217930
-Node: Field Separators223961
-Node: Default Field Splitting226659
-Node: Regexp Field Splitting227777
-Node: Single Character Fields231130
-Node: Command Line Field Separator232190
-Node: Full Line Fields235408
-Ref: Full Line Fields-Footnote-1236930
-Ref: Full Line Fields-Footnote-2236976
-Node: Field Splitting Summary237077
-Node: Constant Size239151
-Node: Fixed width data239883
-Node: Skipping intervening243350
-Node: Allowing trailing data244148
-Node: Fields with fixed data245185
-Node: Splitting By Content246703
-Ref: Splitting By Content-Footnote-1250486
-Node: More CSV250649
-Node: Testing field creation251959
-Node: Multiple Line253584
-Node: Getline259861
-Node: Plain Getline262330
-Node: Getline/Variable264903
-Node: Getline/File266054
-Node: Getline/Variable/File267442
-Ref: Getline/Variable/File-Footnote-1269047
-Node: Getline/Pipe269135
-Node: Getline/Variable/Pipe271839
-Node: Getline/Coprocess272974
-Node: Getline/Variable/Coprocess274241
-Node: Getline Notes274983
-Node: Getline Summary277780
-Ref: table-getline-variants278204
-Node: Read Timeout278952
-Ref: Read Timeout-Footnote-1282858
-Node: Retrying Input282916
-Node: Command-line directories284115
-Node: Input Summary285021
-Node: Input Exercises288193
-Node: Printing288627
-Node: Print290461
-Node: Print Examples291918
-Node: Output Separators294698
-Node: OFMT296715
-Node: Printf298071
-Node: Basic Printf298856
-Node: Control Letters300430
-Node: Format Modifiers305594
-Node: Printf Examples311609
-Node: Redirection314095
-Node: Special FD320936
-Ref: Special FD-Footnote-1324104
-Node: Special Files324178
-Node: Other Inherited Files324795
-Node: Special Network325796
-Node: Special Caveats326656
-Node: Close Files And Pipes327605
-Ref: table-close-pipe-return-values334512
-Ref: Close Files And Pipes-Footnote-1335325
-Ref: Close Files And Pipes-Footnote-2335473
-Node: Nonfatal335625
-Node: Output Summary337963
-Node: Output Exercises339185
-Node: Expressions339864
-Node: Values341052
-Node: Constants341730
-Node: Scalar Constants342421
-Ref: Scalar Constants-Footnote-1344945
-Node: Nondecimal-numbers345195
-Node: Regexp Constants348196
-Node: Using Constant Regexps348722
-Node: Standard Regexp Constants349344
-Node: Strong Regexp Constants352532
-Node: Variables355544
-Node: Using Variables356201
-Node: Assignment Options358111
-Node: Conversion360582
-Node: Strings And Numbers361106
-Ref: Strings And Numbers-Footnote-1364169
-Node: Locale influences conversions364278
-Ref: table-locale-affects367036
-Node: All Operators367654
-Node: Arithmetic Ops368283
-Node: Concatenation370789
-Ref: Concatenation-Footnote-1373636
-Node: Assignment Ops373743
-Ref: table-assign-ops378734
-Node: Increment Ops380047
-Node: Truth Values and Conditions383507
-Node: Truth Values384581
-Node: Typing and Comparison385629
-Node: Variable Typing386449
-Ref: Variable Typing-Footnote-1392912
-Ref: Variable Typing-Footnote-2392984
-Node: Comparison Operators393061
-Ref: table-relational-ops393480
-Node: POSIX String Comparison396975
-Ref: POSIX String Comparison-Footnote-1398670
-Ref: POSIX String Comparison-Footnote-2398809
-Node: Boolean Ops398893
-Ref: Boolean Ops-Footnote-1403375
-Node: Conditional Exp403467
-Node: Function Calls405203
-Node: Precedence409080
-Node: Locales412739
-Node: Expressions Summary414371
-Node: Patterns and Actions416944
-Node: Pattern Overview418064
-Node: Regexp Patterns419741
-Node: Expression Patterns420283
-Node: Ranges424064
-Node: BEGIN/END427172
-Node: Using BEGIN/END427933
-Ref: Using BEGIN/END-Footnote-1430669
-Node: I/O And BEGIN/END430775
-Node: BEGINFILE/ENDFILE433089
-Node: Empty436002
-Node: Using Shell Variables436319
-Node: Action Overview438593
-Node: Statements440918
-Node: If Statement442766
-Node: While Statement444261
-Node: Do Statement446289
-Node: For Statement447437
-Node: Switch Statement450608
-Node: Break Statement453049
-Node: Continue Statement455141
-Node: Next Statement456968
-Node: Nextfile Statement459351
-Node: Exit Statement462003
-Node: Built-in Variables464406
-Node: User-modified465539
-Node: Auto-set473306
-Ref: Auto-set-Footnote-1490113
-Ref: Auto-set-Footnote-2490319
-Node: ARGC and ARGV490375
-Node: Pattern Action Summary494588
-Node: Arrays497018
-Node: Array Basics498347
-Node: Array Intro499191
-Ref: figure-array-elements501166
-Ref: Array Intro-Footnote-1503870
-Node: Reference to Elements503998
-Node: Assigning Elements506462
-Node: Array Example506953
-Node: Scanning an Array508712
-Node: Controlling Scanning511734
-Ref: Controlling Scanning-Footnote-1518190
-Node: Numeric Array Subscripts518506
-Node: Uninitialized Subscripts520690
-Node: Delete522309
-Ref: Delete-Footnote-1525061
-Node: Multidimensional525118
-Node: Multiscanning528213
-Node: Arrays of Arrays529804
-Node: Arrays Summary534572
-Node: Functions536665
-Node: Built-in537703
-Node: Calling Built-in538784
-Node: Numeric Functions540780
-Ref: Numeric Functions-Footnote-1544808
-Ref: Numeric Functions-Footnote-2545456
-Ref: Numeric Functions-Footnote-3545504
-Node: String Functions545776
-Ref: String Functions-Footnote-1569933
-Ref: String Functions-Footnote-2570061
-Ref: String Functions-Footnote-3570309
-Node: Gory Details570396
-Ref: table-sub-escapes572187
-Ref: table-sub-proposed573706
-Ref: table-posix-sub575069
-Ref: table-gensub-escapes576610
-Ref: Gory Details-Footnote-1577433
-Node: I/O Functions577587
-Ref: table-system-return-values584055
-Ref: I/O Functions-Footnote-1586135
-Ref: I/O Functions-Footnote-2586283
-Node: Time Functions586403
-Ref: Time Functions-Footnote-1597074
-Ref: Time Functions-Footnote-2597142
-Ref: Time Functions-Footnote-3597300
-Ref: Time Functions-Footnote-4597411
-Ref: Time Functions-Footnote-5597523
-Ref: Time Functions-Footnote-6597750
-Node: Bitwise Functions598016
-Ref: table-bitwise-ops598610
-Ref: Bitwise Functions-Footnote-1604673
-Ref: Bitwise Functions-Footnote-2604846
-Node: Type Functions605037
-Node: I18N Functions607900
-Node: User-defined609551
-Node: Definition Syntax610363
-Ref: Definition Syntax-Footnote-1616050
-Node: Function Example616121
-Ref: Function Example-Footnote-1619043
-Node: Function Calling619065
-Node: Calling A Function619653
-Node: Variable Scope620611
-Node: Pass By Value/Reference623605
-Node: Function Caveats626249
-Ref: Function Caveats-Footnote-1628296
-Node: Return Statement628416
-Node: Dynamic Typing631395
-Node: Indirect Calls632325
-Ref: Indirect Calls-Footnote-1642577
-Node: Functions Summary642705
-Node: Library Functions645410
-Ref: Library Functions-Footnote-1649017
-Ref: Library Functions-Footnote-2649160
-Node: Library Names649331
-Ref: Library Names-Footnote-1652998
-Ref: Library Names-Footnote-2653221
-Node: General Functions653307
-Node: Strtonum Function654410
-Node: Assert Function657432
-Node: Round Function660758
-Node: Cliff Random Function662298
-Node: Ordinal Functions663314
-Ref: Ordinal Functions-Footnote-1666377
-Ref: Ordinal Functions-Footnote-2666629
-Node: Join Function666839
-Ref: Join Function-Footnote-1668609
-Node: Getlocaltime Function668809
-Node: Readfile Function672551
-Node: Shell Quoting674528
-Node: Data File Management675929
-Node: Filetrans Function676561
-Node: Rewind Function680657
-Node: File Checking682566
-Ref: File Checking-Footnote-1683900
-Node: Empty Files684101
-Node: Ignoring Assigns686080
-Node: Getopt Function687630
-Ref: Getopt Function-Footnote-1702842
-Node: Passwd Functions703042
-Ref: Passwd Functions-Footnote-1711881
-Node: Group Functions711969
-Ref: Group Functions-Footnote-1719867
-Node: Walking Arrays720074
-Node: Library Functions Summary723082
-Node: Library Exercises724488
-Node: Sample Programs724953
-Node: Running Examples725723
-Node: Clones726451
-Node: Cut Program727675
-Node: Egrep Program737604
-Ref: Egrep Program-Footnote-1745116
-Node: Id Program745226
-Node: Split Program748906
-Ref: Split Program-Footnote-1752364
-Node: Tee Program752493
-Node: Uniq Program755283
-Node: Wc Program762904
-Ref: Wc Program-Footnote-1767159
-Node: Miscellaneous Programs767253
-Node: Dupword Program768466
-Node: Alarm Program770496
-Node: Translate Program775351
-Ref: Translate Program-Footnote-1779916
-Node: Labels Program780186
-Ref: Labels Program-Footnote-1783537
-Node: Word Sorting783621
-Node: History Sorting787693
-Node: Extract Program789918
-Node: Simple Sed797972
-Node: Igawk Program801046
-Ref: Igawk Program-Footnote-1815377
-Ref: Igawk Program-Footnote-2815579
-Ref: Igawk Program-Footnote-3815701
-Node: Anagram Program815816
-Node: Signature Program818878
-Node: Programs Summary820125
-Node: Programs Exercises821339
-Ref: Programs Exercises-Footnote-1825468
-Node: Advanced Features825559
-Node: Nondecimal Data827549
-Node: Array Sorting829140
-Node: Controlling Array Traversal829840
-Ref: Controlling Array Traversal-Footnote-1838208
-Node: Array Sorting Functions838326
-Ref: Array Sorting Functions-Footnote-1843417
-Node: Two-way I/O843613
-Ref: Two-way I/O-Footnote-1851334
-Ref: Two-way I/O-Footnote-2851521
-Node: TCP/IP Networking851603
-Node: Profiling854721
-Node: Advanced Features Summary863736
-Node: Internationalization865580
-Node: I18N and L10N867060
-Node: Explaining gettext867747
-Ref: Explaining gettext-Footnote-1873639
-Ref: Explaining gettext-Footnote-2873824
-Node: Programmer i18n873989
-Ref: Programmer i18n-Footnote-1878938
-Node: Translator i18n878987
-Node: String Extraction879781
-Ref: String Extraction-Footnote-1880913
-Node: Printf Ordering880999
-Ref: Printf Ordering-Footnote-1883785
-Node: I18N Portability883849
-Ref: I18N Portability-Footnote-1886305
-Node: I18N Example886368
-Ref: I18N Example-Footnote-1889643
-Ref: I18N Example-Footnote-2889716
-Node: Gawk I18N889825
-Node: I18N Summary890474
-Node: Debugger891815
-Node: Debugging892815
-Node: Debugging Concepts893256
-Node: Debugging Terms895065
-Node: Awk Debugging897640
-Ref: Awk Debugging-Footnote-1898585
-Node: Sample Debugging Session898717
-Node: Debugger Invocation899251
-Node: Finding The Bug900637
-Node: List of Debugger Commands907111
-Node: Breakpoint Control908444
-Node: Debugger Execution Control912138
-Node: Viewing And Changing Data915500
-Node: Execution Stack919041
-Node: Debugger Info920678
-Node: Miscellaneous Debugger Commands924749
-Node: Readline Support929811
-Node: Limitations930707
-Node: Debugging Summary933261
-Node: Namespaces934540
-Node: Global Namespace935651
-Node: Qualified Names937049
-Node: Default Namespace938048
-Node: Changing The Namespace938789
-Node: Naming Rules940403
-Node: Internal Name Management942251
-Node: Namespace Example943293
-Node: Namespace And Features945855
-Node: Namespace Summary947290
-Node: Arbitrary Precision Arithmetic948767
-Node: Computer Arithmetic950254
-Ref: table-numeric-ranges954020
-Ref: table-floating-point-ranges954513
-Ref: Computer Arithmetic-Footnote-1955171
-Node: Math Definitions955228
-Ref: table-ieee-formats958544
-Ref: Math Definitions-Footnote-1959147
-Node: MPFR features959252
-Node: FP Math Caution960970
-Ref: FP Math Caution-Footnote-1962042
-Node: Inexactness of computations962411
-Node: Inexact representation963371
-Node: Comparing FP Values964731
-Node: Errors accumulate965972
-Node: Getting Accuracy967405
-Node: Try To Round970115
-Node: Setting precision971014
-Ref: table-predefined-precision-strings971711
-Node: Setting the rounding mode973541
-Ref: table-gawk-rounding-modes973915
-Ref: Setting the rounding mode-Footnote-1977846
-Node: Arbitrary Precision Integers978025
-Ref: Arbitrary Precision Integers-Footnote-1981200
-Node: Checking for MPFR981349
-Node: POSIX Floating Point Problems982823
-Ref: POSIX Floating Point Problems-Footnote-1987108
-Node: Floating point summary987146
-Node: Dynamic Extensions989336
-Node: Extension Intro990889
-Node: Plugin License992155
-Node: Extension Mechanism Outline992952
-Ref: figure-load-extension993391
-Ref: figure-register-new-function994956
-Ref: figure-call-new-function996048
-Node: Extension API Description998110
-Node: Extension API Functions Introduction999752
-Ref: table-api-std-headers1001588
-Node: General Data Types1005453
-Ref: General Data Types-Footnote-11014084
-Node: Memory Allocation Functions1014383
-Ref: Memory Allocation Functions-Footnote-11018593
-Node: Constructor Functions1018692
-Node: Registration Functions1022278
-Node: Extension Functions1022963
-Node: Exit Callback Functions1028285
-Node: Extension Version String1029535
-Node: Input Parsers1030198
-Node: Output Wrappers1042919
-Node: Two-way processors1047431
-Node: Printing Messages1049696
-Ref: Printing Messages-Footnote-11050867
-Node: Updating ERRNO1051020
-Node: Requesting Values1051759
-Ref: table-value-types-returned1052496
-Node: Accessing Parameters1053432
-Node: Symbol Table Access1054667
-Node: Symbol table by name1055179
-Ref: Symbol table by name-Footnote-11058203
-Node: Symbol table by cookie1058331
-Ref: Symbol table by cookie-Footnote-11062516
-Node: Cached values1062580
-Ref: Cached values-Footnote-11066116
-Node: Array Manipulation1066269
-Ref: Array Manipulation-Footnote-11067360
-Node: Array Data Types1067397
-Ref: Array Data Types-Footnote-11070055
-Node: Array Functions1070147
-Node: Flattening Arrays1074645
-Node: Creating Arrays1081621
-Node: Redirection API1086388
-Node: Extension API Variables1089221
-Node: Extension Versioning1089932
-Ref: gawk-api-version1090361
-Node: Extension GMP/MPFR Versioning1092092
-Node: Extension API Informational Variables1093720
-Node: Extension API Boilerplate1094793
-Node: Changes from API V11098767
-Node: Finding Extensions1100339
-Node: Extension Example1100898
-Node: Internal File Description1101696
-Node: Internal File Ops1105776
-Ref: Internal File Ops-Footnote-11117126
-Node: Using Internal File Ops1117266
-Ref: Using Internal File Ops-Footnote-11119649
-Node: Extension Samples1119923
-Node: Extension Sample File Functions1121452
-Node: Extension Sample Fnmatch1129101
-Node: Extension Sample Fork1130588
-Node: Extension Sample Inplace1131806
-Node: Extension Sample Ord1135431
-Node: Extension Sample Readdir1136267
-Ref: table-readdir-file-types1137156
-Node: Extension Sample Revout1138223
-Node: Extension Sample Rev2way1138812
-Node: Extension Sample Read write array1139552
-Node: Extension Sample Readfile1141494
-Node: Extension Sample Time1142589
-Node: Extension Sample API Tests1144341
-Node: gawkextlib1144833
-Node: Extension summary1147751
-Node: Extension Exercises1151453
-Node: Language History1152695
-Node: V7/SVR3.11154351
-Node: SVR41156503
-Node: POSIX1157937
-Node: BTL1159318
-Node: POSIX/GNU1160047
-Node: Feature History1165825
-Node: Common Extensions1182144
-Node: Ranges and Locales1183427
-Ref: Ranges and Locales-Footnote-11188043
-Ref: Ranges and Locales-Footnote-21188070
-Ref: Ranges and Locales-Footnote-31188305
-Node: Contributors1188528
-Node: History summary1194525
-Node: Installation1195905
-Node: Gawk Distribution1196849
-Node: Getting1197333
-Node: Extracting1198296
-Node: Distribution contents1199934
-Node: Unix Installation1206414
-Node: Quick Installation1207096
-Node: Shell Startup Files1209510
-Node: Additional Configuration Options1210599
-Node: Configuration Philosophy1212914
-Node: Non-Unix Installation1215283
-Node: PC Installation1215743
-Node: PC Binary Installation1216581
-Node: PC Compiling1217016
-Node: PC Using1218133
-Node: Cygwin1221686
-Node: MSYS1222910
-Node: VMS Installation1223512
-Node: VMS Compilation1224303
-Ref: VMS Compilation-Footnote-11225532
-Node: VMS Dynamic Extensions1225590
-Node: VMS Installation Details1227275
-Node: VMS Running1229528
-Node: VMS GNV1233807
-Node: VMS Old Gawk1234542
-Node: Bugs1235013
-Node: Bug address1235676
-Node: Usenet1238658
-Node: Maintainers1239662
-Node: Other Versions1240847
-Node: Installation summary1247935
-Node: Notes1249144
-Node: Compatibility Mode1249938
-Node: Additions1250720
-Node: Accessing The Source1251645
-Node: Adding Code1253082
-Node: New Ports1259301
-Node: Derived Files1263676
-Ref: Derived Files-Footnote-11269336
-Ref: Derived Files-Footnote-21269371
-Ref: Derived Files-Footnote-31269969
-Node: Future Extensions1270083
-Node: Implementation Limitations1270741
-Node: Extension Design1271951
-Node: Old Extension Problems1273095
-Ref: Old Extension Problems-Footnote-11274613
-Node: Extension New Mechanism Goals1274670
-Ref: Extension New Mechanism Goals-Footnote-11278034
-Node: Extension Other Design Decisions1278223
-Node: Extension Future Growth1280336
-Node: Notes summary1280942
-Node: Basic Concepts1282100
-Node: Basic High Level1282781
-Ref: figure-general-flow1283063
-Ref: figure-process-flow1283748
-Ref: Basic High Level-Footnote-11287049
-Node: Basic Data Typing1287234
-Node: Glossary1290562
-Node: Copying1322447
-Node: GNU Free Documentation License1359990
-Node: Index1385110
+Node: Foreword344474
+Node: Foreword448916
+Node: Preface50448
+Ref: Preface-Footnote-153307
+Ref: Preface-Footnote-253416
+Ref: Preface-Footnote-353650
+Node: History53792
+Node: Names56144
+Ref: Names-Footnote-157248
+Node: This Manual57395
+Ref: This Manual-Footnote-164034
+Node: Conventions64134
+Node: Manual History66503
+Ref: Manual History-Footnote-169500
+Ref: Manual History-Footnote-269541
+Node: How To Contribute69615
+Node: Acknowledgments70541
+Node: Getting Started75478
+Node: Running gawk77917
+Node: One-shot79107
+Node: Read Terminal80370
+Node: Long82363
+Node: Executable Scripts83876
+Ref: Executable Scripts-Footnote-186509
+Node: Comments86612
+Node: Quoting89096
+Node: DOS Quoting94622
+Node: Sample Data Files96678
+Node: Very Simple99273
+Node: Two Rules104175
+Node: More Complex106060
+Node: Statements/Lines108926
+Ref: Statements/Lines-Footnote-1113410
+Node: Other Features113675
+Node: When114611
+Ref: When-Footnote-1116365
+Node: Intro Summary116430
+Node: Invoking Gawk117314
+Node: Command Line118828
+Node: Options119626
+Ref: Options-Footnote-1137506
+Ref: Options-Footnote-2137737
+Node: Other Arguments137762
+Node: Naming Standard Input141069
+Node: Environment Variables142279
+Node: AWKPATH Variable142837
+Ref: AWKPATH Variable-Footnote-1146249
+Ref: AWKPATH Variable-Footnote-2146283
+Node: AWKLIBPATH Variable146654
+Ref: AWKLIBPATH Variable-Footnote-1148351
+Node: Other Environment Variables148726
+Node: Exit Status152547
+Node: Include Files153224
+Node: Loading Shared Libraries156914
+Node: Obsolete158342
+Node: Undocumented159034
+Node: Invoking Summary159331
+Node: Regexp162172
+Node: Regexp Usage163626
+Node: Escape Sequences165663
+Node: Regexp Operators171904
+Node: Regexp Operator Details172389
+Ref: Regexp Operator Details-Footnote-1178821
+Node: Interval Expressions178968
+Ref: Interval Expressions-Footnote-1180389
+Node: Bracket Expressions180487
+Ref: table-char-classes182963
+Node: Leftmost Longest186289
+Node: Computed Regexps187592
+Node: GNU Regexp Operators191019
+Node: Case-sensitivity194756
+Ref: Case-sensitivity-Footnote-1197622
+Ref: Case-sensitivity-Footnote-2197857
+Node: Regexp Summary197965
+Node: Reading Files199431
+Node: Records201700
+Node: awk split records202775
+Node: gawk split records208050
+Ref: gawk split records-Footnote-1212783
+Node: Fields212820
+Node: Nonconstant Fields215561
+Ref: Nonconstant Fields-Footnote-1217797
+Node: Changing Fields218001
+Node: Field Separators224032
+Node: Default Field Splitting226730
+Node: Regexp Field Splitting227848
+Node: Single Character Fields231201
+Node: Command Line Field Separator232261
+Node: Full Line Fields235479
+Ref: Full Line Fields-Footnote-1237001
+Ref: Full Line Fields-Footnote-2237047
+Node: Field Splitting Summary237148
+Node: Constant Size239222
+Node: Fixed width data239954
+Node: Skipping intervening243421
+Node: Allowing trailing data244219
+Node: Fields with fixed data245256
+Node: Splitting By Content246774
+Ref: Splitting By Content-Footnote-1250557
+Node: More CSV250720
+Node: Testing field creation252030
+Node: Multiple Line253655
+Node: Getline259932
+Node: Plain Getline262401
+Node: Getline/Variable264974
+Node: Getline/File266125
+Node: Getline/Variable/File267513
+Ref: Getline/Variable/File-Footnote-1269118
+Node: Getline/Pipe269206
+Node: Getline/Variable/Pipe271910
+Node: Getline/Coprocess273045
+Node: Getline/Variable/Coprocess274312
+Node: Getline Notes275054
+Node: Getline Summary277851
+Ref: table-getline-variants278275
+Node: Read Timeout279023
+Ref: Read Timeout-Footnote-1282929
+Node: Retrying Input282987
+Node: Command-line directories284186
+Node: Input Summary285092
+Node: Input Exercises288264
+Node: Printing288698
+Node: Print290532
+Node: Print Examples291989
+Node: Output Separators294769
+Node: OFMT296786
+Node: Printf298142
+Node: Basic Printf298927
+Node: Control Letters300501
+Node: Format Modifiers305665
+Node: Printf Examples311680
+Node: Redirection314166
+Node: Special FD321007
+Ref: Special FD-Footnote-1324175
+Node: Special Files324249
+Node: Other Inherited Files324866
+Node: Special Network325867
+Node: Special Caveats326727
+Node: Close Files And Pipes327676
+Ref: table-close-pipe-return-values334583
+Ref: Close Files And Pipes-Footnote-1335396
+Ref: Close Files And Pipes-Footnote-2335544
+Node: Nonfatal335696
+Node: Output Summary338034
+Node: Output Exercises339256
+Node: Expressions339935
+Node: Values341123
+Node: Constants341801
+Node: Scalar Constants342492
+Ref: Scalar Constants-Footnote-1345016
+Node: Nondecimal-numbers345266
+Node: Regexp Constants348267
+Node: Using Constant Regexps348793
+Node: Standard Regexp Constants349415
+Node: Strong Regexp Constants352603
+Node: Variables355615
+Node: Using Variables356272
+Node: Assignment Options358182
+Node: Conversion360653
+Node: Strings And Numbers361177
+Ref: Strings And Numbers-Footnote-1364240
+Node: Locale influences conversions364349
+Ref: table-locale-affects367107
+Node: All Operators367725
+Node: Arithmetic Ops368354
+Node: Concatenation370860
+Ref: Concatenation-Footnote-1373707
+Node: Assignment Ops373814
+Ref: table-assign-ops378805
+Node: Increment Ops380118
+Node: Truth Values and Conditions383578
+Node: Truth Values384652
+Node: Typing and Comparison385700
+Node: Variable Typing386520
+Ref: Variable Typing-Footnote-1392983
+Ref: Variable Typing-Footnote-2393055
+Node: Comparison Operators393132
+Ref: table-relational-ops393551
+Node: POSIX String Comparison397046
+Ref: POSIX String Comparison-Footnote-1398741
+Ref: POSIX String Comparison-Footnote-2398880
+Node: Boolean Ops398964
+Ref: Boolean Ops-Footnote-1403446
+Node: Conditional Exp403538
+Node: Function Calls405274
+Node: Precedence409151
+Node: Locales412810
+Node: Expressions Summary414442
+Node: Patterns and Actions417015
+Node: Pattern Overview418135
+Node: Regexp Patterns419812
+Node: Expression Patterns420354
+Node: Ranges424135
+Node: BEGIN/END427243
+Node: Using BEGIN/END428004
+Ref: Using BEGIN/END-Footnote-1430740
+Node: I/O And BEGIN/END430846
+Node: BEGINFILE/ENDFILE433160
+Node: Empty436073
+Node: Using Shell Variables436390
+Node: Action Overview438664
+Node: Statements440989
+Node: If Statement442837
+Node: While Statement444332
+Node: Do Statement446360
+Node: For Statement447508
+Node: Switch Statement450679
+Node: Break Statement453120
+Node: Continue Statement455212
+Node: Next Statement457039
+Node: Nextfile Statement459422
+Node: Exit Statement462074
+Node: Built-in Variables464477
+Node: User-modified465610
+Node: Auto-set473377
+Ref: Auto-set-Footnote-1490184
+Ref: Auto-set-Footnote-2490390
+Node: ARGC and ARGV490446
+Node: Pattern Action Summary494659
+Node: Arrays497089
+Node: Array Basics498418
+Node: Array Intro499262
+Ref: figure-array-elements501237
+Ref: Array Intro-Footnote-1503941
+Node: Reference to Elements504069
+Node: Assigning Elements506533
+Node: Array Example507024
+Node: Scanning an Array508783
+Node: Controlling Scanning511805
+Ref: Controlling Scanning-Footnote-1518261
+Node: Numeric Array Subscripts518577
+Node: Uninitialized Subscripts520761
+Node: Delete522380
+Ref: Delete-Footnote-1525132
+Node: Multidimensional525189
+Node: Multiscanning528284
+Node: Arrays of Arrays529875
+Node: Arrays Summary534643
+Node: Functions536736
+Node: Built-in537774
+Node: Calling Built-in538855
+Node: Numeric Functions540851
+Ref: Numeric Functions-Footnote-1544879
+Ref: Numeric Functions-Footnote-2545527
+Ref: Numeric Functions-Footnote-3545575
+Node: String Functions545847
+Ref: String Functions-Footnote-1570004
+Ref: String Functions-Footnote-2570132
+Ref: String Functions-Footnote-3570380
+Node: Gory Details570467
+Ref: table-sub-escapes572258
+Ref: table-sub-proposed573777
+Ref: table-posix-sub575140
+Ref: table-gensub-escapes576681
+Ref: Gory Details-Footnote-1577504
+Node: I/O Functions577658
+Ref: table-system-return-values584126
+Ref: I/O Functions-Footnote-1586206
+Ref: I/O Functions-Footnote-2586354
+Node: Time Functions586474
+Ref: Time Functions-Footnote-1597145
+Ref: Time Functions-Footnote-2597213
+Ref: Time Functions-Footnote-3597371
+Ref: Time Functions-Footnote-4597482
+Ref: Time Functions-Footnote-5597594
+Ref: Time Functions-Footnote-6597821
+Node: Bitwise Functions598087
+Ref: table-bitwise-ops598681
+Ref: Bitwise Functions-Footnote-1604744
+Ref: Bitwise Functions-Footnote-2604917
+Node: Type Functions605108
+Node: I18N Functions607971
+Node: User-defined609622
+Node: Definition Syntax610434
+Ref: Definition Syntax-Footnote-1616121
+Node: Function Example616192
+Ref: Function Example-Footnote-1619114
+Node: Function Calling619136
+Node: Calling A Function619724
+Node: Variable Scope620682
+Node: Pass By Value/Reference623676
+Node: Function Caveats626320
+Ref: Function Caveats-Footnote-1628367
+Node: Return Statement628487
+Node: Dynamic Typing631466
+Node: Indirect Calls632396
+Ref: Indirect Calls-Footnote-1642648
+Node: Functions Summary642776
+Node: Library Functions645481
+Ref: Library Functions-Footnote-1649088
+Ref: Library Functions-Footnote-2649231
+Node: Library Names649402
+Ref: Library Names-Footnote-1653069
+Ref: Library Names-Footnote-2653292
+Node: General Functions653378
+Node: Strtonum Function654481
+Node: Assert Function657503
+Node: Round Function660829
+Node: Cliff Random Function662369
+Node: Ordinal Functions663385
+Ref: Ordinal Functions-Footnote-1666448
+Ref: Ordinal Functions-Footnote-2666700
+Node: Join Function666910
+Ref: Join Function-Footnote-1668680
+Node: Getlocaltime Function668880
+Node: Readfile Function672622
+Node: Shell Quoting674599
+Node: Data File Management676000
+Node: Filetrans Function676632
+Node: Rewind Function680728
+Node: File Checking682637
+Ref: File Checking-Footnote-1683971
+Node: Empty Files684172
+Node: Ignoring Assigns686151
+Node: Getopt Function687701
+Ref: Getopt Function-Footnote-1702913
+Node: Passwd Functions703113
+Ref: Passwd Functions-Footnote-1711952
+Node: Group Functions712040
+Ref: Group Functions-Footnote-1719938
+Node: Walking Arrays720145
+Node: Library Functions Summary723153
+Node: Library Exercises724559
+Node: Sample Programs725024
+Node: Running Examples725794
+Node: Clones726522
+Node: Cut Program727746
+Node: Egrep Program737675
+Ref: Egrep Program-Footnote-1745187
+Node: Id Program745297
+Node: Split Program748977
+Ref: Split Program-Footnote-1752435
+Node: Tee Program752564
+Node: Uniq Program755354
+Node: Wc Program762975
+Ref: Wc Program-Footnote-1767230
+Node: Miscellaneous Programs767324
+Node: Dupword Program768537
+Node: Alarm Program770567
+Node: Translate Program775422
+Ref: Translate Program-Footnote-1779987
+Node: Labels Program780257
+Ref: Labels Program-Footnote-1783608
+Node: Word Sorting783692
+Node: History Sorting787764
+Node: Extract Program789989
+Node: Simple Sed798043
+Node: Igawk Program801117
+Ref: Igawk Program-Footnote-1815448
+Ref: Igawk Program-Footnote-2815650
+Ref: Igawk Program-Footnote-3815772
+Node: Anagram Program815887
+Node: Signature Program818949
+Node: Programs Summary820196
+Node: Programs Exercises821410
+Ref: Programs Exercises-Footnote-1825539
+Node: Advanced Features825630
+Node: Nondecimal Data827620
+Node: Array Sorting829211
+Node: Controlling Array Traversal829911
+Ref: Controlling Array Traversal-Footnote-1838279
+Node: Array Sorting Functions838397
+Ref: Array Sorting Functions-Footnote-1843488
+Node: Two-way I/O843684
+Ref: Two-way I/O-Footnote-1851405
+Ref: Two-way I/O-Footnote-2851592
+Node: TCP/IP Networking851674
+Node: Profiling854792
+Node: Advanced Features Summary863807
+Node: Internationalization865651
+Node: I18N and L10N867131
+Node: Explaining gettext867818
+Ref: Explaining gettext-Footnote-1873710
+Ref: Explaining gettext-Footnote-2873895
+Node: Programmer i18n874060
+Ref: Programmer i18n-Footnote-1879009
+Node: Translator i18n879058
+Node: String Extraction879852
+Ref: String Extraction-Footnote-1880984
+Node: Printf Ordering881070
+Ref: Printf Ordering-Footnote-1883856
+Node: I18N Portability883920
+Ref: I18N Portability-Footnote-1886376
+Node: I18N Example886439
+Ref: I18N Example-Footnote-1889714
+Ref: I18N Example-Footnote-2889787
+Node: Gawk I18N889896
+Node: I18N Summary890545
+Node: Debugger891886
+Node: Debugging892886
+Node: Debugging Concepts893327
+Node: Debugging Terms895136
+Node: Awk Debugging897711
+Ref: Awk Debugging-Footnote-1898656
+Node: Sample Debugging Session898788
+Node: Debugger Invocation899322
+Node: Finding The Bug900708
+Node: List of Debugger Commands907182
+Node: Breakpoint Control908515
+Node: Debugger Execution Control912209
+Node: Viewing And Changing Data915571
+Node: Execution Stack919112
+Node: Debugger Info920749
+Node: Miscellaneous Debugger Commands924820
+Node: Readline Support929882
+Node: Limitations930778
+Node: Debugging Summary933332
+Node: Namespaces934611
+Node: Global Namespace935722
+Node: Qualified Names937120
+Node: Default Namespace938119
+Node: Changing The Namespace938860
+Node: Naming Rules940474
+Node: Internal Name Management942322
+Node: Namespace Example943364
+Node: Namespace And Features945926
+Node: Namespace Summary947361
+Node: Arbitrary Precision Arithmetic948838
+Node: Computer Arithmetic950325
+Ref: table-numeric-ranges954091
+Ref: table-floating-point-ranges954584
+Ref: Computer Arithmetic-Footnote-1955242
+Node: Math Definitions955299
+Ref: table-ieee-formats958615
+Ref: Math Definitions-Footnote-1959218
+Node: MPFR features959323
+Node: FP Math Caution961041
+Ref: FP Math Caution-Footnote-1962113
+Node: Inexactness of computations962482
+Node: Inexact representation963442
+Node: Comparing FP Values964802
+Node: Errors accumulate966043
+Node: Getting Accuracy967476
+Node: Try To Round970186
+Node: Setting precision971085
+Ref: table-predefined-precision-strings971782
+Node: Setting the rounding mode973612
+Ref: table-gawk-rounding-modes973986
+Ref: Setting the rounding mode-Footnote-1977917
+Node: Arbitrary Precision Integers978096
+Ref: Arbitrary Precision Integers-Footnote-1981271
+Node: Checking for MPFR981420
+Node: POSIX Floating Point Problems982894
+Ref: POSIX Floating Point Problems-Footnote-1987179
+Node: Floating point summary987217
+Node: Dynamic Extensions989407
+Node: Extension Intro990960
+Node: Plugin License992226
+Node: Extension Mechanism Outline993023
+Ref: figure-load-extension993462
+Ref: figure-register-new-function995027
+Ref: figure-call-new-function996119
+Node: Extension API Description998181
+Node: Extension API Functions Introduction999894
+Ref: table-api-std-headers1001730
+Node: General Data Types1005943
+Ref: General Data Types-Footnote-11014573
+Node: Memory Allocation Functions1014872
+Ref: Memory Allocation Functions-Footnote-11019082
+Node: Constructor Functions1019181
+Node: API Ownership of MPFR and GMP Values1022647
+Node: Registration Functions1024085
+Node: Extension Functions1024785
+Node: Exit Callback Functions1030107
+Node: Extension Version String1031357
+Node: Input Parsers1032020
+Node: Output Wrappers1044741
+Node: Two-way processors1049253
+Node: Printing Messages1051518
+Ref: Printing Messages-Footnote-11052689
+Node: Updating ERRNO1052842
+Node: Requesting Values1053581
+Ref: table-value-types-returned1054318
+Node: Accessing Parameters1055254
+Node: Symbol Table Access1056491
+Node: Symbol table by name1057003
+Ref: Symbol table by name-Footnote-11060027
+Node: Symbol table by cookie1060155
+Ref: Symbol table by cookie-Footnote-11064340
+Node: Cached values1064404
+Ref: Cached values-Footnote-11067940
+Node: Array Manipulation1068093
+Ref: Array Manipulation-Footnote-11069184
+Node: Array Data Types1069221
+Ref: Array Data Types-Footnote-11071879
+Node: Array Functions1071971
+Node: Flattening Arrays1076469
+Node: Creating Arrays1083445
+Node: Redirection API1088212
+Node: Extension API Variables1091045
+Node: Extension Versioning1091756
+Ref: gawk-api-version1092185
+Node: Extension GMP/MPFR Versioning1093916
+Node: Extension API Informational Variables1095544
+Node: Extension API Boilerplate1096617
+Node: Changes from API V11100591
+Node: Finding Extensions1102163
+Node: Extension Example1102722
+Node: Internal File Description1103520
+Node: Internal File Ops1107600
+Ref: Internal File Ops-Footnote-11118950
+Node: Using Internal File Ops1119090
+Ref: Using Internal File Ops-Footnote-11121473
+Node: Extension Samples1121747
+Node: Extension Sample File Functions1123276
+Node: Extension Sample Fnmatch1130925
+Node: Extension Sample Fork1132412
+Node: Extension Sample Inplace1133630
+Node: Extension Sample Ord1137255
+Node: Extension Sample Readdir1138091
+Ref: table-readdir-file-types1138980
+Node: Extension Sample Revout1140047
+Node: Extension Sample Rev2way1140636
+Node: Extension Sample Read write array1141376
+Node: Extension Sample Readfile1143318
+Node: Extension Sample Time1144413
+Node: Extension Sample API Tests1146165
+Node: gawkextlib1146657
+Node: Extension summary1149575
+Node: Extension Exercises1153277
+Node: Language History1154519
+Node: V7/SVR3.11156175
+Node: SVR41158327
+Node: POSIX1159761
+Node: BTL1161142
+Node: POSIX/GNU1161871
+Node: Feature History1167649
+Node: Common Extensions1183968
+Node: Ranges and Locales1185251
+Ref: Ranges and Locales-Footnote-11189867
+Ref: Ranges and Locales-Footnote-21189894
+Ref: Ranges and Locales-Footnote-31190129
+Node: Contributors1190352
+Node: History summary1196349
+Node: Installation1197729
+Node: Gawk Distribution1198673
+Node: Getting1199157
+Node: Extracting1200120
+Node: Distribution contents1201758
+Node: Unix Installation1208238
+Node: Quick Installation1208920
+Node: Shell Startup Files1211334
+Node: Additional Configuration Options1212423
+Node: Configuration Philosophy1214738
+Node: Non-Unix Installation1217107
+Node: PC Installation1217567
+Node: PC Binary Installation1218405
+Node: PC Compiling1218840
+Node: PC Using1219957
+Node: Cygwin1223510
+Node: MSYS1224734
+Node: VMS Installation1225336
+Node: VMS Compilation1226127
+Ref: VMS Compilation-Footnote-11227356
+Node: VMS Dynamic Extensions1227414
+Node: VMS Installation Details1229099
+Node: VMS Running1231352
+Node: VMS GNV1235631
+Node: VMS Old Gawk1236366
+Node: Bugs1236837
+Node: Bug address1237500
+Node: Usenet1240482
+Node: Maintainers1241486
+Node: Other Versions1242671
+Node: Installation summary1249759
+Node: Notes1250968
+Node: Compatibility Mode1251762
+Node: Additions1252544
+Node: Accessing The Source1253469
+Node: Adding Code1254906
+Node: New Ports1261125
+Node: Derived Files1265500
+Ref: Derived Files-Footnote-11271160
+Ref: Derived Files-Footnote-21271195
+Ref: Derived Files-Footnote-31271793
+Node: Future Extensions1271907
+Node: Implementation Limitations1272565
+Node: Extension Design1273775
+Node: Old Extension Problems1274919
+Ref: Old Extension Problems-Footnote-11276437
+Node: Extension New Mechanism Goals1276494
+Ref: Extension New Mechanism Goals-Footnote-11279858
+Node: Extension Other Design Decisions1280047
+Node: Extension Future Growth1282160
+Node: Notes summary1282766
+Node: Basic Concepts1283924
+Node: Basic High Level1284605
+Ref: figure-general-flow1284887
+Ref: figure-process-flow1285572
+Ref: Basic High Level-Footnote-11288873
+Node: Basic Data Typing1289058
+Node: Glossary1292386
+Node: Copying1324271
+Node: GNU Free Documentation License1361814
+Node: Index1386934
 
 End Tag Table
 
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 0a6d13c..86f334c 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -935,6 +935,7 @@ particular records in a file and perform operations upon 
them.
 * Extension API Functions Introduction:: Introduction to the API functions.
 * General Data Types::                  The data types.
 * Memory Allocation Functions::         Functions for allocating memory.
+* API Ownership of MPFR and GMP Values:: Managing MPFR and GMP Values.
 * Constructor Functions::               Functions for creating values.
 * Registration Functions::              Functions to register things with
                                         @command{gawk}.
@@ -34245,6 +34246,7 @@ This (rather large) @value{SECTION} describes the API 
in detail.
 * General Data Types::                   The data types.
 * Memory Allocation Functions::          Functions for allocating memory.
 * Constructor Functions::                Functions for creating values.
+* API Ownership of MPFR and GMP Values:: Managing MPFR and GMP Values.
 * Registration Functions::               Functions to register things with
                                          @command{gawk}.
 * Printing Messages::                    Functions for printing messages.
@@ -34388,11 +34390,20 @@ does not support this keyword, you should either place
 @item
 All pointers filled in by @command{gawk} point to memory
 managed by @command{gawk} and should be treated by the extension as
-read-only.  Memory for @emph{all} strings passed into @command{gawk}
+read-only.
+
+Memory for @emph{all} strings passed into @command{gawk}
 from the extension @emph{must} come from calling one of
 @code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()},
 and is managed by @command{gawk} from then on.
 
+Memory for MPFR/GMP values that come from @command{gawk}
+should also be treated as read-only.  However, unlike strings,
+memory for MPFR/GMP values allocated by an extension and passed
+into @command{gawk} is @emph{copied} by @command{gawk}; the extension
+should then free the values itself to avoid memory leaks. This is
+discussed further in @strong{FIXME}.
+
 @item
 The API defines several simple @code{struct}s that map values as seen
 from @command{awk}.  A value can be a @code{double}, a string, or an
@@ -34560,7 +34571,7 @@ in data received from @command{gawk}. In addition, by 
examining the
 member is either a GMP integer (type @code{mpz_ptr}), or an MPFR
 floating-point value (type @code{mpfr_ptr_t}), and cast it appropriately.
 
-@quotation CAUTION:
+@quotation CAUTION
 Any MPFR or MPZ values that you create and pass to @command{gawk}
 to save are @emph{copied}. This means you are responsible to release
 the storage once you're done with it. See the sample @code{intdiv}
@@ -34816,14 +34827,11 @@ pointed to by @code{result}.
 This function creates a GMP number value in @code{result}.
 The @code{mpz} must be from a call to @code{get_mpz_ptr()}
 (and thus be of real underlying type @code{mpz_ptr}).
-@command{gawk} takes ownership of this memory.
 
 @item static inline awk_value_t *
 @itemx make_number_mpfr(void *mpfr, awk_value_t *result);
 This function creates an MPFR number value in @code{result}.
 The @code{mpfr} must be from a call to @code{get_mpfr_ptr()}.
-(and thus be of real underlying type @code{mpfr_ptr})
-@command{gawk} takes ownership of this memory.
 
 @item static inline awk_value_t *
 @itemx make_const_user_input(const char *string, size_t length, awk_value_t 
*result);
@@ -34851,6 +34859,48 @@ to be a @samp{char *} value pointing to data 
previously obtained from
 
 @end table
 
+@node API Ownership of MPFR and GMP Values
+@subsection Managing MPFR and GMP Values
+@cindex MPFR values, API ownership of
+@cindex GMP values, API ownership of
+@cindex API, ownership of MPFR and GMP values
+
+MPFR and GMP values are different from string values, where you can
+``take ownership'' of the value simply by assigning pointers. For example:
+
+@example
+char *p = gawk_malloc(42);      p @ii{``owns'' the memory}
+char *q = p;
+p = NULL;                       @ii{now} q @ii{``owns'' it}
+@end example
+
+MPFR and GMP objects are indeed allocated on the stack or dynamically,
+but the MPFR and GMP libraries treat these objects as values, the same way that
+you would pass an @code{int} or a @code{double} by value.  There is no
+way to ``transfer ownership'' of MPFR and GMP objects.  Thus, code in
+an extension should look like this:
+
+@example
+part1 = get_mpz_ptr();                  @ii{have} gawk @ii{allocate a GMP 
value}
+part2 = get_mpz_ptr();
+answer = get_mpz_ptr();
+
+mpz_set_si(part1, 21);                  @ii{do some computations}
+mpz_set_si(part2, 21);
+mpz_add(answer, part1, part2);
+@dots{}
+// assume that result is a parameter of type (awk_value_t *).
+make_number_mpz(answer, & result);      @ii{set it with final GMP value}
+
+mpz_clear(part1);                       @ii{release intermediate values}
+gawk_free(part1);                       @ii{and free memory}
+
+mpz_clear(part2);
+gawk_free(part2);
+
+return result;
+@end example
+
 @node Registration Functions
 @subsection Registration Functions
 @cindex register loadable extension
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 8cd1efe..b06226d 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -930,6 +930,7 @@ particular records in a file and perform operations upon 
them.
 * Extension API Functions Introduction:: Introduction to the API functions.
 * General Data Types::                  The data types.
 * Memory Allocation Functions::         Functions for allocating memory.
+* API Ownership of MPFR and GMP Values:: Managing MPFR and GMP Values.
 * Constructor Functions::               Functions for creating values.
 * Registration Functions::              Functions to register things with
                                         @command{gawk}.
@@ -33216,6 +33217,7 @@ This (rather large) @value{SECTION} describes the API 
in detail.
 * General Data Types::                   The data types.
 * Memory Allocation Functions::          Functions for allocating memory.
 * Constructor Functions::                Functions for creating values.
+* API Ownership of MPFR and GMP Values:: Managing MPFR and GMP Values.
 * Registration Functions::               Functions to register things with
                                          @command{gawk}.
 * Printing Messages::                    Functions for printing messages.
@@ -33359,11 +33361,20 @@ does not support this keyword, you should either place
 @item
 All pointers filled in by @command{gawk} point to memory
 managed by @command{gawk} and should be treated by the extension as
-read-only.  Memory for @emph{all} strings passed into @command{gawk}
+read-only.
+
+Memory for @emph{all} strings passed into @command{gawk}
 from the extension @emph{must} come from calling one of
 @code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()},
 and is managed by @command{gawk} from then on.
 
+Memory for MPFR/GMP values that come from @command{gawk}
+should also be treated as read-only.  However, unlike strings,
+memory for MPFR/GMP values allocated by an extension and passed
+into @command{gawk} is @emph{copied} by @command{gawk}; the extension
+should then free the values itself to avoid memory leaks. This is
+discussed further in @strong{FIXME}.
+
 @item
 The API defines several simple @code{struct}s that map values as seen
 from @command{awk}.  A value can be a @code{double}, a string, or an
@@ -33531,7 +33542,7 @@ in data received from @command{gawk}. In addition, by 
examining the
 member is either a GMP integer (type @code{mpz_ptr}), or an MPFR
 floating-point value (type @code{mpfr_ptr_t}), and cast it appropriately.
 
-@quotation CAUTION:
+@quotation CAUTION
 Any MPFR or MPZ values that you create and pass to @command{gawk}
 to save are @emph{copied}. This means you are responsible to release
 the storage once you're done with it. See the sample @code{intdiv}
@@ -33787,14 +33798,11 @@ pointed to by @code{result}.
 This function creates a GMP number value in @code{result}.
 The @code{mpz} must be from a call to @code{get_mpz_ptr()}
 (and thus be of real underlying type @code{mpz_ptr}).
-@command{gawk} takes ownership of this memory.
 
 @item static inline awk_value_t *
 @itemx make_number_mpfr(void *mpfr, awk_value_t *result);
 This function creates an MPFR number value in @code{result}.
 The @code{mpfr} must be from a call to @code{get_mpfr_ptr()}.
-(and thus be of real underlying type @code{mpfr_ptr})
-@command{gawk} takes ownership of this memory.
 
 @item static inline awk_value_t *
 @itemx make_const_user_input(const char *string, size_t length, awk_value_t 
*result);
@@ -33822,6 +33830,48 @@ to be a @samp{char *} value pointing to data 
previously obtained from
 
 @end table
 
+@node API Ownership of MPFR and GMP Values
+@subsection Managing MPFR and GMP Values
+@cindex MPFR values, API ownership of
+@cindex GMP values, API ownership of
+@cindex API, ownership of MPFR and GMP values
+
+MPFR and GMP values are different from string values, where you can
+``take ownership'' of the value simply by assigning pointers. For example:
+
+@example
+char *p = gawk_malloc(42);      p @ii{``owns'' the memory}
+char *q = p;
+p = NULL;                       @ii{now} q @ii{``owns'' it}
+@end example
+
+MPFR and GMP objects are indeed allocated on the stack or dynamically,
+but the MPFR and GMP libraries treat these objects as values, the same way that
+you would pass an @code{int} or a @code{double} by value.  There is no
+way to ``transfer ownership'' of MPFR and GMP objects.  Thus, code in
+an extension should look like this:
+
+@example
+part1 = get_mpz_ptr();                  @ii{have} gawk @ii{allocate a GMP 
value}
+part2 = get_mpz_ptr();
+answer = get_mpz_ptr();
+
+mpz_set_si(part1, 21);                  @ii{do some computations}
+mpz_set_si(part2, 21);
+mpz_add(answer, part1, part2);
+@dots{}
+// assume that result is a parameter of type (awk_value_t *).
+make_number_mpz(answer, & result);      @ii{set it with final GMP value}
+
+mpz_clear(part1);                       @ii{release intermediate values}
+gawk_free(part1);                       @ii{and free memory}
+
+mpz_clear(part2);
+gawk_free(part2);
+
+return result;
+@end example
+
 @node Registration Functions
 @subsection Registration Functions
 @cindex register loadable extension
diff --git a/gawkapi.c b/gawkapi.c
index 8c3788e..3dd4b4e 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -25,14 +25,6 @@
 
 #include "awk.h"
 
-#ifdef HAVE_MPFR
-#define getmpfr(n)     getblock(n, BLOCK_MPFR, mpfr_ptr)
-#define freempfr(n)    freeblock(n, BLOCK_MPFR)
-
-#define getmpz(n)      getblock(n, BLOCK_MPZ, mpz_ptr)
-#define freempz(n)     freeblock(n, BLOCK_MPZ)
-#endif
-
 /* Declare some globals used by api_get_file: */
 extern IOBUF *curfile;
 extern INSTRUCTION *main_beginfile;
@@ -1310,7 +1302,7 @@ api_get_mpfr(awk_ext_id_t id)
 {
 #ifdef HAVE_MPFR
        mpfr_ptr p;
-       getmpfr(p);
+       emalloc(p, mpfr_ptr, sizeof(mpfr_t), "api_get_mpfr");
        mpfr_init(p);
        return p;
 #else
@@ -1326,7 +1318,8 @@ api_get_mpz(awk_ext_id_t id)
 {
 #ifdef HAVE_MPFR
        mpz_ptr p;
-       getmpz(p);
+       emalloc(p, mpz_ptr, sizeof (mpz_t), "api_get_mpz");
+
        mpz_init(p);
        return p;
 #else
diff --git a/gawkapi.h b/gawkapi.h
index 0876d61..a300fc9 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -329,6 +329,13 @@ enum AWK_NUMBER_TYPE {
        AWK_NUMBER_TYPE_MPZ
 };
 
+/*
+ * When type is AWK_NUMBER_MPFR or AWK_NUMBER_MPZ, the memory pointed to
+ * by the ptr member belongs to gawk if it came from gawk.  Otherwise the
+ * memory belongs to the extension and gawk copies it when its received.
+ * See the manual for further discussion.
+ */
+
 typedef struct awk_number {
        double d;       /* always populated in data received from gawk */
        enum AWK_NUMBER_TYPE type;
@@ -1035,8 +1042,7 @@ make_number(double num, awk_value_t *result)
 
 /*
  * make_number_mpz --- make an mpz number value in result.
- * The mpz_ptr must be from a call to get_mpz_ptr. Gawk will now
- * take ownership of this memory.
+ * The mpz_ptr must be from a call to get_mpz_ptr.
  */
 
 static inline awk_value_t *
@@ -1050,8 +1056,7 @@ make_number_mpz(void *mpz_ptr, awk_value_t *result)
 
 /*
  * make_number_mpfr --- make an mpfr number value in result.
- * The mpfr_ptr must be from a call to get_mpfr_ptr. Gawk will now
- * take ownership of this memory.
+ * The mpfr_ptr must be from a call to get_mpfr_ptr.
  */
 
 static inline awk_value_t *
diff --git a/node.c b/node.c
index ecb9ad0..24b7ac5 100644
--- a/node.c
+++ b/node.c
@@ -1024,10 +1024,6 @@ void init_btowc_cache()
 struct block_header nextfree[BLOCK_MAX] = {
        { NULL, sizeof(NODE), "node" },
        { NULL, sizeof(BUCKET), "bucket" },
-#ifdef HAVE_MPFR
-       { NULL, sizeof(mpfr_t), "mpfr" },
-       { NULL, sizeof(mpz_t), "mpz" },
-#endif
 };
 
 #ifdef MEMDEBUG

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

Summary of changes:
 ChangeLog       |   13 +
 NEWS            |    4 +
 awk.h           |    2 -
 doc/ChangeLog   |    5 +
 doc/gawk.info   | 1318 +++++++++++++++++++++++++++++--------------------------
 doc/gawk.texi   |   60 ++-
 doc/gawktexi.in |   60 ++-
 gawkapi.c       |   13 +-
 gawkapi.h       |   13 +-
 node.c          |    4 -
 10 files changed, 830 insertions(+), 662 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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