summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2019-01-08 21:20:17 +0200
committerArnold D. Robbins <arnold@skeeve.com>2019-01-08 21:20:17 +0200
commit995f235bdaa3a2b44d3e920f81a9f76373c56f58 (patch)
tree730670024001f2dbc010fa5c43c2dad2ad09bd13
parent66c1625cc8cec979cfe265daaa2b55e29b956f83 (diff)
parent0e1fd064f13b220a129fc720607d3f62b55b3b19 (diff)
downloadgawk-feature/namespaces.tar.gz
Merge branch 'master' into feature/namespacesfeature/namespaces
-rwxr-xr-xChangeLog43
-rw-r--r--array.c34
-rw-r--r--awk.h52
-rw-r--r--cint_array.c9
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/gawk.info472
-rw-r--r--doc/gawk.texi33
-rw-r--r--doc/gawktexi.in33
-rw-r--r--int_array.c3
-rw-r--r--interpret.h5
-rw-r--r--str_array.c10
11 files changed, 405 insertions, 294 deletions
diff --git a/ChangeLog b/ChangeLog
index 915b3653..fe93c531 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,46 @@
+2019-01-08 Arnold D. Robbins <arnold@skeeve.com>
+
+ * interpret.h (r_interpret): For a translatable string, only copy
+ the gettext return value if it's different from the original.
+ Otherwise, use the original.
+
+2019-01-07 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ Use a struct instead of an array to contain the array methods
+ for improved code clarity and flexibility.
+
+ * awk.h (array_funcs_t): Define new struct to contain the array
+ methods.
+ (NODE): Change type of array_funcs (sub.nodep.l.lp) from `afunc_t *'
+ to `const array_funcs_t *' (from a pointer to an array of function
+ methods to a pointer to a struct containing the methods).
+ (a*_ind): Remove obsolete method array index defines.
+ (a*): Redefine array methods to use struct members instead of
+ array elements.
+ (str_array_func, cint_array_func, int_array_func): Change type
+ from array of afunc_t to 'const array_funcs_t'.
+ (register_array_func): Remove global declaration, since this function
+ is called only inside array.c.
+ * array.c (null_array_func): Change from array of methods to a struct.
+ (array_types): Now an array of pointers to array_funcs_t.
+ (AFUNC): Remove obsolete macro.
+ (register_array_func): Change scope to static, and change argument
+ to a pointer to array_funcs_t instead of a pointer to an array of
+ methods.
+ (array_init): Modify calls to register_array_func to pass the address
+ of the new array method structs.
+ (make_array): Set array_funcs to & null_array_func.
+ (null_lookup): Modify to use new array method structs.
+ (assoc_list): Update cint check to use & cint_array_func.
+ * str_array.c (str_array_func, env_array_func): Change from array of
+ methods to an array_funcs_t struct.
+ (env_clear, init_env_array): Set array_funcs to & env_array_func.
+ * int_array.c (int_array_func): Change from array of methods to an
+ array_funcs_t struct.
+ * cint_array.c (cint_array_func): Ditto.
+ (cint_lookup): When setting xn->array_funcs, must now use &.
+ (cint_dump): Compare xn->array_funcs to & int_array_func.
+
2019-01-06 Andrew J. Schorr <aschorr@telemetry-investments.com>
* array.c (do_delete): If the array is now empty, reset it to the
diff --git a/array.c b/array.c
index ad2f58fc..34b7076a 100644
--- a/array.c
+++ b/array.c
@@ -37,7 +37,8 @@ static char indent_char[] = " ";
static NODE **null_lookup(NODE *symbol, NODE *subs);
static NODE **null_dump(NODE *symbol, NODE *subs);
-static afunc_t null_array_func[] = {
+static const array_funcs_t null_array_func = {
+ "null",
(afunc_t) 0,
(afunc_t) 0,
null_lookup,
@@ -52,23 +53,20 @@ static afunc_t null_array_func[] = {
#define MAX_ATYPE 10
-static afunc_t *array_types[MAX_ATYPE];
+static const array_funcs_t *array_types[MAX_ATYPE];
static int num_array_types = 0;
-/* array func to index mapping */
-#define AFUNC(F) (F ## _ind)
-
/* register_array_func --- add routines to handle arrays */
-int
-register_array_func(afunc_t *afunc)
+static int
+register_array_func(const array_funcs_t *afunc)
{
if (afunc && num_array_types < MAX_ATYPE) {
- if (afunc != str_array_func && ! afunc[AFUNC(atypeof)])
+ if (afunc != & str_array_func && afunc->type_of == NULL)
return false;
array_types[num_array_types++] = afunc;
- if (afunc[AFUNC(ainit)]) /* execute init routine if any */
- (void) (*afunc[AFUNC(ainit)])(NULL, NULL);
+ if (afunc->init) /* execute init routine if any */
+ (void) (*afunc->init)(NULL, NULL);
return true;
}
return false;
@@ -80,10 +78,10 @@ register_array_func(afunc_t *afunc)
void
array_init()
{
- (void) register_array_func(str_array_func); /* the default */
+ (void) register_array_func(& str_array_func); /* the default */
if (! do_mpfr) {
- (void) register_array_func(int_array_func);
- (void) register_array_func(cint_array_func);
+ (void) register_array_func(& int_array_func);
+ (void) register_array_func(& cint_array_func);
}
}
@@ -97,7 +95,7 @@ make_array()
getnode(array);
memset(array, '\0', sizeof(NODE));
array->type = Node_var_array;
- array->array_funcs = null_array_func;
+ array->array_funcs = & null_array_func;
/* vname, flags, and parent_array not set here */
return array;
@@ -110,7 +108,7 @@ void
null_array(NODE *symbol)
{
symbol->type = Node_var_array;
- symbol->array_funcs = null_array_func;
+ symbol->array_funcs = & null_array_func;
symbol->buckets = NULL;
symbol->table_size = symbol->array_size = 0;
symbol->array_capacity = 0;
@@ -128,7 +126,7 @@ static NODE **
null_lookup(NODE *symbol, NODE *subs)
{
int i;
- afunc_t *afunc = NULL;
+ const array_funcs_t *afunc = NULL;
assert(symbol->table_size == 0);
@@ -138,7 +136,7 @@ null_lookup(NODE *symbol, NODE *subs)
*/
for (i = num_array_types - 1; i >= 1; i--) {
afunc = array_types[i];
- if (afunc[AFUNC(atypeof)](symbol, subs) != NULL)
+ if (afunc->type_of(symbol, subs) != NULL)
break;
}
if (i == 0 || afunc == NULL)
@@ -1298,7 +1296,7 @@ assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt)
cmp_func = sort_funcs[qi].comp_func;
assoc_kind = sort_funcs[qi].kind;
- if (symbol->array_funcs != cint_array_func)
+ if (symbol->array_funcs != & cint_array_func)
assoc_kind &= ~(AASC|ADESC);
if (sort_ctxt != SORTED_IN || (assoc_kind & AVALUE) != 0) {
diff --git a/awk.h b/awk.h
index 0ee75a3f..5db44989 100644
--- a/awk.h
+++ b/awk.h
@@ -320,6 +320,19 @@ struct exp_instruction;
typedef int (*Func_print)(FILE *, const char *, ...);
typedef struct exp_node **(*afunc_t)(struct exp_node *, struct exp_node *);
+typedef struct {
+ const char *name;
+ afunc_t init;
+ afunc_t type_of; /* avoid reserved word typeof */
+ afunc_t lookup;
+ afunc_t exists;
+ afunc_t clear;
+ afunc_t remove;
+ afunc_t list;
+ afunc_t copy;
+ afunc_t dump;
+ afunc_t store;
+} array_funcs_t;
/*
* NOTE - this struct is a rather kludgey -- it is packed to minimize
@@ -332,7 +345,7 @@ typedef struct exp_node {
struct exp_node *lptr;
struct exp_instruction *li;
long ll;
- afunc_t *lp;
+ const array_funcs_t *lp;
} l;
union {
struct exp_node *rptr;
@@ -540,26 +553,16 @@ typedef struct exp_node {
#define xarray sub.nodep.rn
#define parent_array sub.nodep.x.extra
-#define ainit_ind 0
-#define ainit array_funcs[ainit_ind]
-#define atypeof_ind 1
-#define atypeof array_funcs[atypeof_ind]
-#define alookup_ind 2
-#define alookup array_funcs[alookup_ind]
-#define aexists_ind 3
-#define aexists array_funcs[aexists_ind]
-#define aclear_ind 4
-#define aclear array_funcs[aclear_ind]
-#define aremove_ind 5
-#define aremove array_funcs[aremove_ind]
-#define alist_ind 6
-#define alist array_funcs[alist_ind]
-#define acopy_ind 7
-#define acopy array_funcs[acopy_ind]
-#define adump_ind 8
-#define adump array_funcs[adump_ind]
-#define astore_ind 9
-#define astore array_funcs[astore_ind]
+#define ainit array_funcs->init
+#define atypeof array_funcs->type_of
+#define alookup array_funcs->lookup
+#define aexists array_funcs->exists
+#define aclear array_funcs->clear
+#define aremove array_funcs->remove
+#define alist array_funcs->list
+#define acopy array_funcs->copy
+#define adump array_funcs->dump
+#define astore array_funcs->store
/* Node_array_ref: */
#define orig_array lnode
@@ -1119,9 +1122,9 @@ extern NODE *(*format_val)(const char *, int, NODE *);
extern int (*cmp_numbers)(const NODE *, const NODE *);
/* built-in array types */
-extern afunc_t str_array_func[];
-extern afunc_t cint_array_func[];
-extern afunc_t int_array_func[];
+extern const array_funcs_t str_array_func;
+extern const array_funcs_t cint_array_func;
+extern const array_funcs_t int_array_func;
/* special node used to indicate success in array routines (not NULL) */
extern NODE *success_node;
@@ -1381,7 +1384,6 @@ extern NODE *force_array(NODE *symbol, bool canfatal);
extern const char *make_aname(const NODE *symbol);
extern const char *array_vname(const NODE *symbol);
extern void array_init(void);
-extern int register_array_func(afunc_t *afunc);
extern NODE **null_afunc(NODE *symbol, NODE *subs);
extern void set_SUBSEP(void);
extern NODE *concat_exp(int nargs, bool do_subsep);
diff --git a/cint_array.c b/cint_array.c
index 7db45fd2..497bd792 100644
--- a/cint_array.c
+++ b/cint_array.c
@@ -59,7 +59,8 @@ static NODE **cint_dump(NODE *symbol, NODE *ndump);
static void cint_print(NODE *symbol);
#endif
-afunc_t cint_array_func[] = {
+const array_funcs_t cint_array_func = {
+ "cint",
cint_array_init,
is_uinteger,
cint_lookup,
@@ -255,9 +256,9 @@ xinstall:
*/
if (is_integer(xn, subs))
- xn->array_funcs = int_array_func;
+ xn->array_funcs = & int_array_func;
else
- xn->array_funcs = str_array_func;
+ xn->array_funcs = & str_array_func;
xn->flags |= XARRAY;
}
return xn->alookup(xn, subs);
@@ -525,7 +526,7 @@ cint_dump(NODE *symbol, NODE *ndump)
kb += (INT32_BIT * sizeof(NODE *)) / 1024.0; /* symbol->nodes */
kb += (symbol->array_capacity * sizeof(NODE *)) / 1024.0; /* value nodes in Node_array_leaf(s) */
if (xn != NULL) {
- if (xn->array_funcs == int_array_func)
+ if (xn->array_funcs == & int_array_func)
kb += int_kilobytes(xn);
else
kb += str_kilobytes(xn);
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 83d5d9e6..6374f6d8 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-08 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (I18N Example): Add more explanation of how to
+ make the directory to hold the .mo file.
+
2019-01-04 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Indexing fixes and small corrections.
diff --git a/doc/gawk.info b/doc/gawk.info
index bd88011e..1e318a4f 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -21547,19 +21547,33 @@ Following are the translations:
msgstr "Like, the scoop is"
+ NOTE: The following instructions apply to GNU/Linux with the GNU C
+ Library. Be aware that the actual steps may change over time, that
+ the following description may not be accurate for all GNU/Linux
+ distributions, and that things may work entirely differently on
+ other operating systems.
+
The next step is to make the directory to hold the binary message
-object file and then to create the 'guide.mo' file. We pretend that our
-file is to be used in the 'en_US.UTF-8' locale, because we have to use a
-locale name known to the C 'gettext' routines. The directory layout
-shown here is standard for GNU 'gettext' on GNU/Linux systems. Other
-versions of 'gettext' may use a different layout:
+object file and then to create the 'guide.mo' file. The directory has
+the form 'LOCALE/LC_MESSAGES', where LOCALE is a locale name known to
+the C 'gettext' routines.
+
+ How do we know which locale to use? It turns out that there are
+three different environment variables used by the C 'gettext' routines.
+In order, they are '$LANGUAGE', '$LC_ALL', and '$LANG'.(2) Thus, we
+check the value of '$LANGUAGE':
+
+ $ echo $LANGUAGE
+ -| en_US.UTF-8
+
+We next make the directories:
$ mkdir en_US.UTF-8 en_US.UTF-8/LC_MESSAGES
- The 'msgfmt' utility does the conversion from human-readable '.po'
-file to machine-readable '.mo' file. By default, 'msgfmt' creates a
-file named 'messages'. This file must be renamed and placed in the
-proper directory (using the '-o' option) so that 'gawk' can find it:
+ The 'msgfmt' utility converts the human-readable '.po' file into a
+machine-readable '.mo' file. By default, 'msgfmt' creates a file named
+'messages'. This file must be renamed and placed in the proper
+directory (using the '-o' option) so that 'gawk' can find it:
$ msgfmt guide-mellow.po -o en_US.UTF-8/LC_MESSAGES/guide.mo
@@ -21583,6 +21597,9 @@ and 'bindtextdomain()' (*note I18N Portability::) are in a file named
(1) Perhaps it would be better if it were called "Hippy." Ah, well.
+ (2) Well, sort of. It seems that if '$LC_ALL' is set to 'C', then no
+translations are done. Go figure.
+

File: gawk.info, Node: Gawk I18N, Next: I18N Summary, Prev: I18N Example, Up: Internationalization
@@ -33626,10 +33643,10 @@ Index
* .gmo files: Explaining gettext. (line 42)
* .gmo files, specifying directory of: Explaining gettext. (line 54)
* .gmo files, specifying directory of <1>: Programmer i18n. (line 48)
-* .mo files, converting from .po: I18N Example. (line 66)
+* .mo files, converting from .po: I18N Example. (line 80)
* .po files: Explaining gettext. (line 37)
* .po files <1>: Translator i18n. (line 6)
-* .po files, converting to .mo: I18N Example. (line 66)
+* .po files, converting to .mo: I18N Example. (line 80)
* .pot files: Explaining gettext. (line 31)
* / (forward slash) to enclose regular expressions: Regexp. (line 10)
* / (forward slash), / operator: Precedence. (line 54)
@@ -34929,10 +34946,10 @@ Index
* files, .gmo: Explaining gettext. (line 42)
* files, .gmo, specifying directory of: Explaining gettext. (line 54)
* files, .gmo, specifying directory of <1>: Programmer i18n. (line 48)
-* files, .mo, converting from .po: I18N Example. (line 66)
+* files, .mo, converting from .po: I18N Example. (line 80)
* files, .po: Explaining gettext. (line 37)
* files, .po <1>: Translator i18n. (line 6)
-* files, .po, converting to .mo: I18N Example. (line 66)
+* files, .po, converting to .mo: I18N Example. (line 80)
* files, .pot: Explaining gettext. (line 31)
* files, /dev/... special files: Special FD. (line 48)
* files, /inet/... (gawk): TCP/IP Networking. (line 6)
@@ -34952,7 +34969,7 @@ Index
* files, managing, data file boundaries: Filetrans Function. (line 6)
* files, message object: Explaining gettext. (line 42)
* files, message object, converting from portable object files: I18N Example.
- (line 66)
+ (line 80)
* files, message object, specifying directory of: Explaining gettext.
(line 54)
* files, message object, specifying directory of <1>: Programmer i18n.
@@ -34966,7 +34983,7 @@ Index
* files, portable object <1>: Translator i18n. (line 6)
* files, portable object template: Explaining gettext. (line 31)
* files, portable object, converting to message object files: I18N Example.
- (line 66)
+ (line 80)
* files, portable object, generating: Options. (line 169)
* files, processing, ARGIND variable and: Auto-set. (line 50)
* files, reading: Rewind Function. (line 6)
@@ -35594,7 +35611,7 @@ Index
(line 6)
* message object files: Explaining gettext. (line 42)
* message object files, converting from portable object files: I18N Example.
- (line 66)
+ (line 80)
* message object files, specifying directory of: Explaining gettext.
(line 54)
* message object files, specifying directory of <1>: Programmer i18n.
@@ -35610,7 +35627,7 @@ Index
* Moore, Duncan: Getline Notes. (line 40)
* MPFR, checking availability of: Checking for MPFR. (line 6)
* MPFR, checking for: Checking for MPFR. (line 6)
-* msgfmt utility: I18N Example. (line 66)
+* msgfmt utility: I18N Example. (line 80)
* multiple precision: Arbitrary Precision Arithmetic.
(line 6)
* multiple-line records: Multiple Line. (line 6)
@@ -35884,7 +35901,7 @@ Index
* portable object files: Explaining gettext. (line 37)
* portable object files <1>: Translator i18n. (line 6)
* portable object files, converting to message object files: I18N Example.
- (line 66)
+ (line 80)
* portable object files, generating: Options. (line 169)
* portable object template files: Explaining gettext. (line 31)
* porting gawk: New Ports. (line 6)
@@ -37106,214 +37123,215 @@ Ref: Printf Ordering-Footnote-1870721
Node: I18N Portability870785
Ref: I18N Portability-Footnote-1873241
Node: I18N Example873304
-Ref: I18N Example-Footnote-1876110
-Node: Gawk I18N876183
-Node: I18N Summary876828
-Node: Debugger878169
-Node: Debugging879169
-Node: Debugging Concepts879610
-Node: Debugging Terms881419
-Node: Awk Debugging883994
-Ref: Awk Debugging-Footnote-1884939
-Node: Sample Debugging Session885071
-Node: Debugger Invocation885605
-Node: Finding The Bug886991
-Node: List of Debugger Commands893465
-Node: Breakpoint Control894798
-Node: Debugger Execution Control898492
-Node: Viewing And Changing Data901854
-Node: Execution Stack905228
-Node: Debugger Info906865
-Node: Miscellaneous Debugger Commands910936
-Node: Readline Support915998
-Node: Limitations916894
-Node: Debugging Summary919003
-Node: Namespaces920282
-Node: Global Namespace921100
-Node: Qualified Names922498
-Node: Default Namespace923497
-Node: Changing The Namespace924238
-Node: Naming Rules925852
-Node: Internal Name Management927700
-Node: Namespace Example928742
-Node: Namespace And Features931304
-Node: Namespace Summary932739
-Node: Arbitrary Precision Arithmetic934216
-Node: Computer Arithmetic935703
-Ref: table-numeric-ranges939469
-Ref: table-floating-point-ranges939962
-Ref: Computer Arithmetic-Footnote-1940620
-Node: Math Definitions940677
-Ref: table-ieee-formats943993
-Ref: Math Definitions-Footnote-1944596
-Node: MPFR features944701
-Node: FP Math Caution946419
-Ref: FP Math Caution-Footnote-1947491
-Node: Inexactness of computations947860
-Node: Inexact representation948820
-Node: Comparing FP Values950180
-Node: Errors accumulate951421
-Node: Getting Accuracy952854
-Node: Try To Round955564
-Node: Setting precision956463
-Ref: table-predefined-precision-strings957160
-Node: Setting the rounding mode958990
-Ref: table-gawk-rounding-modes959364
-Ref: Setting the rounding mode-Footnote-1963295
-Node: Arbitrary Precision Integers963474
-Ref: Arbitrary Precision Integers-Footnote-1966649
-Node: Checking for MPFR966798
-Node: POSIX Floating Point Problems968272
-Ref: POSIX Floating Point Problems-Footnote-1972557
-Node: Floating point summary972595
-Node: Dynamic Extensions974785
-Node: Extension Intro976338
-Node: Plugin License977604
-Node: Extension Mechanism Outline978401
-Ref: figure-load-extension978840
-Ref: figure-register-new-function980405
-Ref: figure-call-new-function981497
-Node: Extension API Description983559
-Node: Extension API Functions Introduction985201
-Ref: table-api-std-headers987037
-Node: General Data Types990902
-Ref: General Data Types-Footnote-1999263
-Node: Memory Allocation Functions999562
-Ref: Memory Allocation Functions-Footnote-11003772
-Node: Constructor Functions1003871
-Node: Registration Functions1007457
-Node: Extension Functions1008142
-Node: Exit Callback Functions1013464
-Node: Extension Version String1014714
-Node: Input Parsers1015377
-Node: Output Wrappers1028098
-Node: Two-way processors1032610
-Node: Printing Messages1034875
-Ref: Printing Messages-Footnote-11036046
-Node: Updating ERRNO1036199
-Node: Requesting Values1036938
-Ref: table-value-types-returned1037675
-Node: Accessing Parameters1038611
-Node: Symbol Table Access1039846
-Node: Symbol table by name1040358
-Ref: Symbol table by name-Footnote-11043382
-Node: Symbol table by cookie1043510
-Ref: Symbol table by cookie-Footnote-11047695
-Node: Cached values1047759
-Ref: Cached values-Footnote-11051295
-Node: Array Manipulation1051448
-Ref: Array Manipulation-Footnote-11052539
-Node: Array Data Types1052576
-Ref: Array Data Types-Footnote-11055234
-Node: Array Functions1055326
-Node: Flattening Arrays1059824
-Node: Creating Arrays1066800
-Node: Redirection API1071567
-Node: Extension API Variables1074400
-Node: Extension Versioning1075111
-Ref: gawk-api-version1075540
-Node: Extension GMP/MPFR Versioning1077271
-Node: Extension API Informational Variables1078899
-Node: Extension API Boilerplate1079972
-Node: Changes from API V11083946
-Node: Finding Extensions1085518
-Node: Extension Example1086077
-Node: Internal File Description1086875
-Node: Internal File Ops1090955
-Ref: Internal File Ops-Footnote-11102305
-Node: Using Internal File Ops1102445
-Ref: Using Internal File Ops-Footnote-11104828
-Node: Extension Samples1105102
-Node: Extension Sample File Functions1106631
-Node: Extension Sample Fnmatch1114280
-Node: Extension Sample Fork1115767
-Node: Extension Sample Inplace1116985
-Node: Extension Sample Ord1120289
-Node: Extension Sample Readdir1121125
-Ref: table-readdir-file-types1122014
-Node: Extension Sample Revout1122819
-Node: Extension Sample Rev2way1123408
-Node: Extension Sample Read write array1124148
-Node: Extension Sample Readfile1126090
-Node: Extension Sample Time1127185
-Node: Extension Sample API Tests1128533
-Node: gawkextlib1129025
-Node: Extension summary1131943
-Node: Extension Exercises1135645
-Node: Language History1136887
-Node: V7/SVR3.11138543
-Node: SVR41140695
-Node: POSIX1142129
-Node: BTL1143509
-Node: POSIX/GNU1144238
-Node: Feature History1150016
-Node: Common Extensions1166062
-Node: Ranges and Locales1167345
-Ref: Ranges and Locales-Footnote-11171961
-Ref: Ranges and Locales-Footnote-21171988
-Ref: Ranges and Locales-Footnote-31172223
-Node: Contributors1172444
-Node: History summary1178389
-Node: Installation1179769
-Node: Gawk Distribution1180713
-Node: Getting1181197
-Node: Extracting1182160
-Node: Distribution contents1183798
-Node: Unix Installation1190278
-Node: Quick Installation1190960
-Node: Shell Startup Files1193374
-Node: Additional Configuration Options1194463
-Node: Configuration Philosophy1196628
-Node: Non-Unix Installation1198997
-Node: PC Installation1199457
-Node: PC Binary Installation1200295
-Node: PC Compiling1200730
-Node: PC Using1201847
-Node: Cygwin1205400
-Node: MSYS1206499
-Node: VMS Installation1207000
-Node: VMS Compilation1207791
-Ref: VMS Compilation-Footnote-11209020
-Node: VMS Dynamic Extensions1209078
-Node: VMS Installation Details1210763
-Node: VMS Running1213016
-Node: VMS GNV1217295
-Node: VMS Old Gawk1218030
-Node: Bugs1218501
-Node: Bug address1219164
-Node: Usenet1222146
-Node: Maintainers1223150
-Node: Other Versions1224411
-Node: Installation summary1231325
-Node: Notes1232527
-Node: Compatibility Mode1233321
-Node: Additions1234103
-Node: Accessing The Source1235028
-Node: Adding Code1236465
-Node: New Ports1242684
-Node: Derived Files1247172
-Ref: Derived Files-Footnote-11252818
-Ref: Derived Files-Footnote-21252853
-Ref: Derived Files-Footnote-31253451
-Node: Future Extensions1253565
-Node: Implementation Limitations1254223
-Node: Extension Design1255406
-Node: Old Extension Problems1256550
-Ref: Old Extension Problems-Footnote-11258068
-Node: Extension New Mechanism Goals1258125
-Ref: Extension New Mechanism Goals-Footnote-11261489
-Node: Extension Other Design Decisions1261678
-Node: Extension Future Growth1263791
-Node: Notes summary1264627
-Node: Basic Concepts1265802
-Node: Basic High Level1266483
-Ref: figure-general-flow1266765
-Ref: figure-process-flow1267450
-Ref: Basic High Level-Footnote-11270751
-Node: Basic Data Typing1270936
-Node: Glossary1274264
-Node: Copying1306102
-Node: GNU Free Documentation License1343645
-Node: Index1368765
+Ref: I18N Example-Footnote-1876564
+Ref: I18N Example-Footnote-2876637
+Node: Gawk I18N876746
+Node: I18N Summary877391
+Node: Debugger878732
+Node: Debugging879732
+Node: Debugging Concepts880173
+Node: Debugging Terms881982
+Node: Awk Debugging884557
+Ref: Awk Debugging-Footnote-1885502
+Node: Sample Debugging Session885634
+Node: Debugger Invocation886168
+Node: Finding The Bug887554
+Node: List of Debugger Commands894028
+Node: Breakpoint Control895361
+Node: Debugger Execution Control899055
+Node: Viewing And Changing Data902417
+Node: Execution Stack905791
+Node: Debugger Info907428
+Node: Miscellaneous Debugger Commands911499
+Node: Readline Support916561
+Node: Limitations917457
+Node: Debugging Summary919566
+Node: Namespaces920845
+Node: Global Namespace921663
+Node: Qualified Names923061
+Node: Default Namespace924060
+Node: Changing The Namespace924801
+Node: Naming Rules926415
+Node: Internal Name Management928263
+Node: Namespace Example929305
+Node: Namespace And Features931867
+Node: Namespace Summary933302
+Node: Arbitrary Precision Arithmetic934779
+Node: Computer Arithmetic936266
+Ref: table-numeric-ranges940032
+Ref: table-floating-point-ranges940525
+Ref: Computer Arithmetic-Footnote-1941183
+Node: Math Definitions941240
+Ref: table-ieee-formats944556
+Ref: Math Definitions-Footnote-1945159
+Node: MPFR features945264
+Node: FP Math Caution946982
+Ref: FP Math Caution-Footnote-1948054
+Node: Inexactness of computations948423
+Node: Inexact representation949383
+Node: Comparing FP Values950743
+Node: Errors accumulate951984
+Node: Getting Accuracy953417
+Node: Try To Round956127
+Node: Setting precision957026
+Ref: table-predefined-precision-strings957723
+Node: Setting the rounding mode959553
+Ref: table-gawk-rounding-modes959927
+Ref: Setting the rounding mode-Footnote-1963858
+Node: Arbitrary Precision Integers964037
+Ref: Arbitrary Precision Integers-Footnote-1967212
+Node: Checking for MPFR967361
+Node: POSIX Floating Point Problems968835
+Ref: POSIX Floating Point Problems-Footnote-1973120
+Node: Floating point summary973158
+Node: Dynamic Extensions975348
+Node: Extension Intro976901
+Node: Plugin License978167
+Node: Extension Mechanism Outline978964
+Ref: figure-load-extension979403
+Ref: figure-register-new-function980968
+Ref: figure-call-new-function982060
+Node: Extension API Description984122
+Node: Extension API Functions Introduction985764
+Ref: table-api-std-headers987600
+Node: General Data Types991465
+Ref: General Data Types-Footnote-1999826
+Node: Memory Allocation Functions1000125
+Ref: Memory Allocation Functions-Footnote-11004335
+Node: Constructor Functions1004434
+Node: Registration Functions1008020
+Node: Extension Functions1008705
+Node: Exit Callback Functions1014027
+Node: Extension Version String1015277
+Node: Input Parsers1015940
+Node: Output Wrappers1028661
+Node: Two-way processors1033173
+Node: Printing Messages1035438
+Ref: Printing Messages-Footnote-11036609
+Node: Updating ERRNO1036762
+Node: Requesting Values1037501
+Ref: table-value-types-returned1038238
+Node: Accessing Parameters1039174
+Node: Symbol Table Access1040409
+Node: Symbol table by name1040921
+Ref: Symbol table by name-Footnote-11043945
+Node: Symbol table by cookie1044073
+Ref: Symbol table by cookie-Footnote-11048258
+Node: Cached values1048322
+Ref: Cached values-Footnote-11051858
+Node: Array Manipulation1052011
+Ref: Array Manipulation-Footnote-11053102
+Node: Array Data Types1053139
+Ref: Array Data Types-Footnote-11055797
+Node: Array Functions1055889
+Node: Flattening Arrays1060387
+Node: Creating Arrays1067363
+Node: Redirection API1072130
+Node: Extension API Variables1074963
+Node: Extension Versioning1075674
+Ref: gawk-api-version1076103
+Node: Extension GMP/MPFR Versioning1077834
+Node: Extension API Informational Variables1079462
+Node: Extension API Boilerplate1080535
+Node: Changes from API V11084509
+Node: Finding Extensions1086081
+Node: Extension Example1086640
+Node: Internal File Description1087438
+Node: Internal File Ops1091518
+Ref: Internal File Ops-Footnote-11102868
+Node: Using Internal File Ops1103008
+Ref: Using Internal File Ops-Footnote-11105391
+Node: Extension Samples1105665
+Node: Extension Sample File Functions1107194
+Node: Extension Sample Fnmatch1114843
+Node: Extension Sample Fork1116330
+Node: Extension Sample Inplace1117548
+Node: Extension Sample Ord1120852
+Node: Extension Sample Readdir1121688
+Ref: table-readdir-file-types1122577
+Node: Extension Sample Revout1123382
+Node: Extension Sample Rev2way1123971
+Node: Extension Sample Read write array1124711
+Node: Extension Sample Readfile1126653
+Node: Extension Sample Time1127748
+Node: Extension Sample API Tests1129096
+Node: gawkextlib1129588
+Node: Extension summary1132506
+Node: Extension Exercises1136208
+Node: Language History1137450
+Node: V7/SVR3.11139106
+Node: SVR41141258
+Node: POSIX1142692
+Node: BTL1144072
+Node: POSIX/GNU1144801
+Node: Feature History1150579
+Node: Common Extensions1166625
+Node: Ranges and Locales1167908
+Ref: Ranges and Locales-Footnote-11172524
+Ref: Ranges and Locales-Footnote-21172551
+Ref: Ranges and Locales-Footnote-31172786
+Node: Contributors1173007
+Node: History summary1178952
+Node: Installation1180332
+Node: Gawk Distribution1181276
+Node: Getting1181760
+Node: Extracting1182723
+Node: Distribution contents1184361
+Node: Unix Installation1190841
+Node: Quick Installation1191523
+Node: Shell Startup Files1193937
+Node: Additional Configuration Options1195026
+Node: Configuration Philosophy1197191
+Node: Non-Unix Installation1199560
+Node: PC Installation1200020
+Node: PC Binary Installation1200858
+Node: PC Compiling1201293
+Node: PC Using1202410
+Node: Cygwin1205963
+Node: MSYS1207062
+Node: VMS Installation1207563
+Node: VMS Compilation1208354
+Ref: VMS Compilation-Footnote-11209583
+Node: VMS Dynamic Extensions1209641
+Node: VMS Installation Details1211326
+Node: VMS Running1213579
+Node: VMS GNV1217858
+Node: VMS Old Gawk1218593
+Node: Bugs1219064
+Node: Bug address1219727
+Node: Usenet1222709
+Node: Maintainers1223713
+Node: Other Versions1224974
+Node: Installation summary1231888
+Node: Notes1233090
+Node: Compatibility Mode1233884
+Node: Additions1234666
+Node: Accessing The Source1235591
+Node: Adding Code1237028
+Node: New Ports1243247
+Node: Derived Files1247735
+Ref: Derived Files-Footnote-11253381
+Ref: Derived Files-Footnote-21253416
+Ref: Derived Files-Footnote-31254014
+Node: Future Extensions1254128
+Node: Implementation Limitations1254786
+Node: Extension Design1255969
+Node: Old Extension Problems1257113
+Ref: Old Extension Problems-Footnote-11258631
+Node: Extension New Mechanism Goals1258688
+Ref: Extension New Mechanism Goals-Footnote-11262052
+Node: Extension Other Design Decisions1262241
+Node: Extension Future Growth1264354
+Node: Notes summary1265190
+Node: Basic Concepts1266365
+Node: Basic High Level1267046
+Ref: figure-general-flow1267328
+Ref: figure-process-flow1268013
+Ref: Basic High Level-Footnote-11271314
+Node: Basic Data Typing1271499
+Node: Glossary1274827
+Node: Copying1306665
+Node: GNU Free Documentation License1344208
+Node: Index1369328

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index b66ca19d..9488dcbb 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -30120,13 +30120,32 @@ msgstr "Like, the scoop is"
@cindex Linux
@cindex GNU/Linux
+@quotation NOTE
+The following instructions apply to GNU/Linux with the GNU C Library. Be
+aware that the actual steps may change over time, that the following
+description may not be accurate for all GNU/Linux distributions, and
+that things may work entirely differently on other operating systems.
+@end quotation
+
The next step is to make the directory to hold the binary message object
file and then to create the @file{guide.mo} file.
-We pretend that our file is to be used in the @code{en_US.UTF-8} locale,
-because we have to use a locale name known to the C @command{gettext} routines.
-The directory layout shown here is standard for GNU @command{gettext} on
-GNU/Linux systems. Other versions of @command{gettext} may use a different
-layout:
+The directory has the form @file{@var{locale}/LC_MESSAGES}, where
+@var{locale} is a locale name known to the C @command{gettext} routines.
+
+How do we know which locale to use? It turns out that there are
+three different environment variables used by the C @command{gettext} routines.
+In order, they are @env{$LANGUAGE}, @env{$LC_ALL}, and @env{$LANG}.@footnote{Well,
+sort of. It seems that if @env{$LC_ALL} is set to @samp{C}, then no translations
+are done. Go figure.}
+Thus, we check the value of @env{$LANGUAGE}:
+
+@example
+$ @kbd{echo $LANGUAGE}
+@print{} en_US.UTF-8
+@end example
+
+@noindent
+We next make the directories:
@example
$ @kbd{mkdir en_US.UTF-8 en_US.UTF-8/LC_MESSAGES}
@@ -30141,8 +30160,8 @@ $ @kbd{mkdir en_US.UTF-8 en_US.UTF-8/LC_MESSAGES}
@cindex message object files, converting from portable object files
@cindex files, message object, converting from portable object files
@cindex @command{msgfmt} utility
-The @command{msgfmt} utility does the conversion from human-readable
-@file{.po} file to machine-readable @file{.mo} file.
+The @command{msgfmt} utility converts the human-readable
+@file{.po} file into a machine-readable @file{.mo} file.
By default, @command{msgfmt} creates a file named @file{messages}.
This file must be renamed and placed in the proper directory (using
the @option{-o} option) so that @command{gawk} can find it:
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 22311dfd..6f8658e9 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -29133,13 +29133,32 @@ msgstr "Like, the scoop is"
@cindex Linux
@cindex GNU/Linux
+@quotation NOTE
+The following instructions apply to GNU/Linux with the GNU C Library. Be
+aware that the actual steps may change over time, that the following
+description may not be accurate for all GNU/Linux distributions, and
+that things may work entirely differently on other operating systems.
+@end quotation
+
The next step is to make the directory to hold the binary message object
file and then to create the @file{guide.mo} file.
-We pretend that our file is to be used in the @code{en_US.UTF-8} locale,
-because we have to use a locale name known to the C @command{gettext} routines.
-The directory layout shown here is standard for GNU @command{gettext} on
-GNU/Linux systems. Other versions of @command{gettext} may use a different
-layout:
+The directory has the form @file{@var{locale}/LC_MESSAGES}, where
+@var{locale} is a locale name known to the C @command{gettext} routines.
+
+How do we know which locale to use? It turns out that there are
+three different environment variables used by the C @command{gettext} routines.
+In order, they are @env{$LANGUAGE}, @env{$LC_ALL}, and @env{$LANG}.@footnote{Well,
+sort of. It seems that if @env{$LC_ALL} is set to @samp{C}, then no translations
+are done. Go figure.}
+Thus, we check the value of @env{$LANGUAGE}:
+
+@example
+$ @kbd{echo $LANGUAGE}
+@print{} en_US.UTF-8
+@end example
+
+@noindent
+We next make the directories:
@example
$ @kbd{mkdir en_US.UTF-8 en_US.UTF-8/LC_MESSAGES}
@@ -29154,8 +29173,8 @@ $ @kbd{mkdir en_US.UTF-8 en_US.UTF-8/LC_MESSAGES}
@cindex message object files, converting from portable object files
@cindex files, message object, converting from portable object files
@cindex @command{msgfmt} utility
-The @command{msgfmt} utility does the conversion from human-readable
-@file{.po} file to machine-readable @file{.mo} file.
+The @command{msgfmt} utility converts the human-readable
+@file{.po} file into a machine-readable @file{.mo} file.
By default, @command{msgfmt} creates a file named @file{messages}.
This file must be renamed and placed in the proper directory (using
the @option{-o} option) so that @command{gawk} can find it:
diff --git a/int_array.c b/int_array.c
index 9f705176..475f16fe 100644
--- a/int_array.c
+++ b/int_array.c
@@ -46,7 +46,8 @@ static inline NODE **int_find(NODE *symbol, long k, uint32_t hash1);
static NODE **int_insert(NODE *symbol, long k, uint32_t hash1);
static void grow_int_table(NODE *symbol);
-afunc_t int_array_func[] = {
+const array_funcs_t int_array_func = {
+ "int",
int_array_init,
is_integer,
int_lookup,
diff --git a/interpret.h b/interpret.h
index 8560d9e8..82329e85 100644
--- a/interpret.h
+++ b/interpret.h
@@ -156,7 +156,10 @@ top:
orig = m->stptr;
trans = dgettext(TEXTDOMAIN, orig);
m->stptr[m->stlen] = save;
- m = make_string(trans, strlen(trans));
+ if (trans != orig) // got a translation
+ m = make_string(trans, strlen(trans));
+ else
+ UPREF(m);
} else
UPREF(m);
PUSH(m);
diff --git a/str_array.c b/str_array.c
index 4972a92b..2fdd1bf2 100644
--- a/str_array.c
+++ b/str_array.c
@@ -56,7 +56,8 @@ static NODE **str_list(NODE *symbol, NODE *subs);
static NODE **str_copy(NODE *symbol, NODE *newsymb);
static NODE **str_dump(NODE *symbol, NODE *ndump);
-afunc_t str_array_func[] = {
+const array_funcs_t str_array_func = {
+ "str",
str_array_init,
(afunc_t) 0,
str_lookup,
@@ -74,7 +75,8 @@ static NODE **env_store(NODE *symbol, NODE *subs);
static NODE **env_clear(NODE *symbol, NODE *subs);
/* special case for ENVIRON */
-afunc_t env_array_func[] = {
+const array_funcs_t env_array_func = {
+ "env",
str_array_init,
(afunc_t) 0,
str_lookup,
@@ -796,7 +798,7 @@ env_clear(NODE *symbol, NODE *subs)
environ = NULL; /* ZAP! */
/* str_clear zaps the vtable, reset it */
- symbol->array_funcs = env_array_func;
+ symbol->array_funcs = & env_array_func;
return val;
}
@@ -829,5 +831,5 @@ init_env_array(NODE *env_node)
if (do_posix)
return;
- env_node->array_funcs = env_array_func;
+ env_node->array_funcs = & env_array_func;
}