summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog113
-rw-r--r--Makefile.in17
-rw-r--r--NEWS21
-rw-r--r--TODO15
-rw-r--r--aclocal.m41
-rw-r--r--awk.h6
-rw-r--r--awklib/Makefile.in14
-rw-r--r--awklib/eg/lib/tocsv.awk36
-rw-r--r--configh.in3
-rwxr-xr-xconfigure610
-rw-r--r--configure.ac9
-rw-r--r--doc/ChangeLog107
-rw-r--r--doc/Makefile.in14
-rw-r--r--doc/awkcard.in19
-rw-r--r--doc/gawk.120
-rw-r--r--doc/gawk.info1921
-rw-r--r--doc/gawk.texi385
-rw-r--r--doc/gawktexi.in349
-rwxr-xr-x[-rw-r--r--]doc/it/ChangeLog129
-rw-r--r--doc/it/gawk-api-figura1.eps (renamed from doc/it/api-figura1.eps)0
-rw-r--r--doc/it/gawk-api-figura1.fig (renamed from doc/it/api-figura1.fig)0
-rw-r--r--doc/it/gawk-api-figura1.pdf (renamed from doc/it/api-figura1.pdf)bin9120 -> 9120 bytes
-rw-r--r--doc/it/gawk-api-figura1.png (renamed from doc/it/api-figura1.png)bin5747 -> 5747 bytes
-rw-r--r--doc/it/gawk-api-figura1.txt (renamed from doc/it/api-figura1.txt)0
-rw-r--r--doc/it/gawk-api-figura2.eps (renamed from doc/it/api-figura2.eps)0
-rw-r--r--doc/it/gawk-api-figura2.fig (renamed from doc/it/api-figura2.fig)0
-rw-r--r--doc/it/gawk-api-figura2.pdf (renamed from doc/it/api-figura2.pdf)bin11596 -> 11596 bytes
-rw-r--r--doc/it/gawk-api-figura2.png (renamed from doc/it/api-figura2.png)bin5768 -> 5768 bytes
-rw-r--r--doc/it/gawk-api-figura2.txt (renamed from doc/it/api-figura2.txt)0
-rw-r--r--doc/it/gawk-api-figura3.eps (renamed from doc/it/api-figura3.eps)0
-rw-r--r--doc/it/gawk-api-figura3.fig (renamed from doc/it/api-figura3.fig)0
-rw-r--r--doc/it/gawk-api-figura3.pdf (renamed from doc/it/api-figura3.pdf)bin11914 -> 11914 bytes
-rw-r--r--doc/it/gawk-api-figura3.png (renamed from doc/it/api-figura3.png)bin5734 -> 5734 bytes
-rw-r--r--doc/it/gawk-api-figura3.txt (renamed from doc/it/api-figura3.txt)0
-rw-r--r--doc/it/gawk-flusso-elaborazione.eps (renamed from doc/it/flusso-elaborazione.eps)0
-rw-r--r--doc/it/gawk-flusso-elaborazione.fig (renamed from doc/it/flusso-elaborazione.fig)0
-rw-r--r--doc/it/gawk-flusso-elaborazione.pdf (renamed from doc/it/flusso-elaborazione.pdf)bin9672 -> 9672 bytes
-rw-r--r--doc/it/gawk-flusso-elaborazione.png (renamed from doc/it/flusso-elaborazione.png)bin6300 -> 6300 bytes
-rw-r--r--doc/it/gawk-flusso-elaborazione.txt (renamed from doc/it/flusso-elaborazione.txt)0
-rw-r--r--doc/it/gawk-programma-generico.eps (renamed from doc/it/programma-generico.eps)0
-rw-r--r--doc/it/gawk-programma-generico.fig (renamed from doc/it/programma-generico.fig)0
-rw-r--r--doc/it/gawk-programma-generico.pdf (renamed from doc/it/programma-generico.pdf)bin5313 -> 5313 bytes
-rw-r--r--doc/it/gawk-programma-generico.png (renamed from doc/it/programma-generico.png)bin4151 -> 4151 bytes
-rw-r--r--doc/it/gawk-programma-generico.txt (renamed from doc/it/programma-generico.txt)0
-rw-r--r--doc/it/gawk-vettore-elementi.eps (renamed from doc/it/vettore-elementi.eps)0
-rw-r--r--doc/it/gawk-vettore-elementi.fig (renamed from doc/it/vettore-elementi.fig)0
-rw-r--r--doc/it/gawk-vettore-elementi.pdf (renamed from doc/it/vettore-elementi.pdf)bin7009 -> 7009 bytes
-rw-r--r--doc/it/gawk-vettore-elementi.png (renamed from doc/it/vettore-elementi.png)bin1032 -> 1032 bytes
-rw-r--r--doc/it/gawk-vettore-elementi.txt (renamed from doc/it/vettore-elementi.txt)0
-rwxr-xr-x[-rw-r--r--]doc/it/gawk.126
-rwxr-xr-xdoc/it/gawkbug.184
-rwxr-xr-x[-rw-r--r--]doc/it/gawktexi.in1142
-rwxr-xr-xdoc/it/gendocs.sh86
-rwxr-xr-x[-rw-r--r--]doc/it/pm-gawk.17
-rwxr-xr-x[-rw-r--r--]doc/it/texinfo.tex2044
-rw-r--r--doc/wordlist5
-rw-r--r--doc/wordlist31
-rw-r--r--extras/Makefile.in14
-rw-r--r--field.c166
-rw-r--r--io.c108
-rw-r--r--m4/ChangeLog4
-rw-r--r--m4/libsigsegv.m416
-rw-r--r--main.c75
-rw-r--r--node.c61
-rw-r--r--pc/ChangeLog21
-rw-r--r--pc/Makefile.tst38
-rw-r--r--po/ChangeLog1
-rw-r--r--po/it.po30
-rw-r--r--re.c23
-rw-r--r--support/Makefile.in14
-rw-r--r--test/ChangeLog39
-rwxr-xr-xtest/Gentests11
-rw-r--r--test/Makefile.am25
-rw-r--r--test/Makefile.in65
-rw-r--r--test/Maketests26
-rw-r--r--test/badargs.ok3
-rw-r--r--test/csv1.awk10
-rw-r--r--test/csv1.in22
-rw-r--r--test/csv1.ok22
-rw-r--r--test/csv2.awk34
-rw-r--r--test/csv2.ok0
-rw-r--r--test/csv3.awk6
-rw-r--r--test/csv3.in13
-rw-r--r--test/csv3.ok48
-rw-r--r--test/csvodd.awk13
-rw-r--r--test/csvodd.in25
-rw-r--r--test/csvodd.ok44
-rw-r--r--test/funstack.ok2
-rw-r--r--test/unicode1.awk6
-rw-r--r--test/unicode1.ok4
90 files changed, 5324 insertions, 2849 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ffcaa5d..88f2493a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,12 +4,69 @@
if you sort SYMTAB. Thanks to zhou shuiqing
<zhoushuiqing321@outlook.com> for the report.
+2023-04-13 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * io.c (csvscan): Convert CR-LF pairs to plain LF, both at the
+ end of the line and when embedded. Plain CRs are not touched.
+
+2023-04-07 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * io.c (csvscan): Instead of stripping all carriage returns in the
+ input, simply include the CR in the RT if it occurs just before
+ the linefeed character.
+
2023-04-07 Arnold D. Robbins <arnold@skeeve.com>
* array.c (assoc_info): Update to handle additional cases so
that one may dump SYMTAB or FUNCTAB. Issue reported by
zhou shuiqing <zhoushuiqing321@outlook.com>.
+2023-03-26 Arnold D. Robbins <arnold@skeeve.com>
+
+ * NEWS: Updated.
+
+2023-03-24 Arnold D. Robbins <arnold@skeeve.com>
+
+ Add support for \u escape sequence.
+
+ * awk.h (parse_escaape): New bool* parameter for unicode.
+ * node.c (make_str_node): Deal with a \u escape.
+ (parse_escape): Handle \u.
+ * re.c (make_regexp): Deal with a \u escape.
+
+2023-03-24 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (set_RS): Fix first time and warning logic for csv mode.
+
+2023-03-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (csvscan): Strip CRs.
+
+2023-03-21 Manuel Collado <mcollado2011@gmail.com>
+
+ * io.c (csvscan): Real implementation.
+
+2023-03-17 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (do_split): Modify behavior for --csv.
+
+2023-03-16 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (enum do_flag_values): Add DO_CSV.
+ (do_csv): New macro.
+ (init_csv_fields, init_csv_records): Add declarations.
+ * field.c (init_csv_fields): New function.
+ (set_parser): Don't set the parser if doing CSV. Add warnings.
+ * io.c (csvscan): New function (placeholder for now).
+ (init_csv_records): New function.
+ (set_RS): Don't set the parser if doing CSV. Add warnings.
+ * main.c (optab): Add new options -k/--csv.
+ (main): Fatal out if --posix and --csv. Call init_csv_records()
+ and init_csv_fields().
+ (usage): Add a line for the new options.
+ (load_procinfo): Install PROCINFO["CSV"] if doing CSV.
+ (parse_args): Update for new options.
+
2023-03-09 Arnold D. Robbins <arnold@skeeve.com>
* gawkapi.h: Update copyright year. Small edit in leading comment.
@@ -65,6 +122,11 @@
2023-02-24 Arnold D. Robbins <arnold@skeeve.com>
+ * field.c (set_comma_field): Free the string node. Fixes a
+ memory leak. Thanks to Andrew Schorr for the report.
+
+2023-02-24 Arnold D. Robbins <arnold@skeeve.com>
+
* awk.h (boolval): Handle Node_var. Thanks to
Daniel Pouzzner <douzzer@mega.nu> for the report, relayed
by Andrew Schorr.
@@ -85,6 +147,17 @@
* io.c (redflags2str, check_duplicated_redirections,
redirect_string): Ditto.
+2023-02-12 Arnold D. Robbins <arnold@skeeve.com>
+
+ * NEWS: Updated.
+
+2023-02-10 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (avoid_flush): New function.
+ (redirect_string): Use it when setting up an output pipeline.
+ Thanks to Alexandre Ferrieux <alexandre.ferrieux@orange.com>
+ for pointing out the performance issue.
+
2023-02-09 Arnold D. Robbins <arnold@skeeve.com>
* main.c (usage): Include URL for source code in the message.
@@ -132,6 +205,11 @@
* README: Updated with texinfo.tex and makeinfo versions.
Update copyright year.
+2022-12-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * main.c (extra_stack): Remove variable and its uses. Left over
+ from libsigsegv cleanup.
+
2022-12-23 Arnold D. Robbins <arnold@skeeve.com>
* README: Updated with texinfo.tex version.
@@ -143,6 +221,12 @@
2022-12-11 Arnold D. Robbins <arnold@skeeve.com>
+ * main.c (load_procinfo): Remove "mb_cur_max" and "utf8"
+ entries, they're not of any real use.
+ * NEWS: Updated.
+
+2022-12-11 Arnold D. Robbins <arnold@skeeve.com>
+
* main.c (get_pma_version): Add declaration.
(load_procinfo): Use it to set PROCINFO["pma"] if PMA is in use.
Thanks to J Naman for the feature suggestion.
@@ -173,6 +257,16 @@
* main.c (parse_args): Call pma_mpfr_check() if using persisent
malloc.
+2022-12-01 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.ac: Removed use of libsigsegv.
+ * main.c: Removed code related to libsigsegv.
+ * NEWS: Updated.
+
+2022-11-25 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (comma_parse_field): Remove unused variable `field'.
+
2022-11-23 Arnold D. Robbins <arnold@skeeve.com>
* msg.c: Update to GPL 3. Thanks to Corinna Vinschen for
@@ -325,6 +419,25 @@
* awkgram.c, command.c: Regenerated, using Bison 3.8.2.
+2022-09-01 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (do_split): Check for not do_posix if separator is comma.
+
+2022-08-31 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (do_split): Make "," as third arg do CSV parsing.
+
+2022-08-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (comma_parse_field): Add resizing of new field buffer;
+ No Arbitrary Limits!
+
+2022-08-29 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (comma_parse_field, set_comma_field): New functions.
+ (set_FS): If FS is "," and not posix mode, use CSV parsing.
+ Code follows what BWK's new code does.
+
2022-08-25 Arnold D. Robbins <arnold@skeeve.com>
* awkgram.y (yyerror): Exit at the end, to make syntax errors
diff --git a/Makefile.in b/Makefile.in
index b534174b..28eeb698 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -127,11 +127,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
- $(top_srcdir)/m4/libsigsegv.m4 $(top_srcdir)/m4/longlong.m4 \
- $(top_srcdir)/m4/mpfr.m4 $(top_srcdir)/m4/nls.m4 \
- $(top_srcdir)/m4/noreturn.m4 $(top_srcdir)/m4/pma.m4 \
- $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
- $(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/socket.m4 \
+ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/mpfr.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/noreturn.m4 \
+ $(top_srcdir)/m4/pma.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/readline.m4 \
+ $(top_srcdir)/m4/socket.m4 \
$(top_srcdir)/m4/triplet-transformation.m4 \
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -161,8 +161,7 @@ gawk_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
gawk_DEPENDENCIES = support/libsupport.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -372,7 +371,6 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GREP = @GREP@
-HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -387,13 +385,10 @@ LIBMPFR = @LIBMPFR@
LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
-LIBSIGSEGV = @LIBSIGSEGV@
-LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
-LTLIBSIGSEGV = @LTLIBSIGSEGV@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
diff --git a/NEWS b/NEWS
index ab6d0425..cd8a3ca1 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,27 @@
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
+Changes from 5.2.2 to 5.3.0
+---------------------------
+
+1. Infrastructure changes: Removed the use of libsigsegv. The
+ value-add was never very much and it causes problems in some
+ environments.
+
+2. In keeping with new features in BWK awk, gawk now has built-in
+ CSV file parsing. The behavior is intended to be identical to
+ that of the "One True AWK", when --csv is applied. See the
+ manual for details.
+
+3. If PROCINFO["BUFFERPIPE"] exists, then pipe output is buffered.
+ You can also use PROCINFO["command", "BUFFERPIPE"]. See the manual
+ for details.
+
+4. Also in keeping with BWK awk, gawk now supports a new \u escape
+ sequence. This should be followed by 1-8 hexadecimal digits. The
+ given code point is converted to its corresponding multibyte encoding
+ for storage inside gawk. See the manual.
+
Changes from 5.2.1 to 5.2.2
---------------------------
diff --git a/TODO b/TODO
index 35254d5e..f556787c 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-Thu Aug 20 12:18:22 IDT 2020
+Thu 24 Nov 2022 12:37:30 EST
============================
There were too many files tracking different thoughts and ideas for
@@ -15,6 +15,19 @@ TODO
Minor Cleanups and Code Improvements
------------------------------------
+ Tzvetelin Katchov <katchov@gnu.org> points out the following:
+
+ - Clean up file and directory permissions to 0644 and 0755
+ across the board.
+
+ - Use consistent #! lines in awk scripts in the test suite.
+
+ - Double check uses of xxx:: targets in the test suite Makefile,
+ maybe only one colon is needed.
+
+ - The commas, mbstr1 and mbstr2 tests should probably be moved
+ into the locale tests.
+
API:
??? #if !defined(GAWK) && !defined(GAWK_OMIT_CONVENIENCE_MACROS)
diff --git a/aclocal.m4 b/aclocal.m4
index 986c2a5a..d84a2369 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1220,7 +1220,6 @@ m4_include([m4/lcmessage.m4])
m4_include([m4/lib-ld.m4])
m4_include([m4/lib-link.m4])
m4_include([m4/lib-prefix.m4])
-m4_include([m4/libsigsegv.m4])
m4_include([m4/longlong.m4])
m4_include([m4/mpfr.m4])
m4_include([m4/nls.m4])
diff --git a/awk.h b/awk.h
index 661eb637..ca31c5ff 100644
--- a/awk.h
+++ b/awk.h
@@ -1173,6 +1173,7 @@ extern enum do_flag_values {
DO_PROFILE = 0x02000, /* profile the program */
DO_DEBUG = 0x04000, /* debug the program */
DO_MPFR = 0x08000, /* arbitrary-precision floating-point math */
+ DO_CSV = 0x10000, /* process comma-separated-value files */
} do_flags;
#define do_traditional (do_flags & DO_TRADITIONAL)
@@ -1187,6 +1188,7 @@ extern enum do_flag_values {
#define do_sandbox (do_flags & DO_SANDBOX)
#define do_debug (do_flags & DO_DEBUG)
#define do_mpfr (do_flags & DO_MPFR)
+#define do_csv (do_flags & DO_CSV)
extern bool do_optimize;
extern int use_lc_numeric;
@@ -1569,6 +1571,7 @@ extern NODE *get_actual_argument(NODE *, int, bool);
#endif
/* field.c */
extern void init_fields(void);
+extern void init_csv_fields(void);
extern void set_record(const char *buf, int cnt, const awk_fieldwidth_info_t *);
extern void reset_record(void);
extern void rebuild_record(void);
@@ -1629,6 +1632,7 @@ extern int isdirpunct(int c);
/* io.c */
extern void init_sockets(void);
extern void init_io(void);
+extern void init_csv_records(void);
extern void register_input_parser(awk_input_parser_t *input_parser);
extern void register_output_wrapper(awk_output_wrapper_t *wrapper);
extern void register_two_way_processor(awk_two_way_processor_t *processor);
@@ -1738,7 +1742,7 @@ extern NODE *make_str_node(const char *s, size_t len, int flags);
extern NODE *make_bool_node(bool value);
extern NODE *make_typed_regex(const char *re, size_t len);
extern void *more_blocks(int id);
-extern int parse_escape(const char **string_ptr);
+extern int parse_escape(const char **string_ptr, bool *unicode);
extern NODE *str2wstr(NODE *n, size_t **ptr);
extern NODE *wstr2str(NODE *n);
#define force_wstring(n) str2wstr(n, NULL)
diff --git a/awklib/Makefile.in b/awklib/Makefile.in
index b66748b5..5b3a7d9a 100644
--- a/awklib/Makefile.in
+++ b/awklib/Makefile.in
@@ -119,11 +119,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
- $(top_srcdir)/m4/libsigsegv.m4 $(top_srcdir)/m4/longlong.m4 \
- $(top_srcdir)/m4/mpfr.m4 $(top_srcdir)/m4/nls.m4 \
- $(top_srcdir)/m4/noreturn.m4 $(top_srcdir)/m4/pma.m4 \
- $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
- $(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/socket.m4 \
+ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/mpfr.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/noreturn.m4 \
+ $(top_srcdir)/m4/pma.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/readline.m4 \
+ $(top_srcdir)/m4/socket.m4 \
$(top_srcdir)/m4/triplet-transformation.m4 \
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -228,7 +228,6 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GREP = @GREP@
-HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -243,13 +242,10 @@ LIBMPFR = @LIBMPFR@
LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
-LIBSIGSEGV = @LIBSIGSEGV@
-LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
-LTLIBSIGSEGV = @LTLIBSIGSEGV@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
diff --git a/awklib/eg/lib/tocsv.awk b/awklib/eg/lib/tocsv.awk
new file mode 100644
index 00000000..42b79c5b
--- /dev/null
+++ b/awklib/eg/lib/tocsv.awk
@@ -0,0 +1,36 @@
+# tocsv.awk --- convert data to CSV format
+#
+# Arnold Robbins, arnold@skeeve.com, Public Domain
+# April 2023
+
+function tocsv(fields, sep, i, j, nfields, result)
+{
+ if (length(fields) == 0)
+ return ""
+
+ if (sep == "")
+ sep = ","
+ delete nfields
+ for (i = 1; i in fields; i++) {
+ nfields[i] = fields[i]
+ if (nfields[i] ~ /["\n]/ || index(nfields[i], sep) != 0) {
+ gsub(/"/, "\"\"", nfields[i]) # double up quotes
+ nfields[i] = "\"" nfields[i] "\"" # wrap in quotes
+ }
+ }
+
+ result = nfields[1]
+ j = length(nfields)
+ for (i = 2; i <= j; i++)
+ result = result sep nfields[i]
+
+ return result
+}
+function tocsv_rec(sep, i, fields)
+{
+ delete fields
+ for (i = 1; i <= NF; i++)
+ fields[i] = $i
+
+ return tocsv(fields, sep)
+}
diff --git a/configh.in b/configh.in
index fa922263..db267cc4 100644
--- a/configh.in
+++ b/configh.in
@@ -114,9 +114,6 @@
/* Define to 1 if you have a fully functional readline library. */
#undef HAVE_LIBREADLINE
-/* Define if you have the libsigsegv library. */
-#undef HAVE_LIBSIGSEGV
-
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
diff --git a/configure b/configure
index d7996a5b..3f2c243d 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for GNU Awk 5.2.1b.
+# Generated by GNU Autoconf 2.71 for GNU Awk 5.2.60.
#
# Report bugs to <bug-gawk@gnu.org>.
#
@@ -611,8 +611,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='GNU Awk'
PACKAGE_TARNAME='gawk'
-PACKAGE_VERSION='5.2.1b'
-PACKAGE_STRING='GNU Awk 5.2.1b'
+PACKAGE_VERSION='5.2.60'
+PACKAGE_STRING='GNU Awk 5.2.60'
PACKAGE_BUGREPORT='bug-gawk@gnu.org'
PACKAGE_URL='https://www.gnu.org/software/gawk/'
@@ -663,10 +663,6 @@ ENABLE_EXTENSIONS_FALSE
ENABLE_EXTENSIONS_TRUE
USE_PERSISTENT_MALLOC_FALSE
USE_PERSISTENT_MALLOC_TRUE
-LIBSIGSEGV_PREFIX
-LTLIBSIGSEGV
-LIBSIGSEGV
-HAVE_LIBSIGSEGV
LIBOBJS
TEST_CROSS_COMPILE_FALSE
TEST_CROSS_COMPILE_TRUE
@@ -810,7 +806,6 @@ with_gnu_ld
enable_rpath
with_libiconv_prefix
with_libintl_prefix
-with_libsigsegv_prefix
enable_extensions
with_readline
with_mpfr
@@ -1374,7 +1369,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures GNU Awk 5.2.1b to adapt to many kinds of systems.
+\`configure' configures GNU Awk 5.2.60 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1445,7 +1440,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of GNU Awk 5.2.1b:";;
+ short | recursive ) echo "Configuration of GNU Awk 5.2.60:";;
esac
cat <<\_ACEOF
@@ -1480,8 +1475,6 @@ Optional Packages:
--without-libiconv-prefix don't search for libiconv in includedir and libdir
--with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib
--without-libintl-prefix don't search for libintl in includedir and libdir
- --with-libsigsegv-prefix[=DIR] search for libsigsegv in DIR/include and DIR/lib
- --without-libsigsegv-prefix don't search for libsigsegv in includedir and libdir
--with-readline=DIR look for the readline library in DIR
--with-mpfr=DIR look for the mpfr and gmp libraries in DIR
@@ -1570,7 +1563,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-GNU Awk configure 5.2.1b
+GNU Awk configure 5.2.60
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2227,7 +2220,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by GNU Awk $as_me 5.2.1b, which was
+It was created by GNU Awk $as_me 5.2.60, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3522,7 +3515,7 @@ fi
# Define the identity of the package.
PACKAGE='gawk'
- VERSION='5.2.1b'
+ VERSION='5.2.60'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -11577,589 +11570,6 @@ then :
fi
-case $host_os in
-osf1) : ;;
-*)
-
-
-
-
-
-
-
-
-
-
-
-
-
- use_additional=yes
-
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
-
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\"
- eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\"
-
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-
-
-# Check whether --with-libsigsegv-prefix was given.
-if test ${with_libsigsegv_prefix+y}
-then :
- withval=$with_libsigsegv_prefix;
- if test "X$withval" = "Xno"; then
- use_additional=no
- else
- if test "X$withval" = "X"; then
-
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
-
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\"
- eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\"
-
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-
- else
- additional_includedir="$withval/include"
- additional_libdir="$withval/$acl_libdirstem"
- additional_libdir2="$withval/$acl_libdirstem2"
- additional_libdir3="$withval/$acl_libdirstem3"
- fi
- fi
-
-fi
-
- if test "X$additional_libdir2" = "X$additional_libdir"; then
- additional_libdir2=
- fi
- if test "X$additional_libdir3" = "X$additional_libdir"; then
- additional_libdir3=
- fi
- LIBSIGSEGV=
- LTLIBSIGSEGV=
- INCSIGSEGV=
- LIBSIGSEGV_PREFIX=
- HAVE_LIBSIGSEGV=
- rpathdirs=
- ltrpathdirs=
- names_already_handled=
- names_next_round='sigsegv '
- while test -n "$names_next_round"; do
- names_this_round="$names_next_round"
- names_next_round=
- for name in $names_this_round; do
- already_handled=
- for n in $names_already_handled; do
- if test "$n" = "$name"; then
- already_handled=yes
- break
- fi
- done
- if test -z "$already_handled"; then
- names_already_handled="$names_already_handled $name"
- uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
- eval value=\"\$HAVE_LIB$uppername\"
- if test -n "$value"; then
- if test "$value" = yes; then
- eval value=\"\$LIB$uppername\"
- test -z "$value" || LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$value"
- eval value=\"\$LTLIB$uppername\"
- test -z "$value" || LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }$value"
- else
- :
- fi
- else
- found_dir=
- found_la=
- found_so=
- found_a=
- eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
- if test -n "$acl_shlibext"; then
- shrext=".$acl_shlibext" # typically: shrext=.so
- else
- shrext=
- fi
- if test $use_additional = yes; then
- for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do
- if test "X$found_dir" = "X"; then
- eval dir=\$$additional_libdir_variable
- if test -n "$dir"; then
- if test -n "$acl_shlibext"; then
- if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext"
- else
- if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
- ver=`(cd "$dir" && \
- for f in "$libname$shrext".*; do echo "$f"; done \
- | sed -e "s,^$libname$shrext\\\\.,," \
- | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
- | sed 1q ) 2>/dev/null`
- if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext.$ver"
- fi
- else
- eval library_names=\"$acl_library_names_spec\"
- for f in $library_names; do
- if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then
- found_dir="$dir"
- found_so="$dir/$f"
- break
- fi
- done
- fi
- fi
- fi
- if test "X$found_dir" = "X"; then
- if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then
- found_dir="$dir"
- found_a="$dir/$libname.$acl_libext"
- fi
- fi
- if test "X$found_dir" != "X"; then
- if test -f "$dir/$libname.la"; then
- found_la="$dir/$libname.la"
- fi
- fi
- fi
- fi
- done
- fi
- if test "X$found_dir" = "X"; then
- for x in $LDFLAGS $LTLIBSIGSEGV; do
-
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
- eval x=\"$x\"
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-
- case "$x" in
- -L*)
- dir=`echo "X$x" | sed -e 's/^X-L//'`
- if test -n "$acl_shlibext"; then
- if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext"
- else
- if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
- ver=`(cd "$dir" && \
- for f in "$libname$shrext".*; do echo "$f"; done \
- | sed -e "s,^$libname$shrext\\\\.,," \
- | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
- | sed 1q ) 2>/dev/null`
- if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext.$ver"
- fi
- else
- eval library_names=\"$acl_library_names_spec\"
- for f in $library_names; do
- if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then
- found_dir="$dir"
- found_so="$dir/$f"
- break
- fi
- done
- fi
- fi
- fi
- if test "X$found_dir" = "X"; then
- if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then
- found_dir="$dir"
- found_a="$dir/$libname.$acl_libext"
- fi
- fi
- if test "X$found_dir" != "X"; then
- if test -f "$dir/$libname.la"; then
- found_la="$dir/$libname.la"
- fi
- fi
- ;;
- esac
- if test "X$found_dir" != "X"; then
- break
- fi
- done
- fi
- if test "X$found_dir" != "X"; then
- LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }-L$found_dir -l$name"
- if test "X$found_so" != "X"; then
- if test "$enable_rpath" = no \
- || test "X$found_dir" = "X/usr/$acl_libdirstem" \
- || test "X$found_dir" = "X/usr/$acl_libdirstem2" \
- || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$found_so"
- else
- haveit=
- for x in $ltrpathdirs; do
- if test "X$x" = "X$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- ltrpathdirs="$ltrpathdirs $found_dir"
- fi
- if test "$acl_hardcode_direct" = yes; then
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$found_so"
- else
- if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$found_so"
- haveit=
- for x in $rpathdirs; do
- if test "X$x" = "X$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- rpathdirs="$rpathdirs $found_dir"
- fi
- else
- haveit=
- for x in $LDFLAGS $LIBSIGSEGV; do
-
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
- eval x=\"$x\"
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-
- if test "X$x" = "X-L$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }-L$found_dir"
- fi
- if test "$acl_hardcode_minus_L" != no; then
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$found_so"
- else
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }-l$name"
- fi
- fi
- fi
- fi
- else
- if test "X$found_a" != "X"; then
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$found_a"
- else
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }-L$found_dir -l$name"
- fi
- fi
- additional_includedir=
- case "$found_dir" in
- */$acl_libdirstem | */$acl_libdirstem/)
- basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
- if test "$name" = 'sigsegv'; then
- LIBSIGSEGV_PREFIX="$basedir"
- fi
- additional_includedir="$basedir/include"
- ;;
- */$acl_libdirstem2 | */$acl_libdirstem2/)
- basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
- if test "$name" = 'sigsegv'; then
- LIBSIGSEGV_PREFIX="$basedir"
- fi
- additional_includedir="$basedir/include"
- ;;
- */$acl_libdirstem3 | */$acl_libdirstem3/)
- basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'`
- if test "$name" = 'sigsegv'; then
- LIBSIGSEGV_PREFIX="$basedir"
- fi
- additional_includedir="$basedir/include"
- ;;
- esac
- if test "X$additional_includedir" != "X"; then
- if test "X$additional_includedir" != "X/usr/include"; then
- haveit=
- if test "X$additional_includedir" = "X/usr/local/include"; then
- if test -n "$GCC"; then
- case $host_os in
- linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- for x in $CPPFLAGS $INCSIGSEGV; do
-
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
- eval x=\"$x\"
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-
- if test "X$x" = "X-I$additional_includedir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_includedir"; then
- INCSIGSEGV="${INCSIGSEGV}${INCSIGSEGV:+ }-I$additional_includedir"
- fi
- fi
- fi
- fi
- fi
- if test -n "$found_la"; then
- save_libdir="$libdir"
- case "$found_la" in
- */* | *\\*) . "$found_la" ;;
- *) . "./$found_la" ;;
- esac
- libdir="$save_libdir"
- for dep in $dependency_libs; do
- case "$dep" in
- -L*)
- dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
- if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \
- && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \
- && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then
- haveit=
- if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \
- || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \
- || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then
- if test -n "$GCC"; then
- case $host_os in
- linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- haveit=
- for x in $LDFLAGS $LIBSIGSEGV; do
-
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
- eval x=\"$x\"
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-
- if test "X$x" = "X-L$dependency_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$dependency_libdir"; then
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }-L$dependency_libdir"
- fi
- fi
- haveit=
- for x in $LDFLAGS $LTLIBSIGSEGV; do
-
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
- eval x=\"$x\"
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-
- if test "X$x" = "X-L$dependency_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$dependency_libdir"; then
- LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }-L$dependency_libdir"
- fi
- fi
- fi
- fi
- ;;
- -R*)
- dir=`echo "X$dep" | sed -e 's/^X-R//'`
- if test "$enable_rpath" != no; then
- haveit=
- for x in $rpathdirs; do
- if test "X$x" = "X$dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- rpathdirs="$rpathdirs $dir"
- fi
- haveit=
- for x in $ltrpathdirs; do
- if test "X$x" = "X$dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- ltrpathdirs="$ltrpathdirs $dir"
- fi
- fi
- ;;
- -l*)
- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
- ;;
- *.la)
- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
- ;;
- *)
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$dep"
- LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }$dep"
- ;;
- esac
- done
- fi
- else
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }-l$name"
- LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }-l$name"
- fi
- fi
- fi
- done
- done
- if test "X$rpathdirs" != "X"; then
- if test -n "$acl_hardcode_libdir_separator"; then
- alldirs=
- for found_dir in $rpathdirs; do
- alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
- done
- acl_save_libdir="$libdir"
- libdir="$alldirs"
- eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$flag"
- else
- for found_dir in $rpathdirs; do
- acl_save_libdir="$libdir"
- libdir="$found_dir"
- eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIBSIGSEGV="${LIBSIGSEGV}${LIBSIGSEGV:+ }$flag"
- done
- fi
- fi
- if test "X$ltrpathdirs" != "X"; then
- for found_dir in $ltrpathdirs; do
- LTLIBSIGSEGV="${LTLIBSIGSEGV}${LTLIBSIGSEGV:+ }-R$found_dir"
- done
- fi
-
-
-
-
-
-
- ac_save_CPPFLAGS="$CPPFLAGS"
-
- for element in $INCSIGSEGV; do
- haveit=
- for x in $CPPFLAGS; do
-
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
- eval x=\"$x\"
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-
- if test "X$x" = "X$element"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
- fi
- done
-
-
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libsigsegv" >&5
-printf %s "checking for libsigsegv... " >&6; }
-if test ${ac_cv_libsigsegv+y}
-then :
- printf %s "(cached) " >&6
-else $as_nop
-
- ac_save_LIBS="$LIBS"
- case " $LIBSIGSEGV" in
- *" -l"*) LIBS="$LIBS $LIBSIGSEGV" ;;
- *) LIBS="$LIBSIGSEGV $LIBS" ;;
- esac
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <sigsegv.h>
-int
-main (void)
-{
-sigsegv_deinstall_handler();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"
-then :
- ac_cv_libsigsegv=yes
-else $as_nop
- ac_cv_libsigsegv='no, consider installing GNU libsigsegv'
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
- conftest$ac_exeext conftest.$ac_ext
- LIBS="$ac_save_LIBS"
-
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libsigsegv" >&5
-printf "%s\n" "$ac_cv_libsigsegv" >&6; }
- if test "$ac_cv_libsigsegv" = yes; then
- HAVE_LIBSIGSEGV=yes
-
-printf "%s\n" "#define HAVE_LIBSIGSEGV 1" >>confdefs.h
-
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libsigsegv" >&5
-printf %s "checking how to link with libsigsegv... " >&6; }
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBSIGSEGV" >&5
-printf "%s\n" "$LIBSIGSEGV" >&6; }
- else
- HAVE_LIBSIGSEGV=no
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIBSIGSEGV=
- LTLIBSIGSEGV=
- LIBSIGSEGV_PREFIX=
- fi
-
-
-
-
-
-
-
- gl_cv_lib_sigsegv="$ac_cv_libsigsegv"
-
- ;;
-esac
# Need the check for mkstemp and tmpfile for missing_d/snprintf.c.
ac_fn_c_check_func "$LINENO" "__etoa_l" "ac_cv_func___etoa_l"
@@ -14386,7 +13796,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by GNU Awk $as_me 5.2.1b, which was
+This file was extended by GNU Awk $as_me 5.2.60, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14456,7 +13866,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-GNU Awk config.status 5.2.1b
+GNU Awk config.status 5.2.60
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 709210a4..87b1b3a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ dnl
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([GNU Awk],[5.2.1b],[bug-gawk@gnu.org],[gawk])
+AC_INIT([GNU Awk],[5.2.60],[bug-gawk@gnu.org],[gawk])
# This is a hack. Different versions of install on different systems
# are just too different. Chuck it and use install-sh.
@@ -305,13 +305,6 @@ AC_SEARCH_LIBS(fmod, m)
AC_SEARCH_LIBS(isinf, m)
AC_SEARCH_LIBS(ismod, m)
AC_SEARCH_LIBS(isnan, m)
-dnl Don't look for libsigsegv on OSF/1, gives us severe headaches
-case $host_os in
-osf1) : ;;
-*)
- gl_LIBSIGSEGV
- ;;
-esac
# Need the check for mkstemp and tmpfile for missing_d/snprintf.c.
AC_CHECK_FUNCS(__etoa_l atexit btowc fmod fwrite_unlocked gai_strerror \
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 0b6d43f6..53a0bc45 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,26 @@
+2023-04-13 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Comma Separated Fields): Further revise the prose
+ and sidebar for discussion of CR-LF embedded in the record, and
+ as the record terminator. Update the sidebar as well that
+ standalone CRs are not modified.
+ * wordlist: Updated.
+
+2023-04-10 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (To CSV Function): Fix a typo in the code.
+ Thanks to Andrew Schorr for the catch.
+
+2023-04-07 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (To CSV Function): New section.
+
+2023-04-06 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * gawktexi.in (Carriage-Return--Line-Feed Line Endings In CSV Files):
+ Revise to explain that carriage-returns will be included in RT
+ when they appear just before a line-feed.
+
2023-04-04 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Controlling Scanning): Fix the logic in the example.
@@ -8,12 +31,18 @@
* gawktexi.in (Dynamic Typing): Small formatting fix.
Add an index entry.
+ * gawktexi.in (Comma Separated Fields): Additonal small
+ formatting changes.
2023-03-29 Arnold D. Robbins <arnold@skeeve.com>
* texinfo.tex: Sync from Texinfo.
* gawktexi.in (Dynamic Typing): Add a quote.
(Common Extensions): Sort the table entries, sort of.
+ * gawktexi.in: Several fixes related to CSV; thanks to
+ Antonio Columbo. Note that `nawk' is BWK awk.
+ (Common Extensions): Add entries to the table for \u and
+ CSV support.
2023-03-26 Arnold D. Robbins <arnold@skeeve.com>
@@ -21,6 +50,23 @@
* gawktexi.in (Dynamic Typing): Add more explanation and another
example.
+2023-03-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Escape Sequences): Document \u.
+ (Feature History): Ditto.
+ * awkcard.in: Add \u to list of escape sequences.
+
+2023-03-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Considerable work syncing the doc on CSV parsing
+ with changes in the code. Still stuff to do, maked with FIXMEs.
+ * wordlist, wordlist3: Updated.
+
+2023-03-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkcard.in: Document -k/--csv.
+ * gawk.1: Ditto, add short section on CSV handling.
+
2023-03-09 Arnold D. Robbins <arnold@skeeve.com>
* gawkworkflow.texi (UPDATE-MONTH, EDITION): Updated.
@@ -66,6 +112,20 @@
* gawktexi.in (Feature History): Add note about nonfatal I/O.
+2023-02-15 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (EDITION): Bump to 5.3. Thanks to Antonio
+ Columbo for the suggestion.
+
+2023-02-10 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Noflush): New section.
+ Update modified date, version and patchlevel.
+
+2023-02-09 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Feature History): Clean up the entry for
+ version 5.3.
2023-02-05 Arnold D. Robbins <arnold@skeeve.com>
* texinfo.tex: Update from GNULIB. Only change is to remove
@@ -73,6 +133,11 @@
2023-02-02 Arnold D. Robbins <arnold@skeeve.com>
+ * gawktexi.in (Feature History): Document CSV parsing
+ and PROCINFO["pma"].
+
+2023-02-02 Arnold D. Robbins <arnold@skeeve.com>
+
* gawktexi.in (Getopt Function): Fix for parsing long
options; first option if it took an argument didn't work.
Thanks to Przemek Kitszel <przemyslaw.kitszel@intel.com>
@@ -113,6 +178,12 @@
2022-12-11 Arnold D. Robbins <arnold@skeeve.com>
+ * main.c (Auto-set): Remove documentation "mb_cur_max" and "utf8"
+ entries in PROCINFO, they're not of any real use.
+ (Feature History): Ditto.
+
+2022-12-11 Arnold D. Robbins <arnold@skeeve.com>
+
* gawktexi.in (Auto-set): Document PROCINFO["pma"].
(Feature History): Ditto.
And per Antonio Colombo, make sample output of --version
@@ -128,6 +199,11 @@
* gawktexi.in (Persistent Memory): Document that using / not using
-M across invocations doesn't work and issues a fatal error message.
+2022-12-01 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Feature History): Document removal of use of
+ libsigsegv.
+
2022-11-17 Arnold D. Robbins <arnold@skeeve.com>
* 5.2.1: Release tar ball made.
@@ -148,11 +224,23 @@
2022-11-14 Arnold D. Robbins <arnold@skeeve.com>
- * gawktexi.in: Typo fix.
+ * gawktexi.in: Typo fix. Additional index entries for FS as ",",
+ thanks to Antonio Colombo for the suggestion.
2022-11-13 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Other Versions): Add info on awkcc.
+ * gawktexi.in (Feature History): Document "mb_cur_max" and "utf8"
+ elements in PROCINFO.
+
+2022-11-12 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Comma Separated Fields): Add indexing. Expand text
+ some, particular that newlines can't be embedded.
+ (Splitting By Content): Additional text that FS = "," obsoletes
+ the example.
+ * wordlist: Updated.
+ * awkcard.in: Typo fix: CVS --> CSV.
2022-11-06 Arnold D. Robbins <arnold@skeeve.com>
@@ -212,6 +300,23 @@
* gawkinet.texi: Fix update date and version.
+2022-09-01 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in(String Functions): Document "," as separator
+ for split().
+
+2022-08-31 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkcard.in: Add a sentence on FS = "," to the reference card.
+
+2022-08-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Comma Separated Fields): New node on CSV parsing.
+ (Field Splitting Summary): Add entry about FS = ",".
+
+ Note to self, FS = "," invalidates earlier examples in the
+ manual. Dang!!!
+
2022-08-25 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Bug definition): Add a note about fuzzers.
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 3b173788..edbbca33 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -122,11 +122,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
- $(top_srcdir)/m4/libsigsegv.m4 $(top_srcdir)/m4/longlong.m4 \
- $(top_srcdir)/m4/mpfr.m4 $(top_srcdir)/m4/nls.m4 \
- $(top_srcdir)/m4/noreturn.m4 $(top_srcdir)/m4/pma.m4 \
- $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
- $(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/socket.m4 \
+ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/mpfr.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/noreturn.m4 \
+ $(top_srcdir)/m4/pma.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/readline.m4 \
+ $(top_srcdir)/m4/socket.m4 \
$(top_srcdir)/m4/triplet-transformation.m4 \
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -263,7 +263,6 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GREP = @GREP@
-HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -278,13 +277,10 @@ LIBMPFR = @LIBMPFR@
LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
-LIBSIGSEGV = @LIBSIGSEGV@
-LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
-LTLIBSIGSEGV = @LTLIBSIGSEGV@
MAKEINFO = @MAKEINFO@ --no-split --force
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
diff --git a/doc/awkcard.in b/doc/awkcard.in
index 9ece92e6..3b0cf3af 100644
--- a/doc/awkcard.in
+++ b/doc/awkcard.in
@@ -275,6 +275,8 @@ Include library AWK code in \*(FIfile\*(FR.
See \fHAwk Program Execution\*(FR.
.TI "\*(FC\-I\*(FR, \*(FC\-\^\-trace\*(FR
Print the internal byte code names as they are executed.
+.TI "\*(FC\-k\*(FR, \*(FC\-\^\-csv\*(FR
+Enable CSV special processing. See the manual for details.
.TI "\*(FC\-l \*(FIlib\*(FR, \*(FC\-\^\-load \*(FIlib\*(FR
Load dynamic extension \*(FIlib\fP.
See \fHDynamic Extensions\*(FR.
@@ -302,9 +304,7 @@ Send profiling data to \*(FIfile\*(FR
(default: \*(FCawkprof.out\*(FR).
The profile contains execution counts in the left margin.
.TI "\*(FC\-P\*(FR, \*(FC\-\^\-posix\*(FR
-Disable common and GNU extensions.
-.TI "\*(FC\-r\*(FR, \*(FC\-\^\-re\-interval\*(FR
-Does nothing; for backwards compatibility only.\*(CB
+Disable common and GNU extensions.\*(CB
.in -4n
.EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (\*(GK\f(HB)\*(FR\s0"
@@ -316,6 +316,8 @@ Does nothing; for backwards compatibility only.\*(CB
.ES
.fi
.in +4n
+.TI "\*(FC\-r\*(FR, \*(FC\-\^\-re\-interval\*(FR
+Does nothing; for backwards compatibility only.
.TI "\*(FC\-s\*(FR, \*(FC\-\^\-no\-optimize\*(FR
Disable internal optimizations.
.TI "\*(FC\-S\*(FR, \*(FC\-\^\-sandbox\*(FR
@@ -405,9 +407,9 @@ Either the pattern or the action may be missing, but
not both. If the pattern is missing, the action is
executed for every input record.
A missing action is equivalent to
-.sp .5
- \*(FC{ print }\fP
-.sp .5
+.\" .sp .5
+\*(FC{ print }\fP
+.\" .sp .5
which prints the entire record.
.sp .5
Comments begin with the \*(FC#\*(FR character, and continue until the
@@ -972,7 +974,8 @@ lp8 lp8 lp8 lp8.
\*(FC\ef\fP~form feed~\*(FC\ev\fP~vertical tab
\*(FC\en\fP~newline~\*(FC\e\e\fP~backslash
\*(FC\e\*(FIddd\*(FR~octal value \*(FIddd\fP~\*(CL\*(FC\ex\*(FIhh\*(FR~hex value \*(FIhh\fP\*(CD
-\*(FC\e"\fP~double quote~\*(FC\e/\fP~forward slash\*(CX
+\*(FC\e"\fP~double quote~\*(FC\e/\fP~forward slash
+\*(CL\*(FC\eu\*(FIhh...\fR~unicode character\*(CX
.TE
.EB "\s+2\f(HBESCAPE SEQUENCES\*(FR\s0"
.sp
@@ -1026,6 +1029,8 @@ is a single space, fields are separated
by runs of spaces and/or tabs
and/or newlines.
Leading and trailing whitespace are ignored.
+\*(CLIn the second special case that \*(FCFS\fP is a comma,
+then CSV-splitting is done.\*(CD
\*(CBThe value of \*(FCIGNORECASE\fP
also affects how fields are split when
\*(FCFS\fP is a regular expression.\*(CD
diff --git a/doc/gawk.1 b/doc/gawk.1
index c5cbe87d..eb5980d5 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -234,6 +234,12 @@ is preceded by a
.B +
sign in the output.
.TP
+\fB\-k\fR, \fB\-\^\-csv\fR
+Enable CSV special processing.
+See the manual for details.
+.BR FIXME :
+eventually provide a URL here.
+.TP
.BI \-l " lib\fR, "\c
.BI \-\^\-load " lib"
Load a
@@ -638,6 +644,20 @@ Similarly, assigning a value to
.B $0
causes the record to be resplit, creating new
values for the fields.
+.SS Comma Separated Values
+When invoked with the
+.B \-\^\-csv
+option,
+.I gawk
+does not use regular record determination and field splitting
+as described above.
+Instead, records are terminated by unquoted newlines, and
+fields are separated by commas.
+Double-quotes may be used to enclose fields containing
+commas, newlines, or doubled double-quotes.
+See
+.B FIXME
+in the manual for more detail.
.SS Built-in Variables
.IR Gawk\^ "'s"
built-in variables are listed below.
diff --git a/doc/gawk.info b/doc/gawk.info
index 309eb15e..056fc2cc 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -4,8 +4,8 @@ Copyright © 1989, 1991, 1992, 1993, 1996–2005, 2007, 2009–2023
Free Software Foundation, Inc.
- This is Edition 5.2 of ‘GAWK: Effective AWK Programming: A User’s
-Guide for GNU Awk’, for the 5.2.2 (or later) version of the GNU
+ This is Edition 5.3 of ‘GAWK: Effective AWK Programming: A User’s
+Guide for GNU Awk’, for the 5.3.0 (or later) version of the GNU
implementation of AWK.
Permission is granted to copy, distribute and/or modify this document
@@ -41,8 +41,8 @@ particular records in a file and perform operations upon them.
Free Software Foundation, Inc.
- This is Edition 5.2 of ‘GAWK: Effective AWK Programming: A User’s
-Guide for GNU Awk’, for the 5.2.2 (or later) version of the GNU
+ This is Edition 5.3 of ‘GAWK: Effective AWK Programming: A User’s
+Guide for GNU Awk’, for the 5.3.0 (or later) version of the GNU
implementation of AWK.
Permission is granted to copy, distribute and/or modify this document
@@ -193,6 +193,7 @@ in (a) below. A copy of the license is included in the section entitled
* Regexp Field Splitting:: Using regexps as the field separator.
* Single Character Fields:: Making each character a separate
field.
+* Comma Separated Fields:: Working with CSV files.
* Command Line Field Separator:: Setting ‘FS’ from the command
line.
* Full Line Fields:: Making the full line be a single
@@ -260,6 +261,7 @@ in (a) below. A copy of the license is included in the section entitled
Pipes.
* Close Return Value:: Using the return value from
‘close()’.
+* Noflush:: Speeding Up Pipe Output.
* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
@@ -442,6 +444,8 @@ in (a) below. A copy of the license is included in the section entitled
shell.
* Isnumeric Function:: A function to test whether a value is
numeric.
+* To CSV Function:: A function to convert output to CSV
+ format.
* Data File Management:: Functions for managing command-line
data files.
* Filetrans Function:: A function for handling data file
@@ -964,6 +968,10 @@ release.
After eight years, add another part ‘egrep’ and two more parts C.
Document very well and release.
+ After 35 more years, add Unicode and CSV support, sprinkle lightly
+with a few choice features from ‘gawk’, document very well again, and
+release.
+
The name ‘awk’ comes from the initials of its designers: Alfred V.
Aho, Peter J. Weinberger, and Brian W. Kernighan. The original version
of ‘awk’ was written in 1977 at AT&T Bell Laboratories. In 1985, a new
@@ -2715,6 +2723,12 @@ The following list describes options mandated by the POSIX standard:
running the program. The trace is printed to standard error. Each
“op code” is preceded by a ‘+’ sign in the output.
+‘-k’
+‘--csv’
+ Enable special processing for files with comma separated values
+ (CSV). *Note Comma Separated Fields::. This option cannot be used
+ with ‘--posix’. Attempting to do causes a fatal error.
+
‘-l’ EXT
‘--load’ EXT
Load a dynamic extension named EXT. Extensions are stored as
@@ -3719,6 +3733,20 @@ sequences apply to both string constants and regexp constants:
produced undefined results. As of version 4.2, only two
digits are processed.
+‘\uHH...’
+ The hexadecimal value HH, where HH stands for a sequence of
+ hexadecimal digits (‘0’–‘9’, and either ‘A’–‘F’ or ‘a’–‘f’). A
+ maximum of eight digits are allowed after the ‘\u’. Any further
+ hexadecimal digits are treated as simple letters or numbers.
+ (c.e.) (The ‘\u’ escape sequence is not allowed in POSIX awk.)
+
+ This escape sequence is intended for designating a character in the
+ Unicode character set. ‘gawk’ first converts the given digits into
+ an integer and then translates the given “wide character” value
+ into the current locale’s multibyte encoding (even if that is a not
+ a Unicode locale). If the given bytes do not represent a valid
+ character, the value becomes ‘"?"’.
+
‘\/’
A literal slash (should be used for regexp constants only). This
sequence is used when you want to write a regexp constant that
@@ -4553,6 +4581,10 @@ variable ‘RS’. If ‘RS’ is any single character, that character
separates records. Otherwise (in ‘gawk’), ‘RS’ is treated as a regular
expression. This mechanism is explained in greater detail shortly.
+ NOTE: When ‘gawk’ is invoked with the ‘--csv’ option, nothing in
+ this minor node applies. *Note Comma Separated Fields::, for the
+ details.
+
* Menu:
* awk split records:: How standard ‘awk’ splits records.
@@ -5064,6 +5096,7 @@ File: gawk.info, Node: Field Separators, Next: Constant Size, Prev: Changing
* Default Field Splitting:: How fields are normally separated.
* Regexp Field Splitting:: Using regexps as the field separator.
* Single Character Fields:: Making each character a separate field.
+* Comma Separated Fields:: Working with CSV files.
* Command Line Field Separator:: Setting ‘FS’ from the command line.
* Full Line Fields:: Making the full line be a single field.
* Field Splitting Summary:: Some final points and a summary table.
@@ -5093,13 +5126,13 @@ time to do this is at the beginning of execution before any input has
been processed, so that the very first record is read with the proper
separator. To do this, use the special ‘BEGIN’ pattern (*note
BEGIN/END::). For example, here we set the value of ‘FS’ to the string
-‘","’:
+‘":"’:
- awk 'BEGIN { FS = "," } ; { print $2 }'
+ awk 'BEGIN { FS = ":" } ; { print $2 }'
Given the input line:
- John Q. Smith, 29 Oak St., Walamazoo, MI 42139
+ John Q. Smith: 29 Oak St.: Walamazoo: MI 42139
this ‘awk’ program extracts and prints the string ‘•29•Oak•St.’.
@@ -5108,7 +5141,7 @@ separate fields the way you thought they would. For instance, the
person’s name in the example we just used might have a title or suffix
attached, such as:
- John Q. Smith, LXIX, 29 Oak St., Walamazoo, MI 42139
+ John Q. Smith: LXIX: 29 Oak St.: Walamazoo: MI 42139
The same program would extract ‘•LXIX’ instead of ‘•29•Oak•St.’. If you
were expecting the program to print the address, you would be surprised.
@@ -5223,7 +5256,7 @@ string; field splitting does not. Thus, for example ‘FS = "()"’ does
_not_ split fields between characters.

-File: gawk.info, Node: Single Character Fields, Next: Command Line Field Separator, Prev: Regexp Field Splitting, Up: Field Separators
+File: gawk.info, Node: Single Character Fields, Next: Comma Separated Fields, Prev: Regexp Field Splitting, Up: Field Separators
4.5.3 Making Each Character a Separate Field
--------------------------------------------
@@ -5249,9 +5282,86 @@ Options::), if ‘FS’ is the null string, then ‘gawk’ also behaves this
way.

-File: gawk.info, Node: Command Line Field Separator, Next: Full Line Fields, Prev: Single Character Fields, Up: Field Separators
+File: gawk.info, Node: Comma Separated Fields, Next: Command Line Field Separator, Prev: Single Character Fields, Up: Field Separators
+
+4.5.4 Working With Comma Separated Value Files
+----------------------------------------------
+
+Many commonly-used tools use a comma to separate fields, instead of
+whitespace. This is particularly true of popular spreadsheet programs.
+There is no universally accepted standard for the format of these files,
+although RFC 4180 (http://www.ietf.org/rfc/rfc4180) lists the common
+practices.
+
+ For decades, anyone wishing to work with CSV files and ‘awk’ had to
+“roll their own” solution. (For an example, *note Splitting By
+Content::). In 2023, Brian Kernighan decided to add CSV support to his
+version of ‘awk’. In order to keep up, ‘gawk’ too provides the same
+support as his version. To use CSV data, invoke ‘gawk’ with either of
+the ‘-k’ or ‘--csv’ options.
+
+ Fields in CSV files are separated by commas. In order to allow a
+comma to appear inside a field (i.e., as data), the field may be quoted
+by beginning and ending it with double quotes. In order to allow a
+double quote inside a field, the field _must_ be quoted, and two double
+quotes represent an actual double quote. The double quote that starts a
+quoted field must be the first character after the comma. *note Table
+4.1: table-csv-examples. shows some examples.
+
+
+Input Field Contents
+----------------------------------------------
+‘abc def’ ‘abc def’
+‘"quoted data"’ ‘quoted data’
+‘"quoted, data"’ ‘quoted, data’
+‘"She said ‘She said "Stop!".’
+""Stop!""."’
+
+Table 4.1: Examples of CSV data
-4.5.4 Setting ‘FS’ from the Command Line
+ Additionally, and here’s where it gets messy, newlines are also
+allowed inside double-quoted fields! In order to deal with such things,
+when processing CSV files, ‘gawk’ scans the input data looking for
+newlines that are not enclosed in double quotes. Thus, use of the
+‘--csv’ option totally overrides normal record processing with ‘RS’
+(*note Records::), as well as field splitting with any of ‘FS’,
+‘FIELDWIDTHS’, or ‘FPAT’.
+
+ Carriage-Return–Line-Feed Line Endings In CSV Files
+
+ ‘\r\n’ is the invention of the devil.
+ — _Brian Kernighan_
+
+ Many CSV files are imported from systems where the line terminator
+for text files is a carriage-return–line-feed pair (CR-LF, ‘\r’ followed
+by ‘\n’). For ease of use, when processing CSV files, ‘gawk’ converts
+CR-LF pairs into a single newline. That is, the ‘\r’ is removed.
+
+ This occurs only when a CR is paired with an LF; a standalone CR is
+left alone. This behavior is consistent with with Windows systems which
+automatically convert CR-LF in files into a plain LF in memory, and also
+with the commonly available ‘unix2dos’ utility program.
+
+ The behavior of the ‘split()’ function (not formally discussed yet,
+see *note String Functions::) differs slightly when processing CSV
+files. When called with two arguments (‘split(STRING, ARRAY)’),
+‘split()’ does CSV-based splitting. Otherwise, it behaves normally.
+
+ If ‘--csv’ has been used, ‘PROCINFO["CSV"]’ will exist. Otherwise,
+it will not. *Note Auto-set::.
+
+ Finally, if ‘--csv’ has been used, assigning a value to any of ‘FS’,
+‘FIELDWIDTHS’, ‘FPAT’, or ‘RS’ generates a warning message.
+
+ To be clear, ‘gawk’ takes RFC 4180 (http://www.ietf.org/rfc/rfc4180)
+as its specification for CSV input data. There are no mechanisms for
+accepting nonstandard CSV data, such as files that use a semicolon
+instead of a comma as the separator.
+
+
+File: gawk.info, Node: Command Line Field Separator, Next: Full Line Fields, Prev: Comma Separated Fields, Up: Field Separators
+
+4.5.5 Setting ‘FS’ from the Command Line
----------------------------------------
‘FS’ can be set on the command line. Use the ‘-F’ option to do so. For
@@ -5329,7 +5439,7 @@ the entries for users whose full name is not indicated:

File: gawk.info, Node: Full Line Fields, Next: Field Splitting Summary, Prev: Command Line Field Separator, Up: Field Separators
-4.5.5 Making the Full Line Be a Single Field
+4.5.6 Making the Full Line Be a Single Field
--------------------------------------------
Occasionally, it’s useful to treat the whole input line as a single
@@ -5377,7 +5487,7 @@ defined by the POSIX standard.

File: gawk.info, Node: Field Splitting Summary, Prev: Full Line Fields, Up: Field Separators
-4.5.6 Field-Splitting Summary
+4.5.7 Field-Splitting Summary
-----------------------------
It is important to remember that when you assign a string constant as
@@ -5391,10 +5501,18 @@ period followed by any single character, use ‘FS = "\\.."’.
The following list summarizes how fields are split, based on the
value of ‘FS’ (‘==’ means “is equal to”):
+‘gawk was invoked with --csv’
+ Field splitting follows the rules given in *note Comma Separated
+ Fields::. The value of ‘FS’ is ignored.
+
‘FS == " "’
Fields are separated by runs of whitespace. Leading and trailing
whitespace are ignored. This is the default.
+‘FS == ","’
+ Fields are separated by commas, with quoting of fields and special
+ rules involved.
+
‘FS == ANY OTHER SINGLE CHARACTER’
Fields are separated by each occurrence of the character. Multiple
successive occurrences delimit empty fields, as do leading and
@@ -5621,13 +5739,16 @@ File: gawk.info, Node: Splitting By Content, Next: Testing field creation, Pr
4.7 Defining Fields by Content
==============================
+*FIXME*: This whole section needs rewriting now that ‘gawk’ has built-in
+CSV parsing. Sigh.
+
* Menu:
* More CSV:: More on CSV files.
* FS versus FPAT:: A subtle difference.
-This minor node discusses an advanced feature of ‘gawk’. If you are a
-novice ‘awk’ user, you might want to skip it on the first reading.
+ This minor node discusses an advanced feature of ‘gawk’. If you are
+a novice ‘awk’ user, you might want to skip it on the first reading.
Normally, when using ‘FS’, ‘gawk’ defines the fields as the parts of
the record that occur in between each field separator. In other words,
@@ -5635,13 +5756,13 @@ the record that occur in between each field separator. In other words,
However, there are times when you really want to define the fields by
what they are, and not by what they are not.
- The most notorious such case is so-called “comma-separated values”
-(CSV) data. Many spreadsheet programs, for example, can export their
-data into text files, where each record is terminated with a newline,
-and fields are separated by commas. If commas only separated the data,
-there wouldn’t be an issue. The problem comes when one of the fields
-contains an _embedded_ comma. In such cases, most programs embed the
-field in double quotes.(1) So, we might have data like this:
+ The most notorious such case is comma-separated values (CSV) data.
+Many spreadsheet programs, for example, can export their data into text
+files, where each record is terminated with a newline, and fields are
+separated by commas. If commas only separated the data, there wouldn’t
+be an issue. The problem comes when one of the fields contains an
+_embedded_ comma. In such cases, most programs embed the field in
+double quotes.(1) So, we might have data like this:
Robbins,Arnold,"1234 A Pretty Street, NE",MyTown,MyState,12345-6789,USA
@@ -5716,6 +5837,11 @@ with ‘FIELDWIDTHS’.
Finally, the ‘patsplit()’ function makes the same functionality
available for splitting regular strings (*note String Functions::).
+ NOTE: Given that ‘gawk’ now has built-in CSV parsing (*note Comma
+ Separated Fields::), the examples presented here are obsolete.
+ Nonetheless, it remains useful as an example of what ‘FPAT’-based
+ field parsing can do.
+
---------- Footnotes ----------
(1) The CSV format lacked a formal standard definition for many
@@ -5829,7 +5955,9 @@ field splitting is being used, ‘"FIELDWIDTHS"’ if fixed-width field
splitting is being used, or ‘"FPAT"’ if content-based field splitting is
being used:
- if (PROCINFO["FS"] == "FS")
+ if ("CSV" in PROCINFO)
+ CSV-BASED FIELD SPLITTING ...
+ else if (PROCINFO["FS"] == "FS")
REGULAR FIELD SPLITTING ...
else if (PROCINFO["FS"] == "FIELDWIDTHS")
FIXED-WIDTH FIELD SPLITTING ...
@@ -5839,9 +5967,9 @@ being used:
API INPUT PARSER FIELD SPLITTING ... (advanced feature)
This information is useful when writing a function that needs to
-temporarily change ‘FS’ or ‘FIELDWIDTHS’, read some records, and then
-restore the original settings (*note Passwd Functions:: for an example
-of such a function).
+temporarily change ‘FS’, ‘FIELDWIDTHS’, or ‘FPAT’, read some records,
+and then restore the original settings (*note Passwd Functions:: for an
+example of such a function).

File: gawk.info, Node: Multiple Line, Next: Getline, Prev: Testing field creation, Up: Reading Files
@@ -6436,7 +6564,7 @@ File: gawk.info, Node: Getline Summary, Prev: Getline Notes, Up: Getline
4.10.10 Summary of ‘getline’ Variants
-------------------------------------
-*note Table 4.1: table-getline-variants. summarizes the eight variants
+*note Table 4.2: table-getline-variants. summarizes the eight variants
of ‘getline’, listing which predefined variables are set by each one,
and whether the variant is standard or a ‘gawk’ extension. Note: for
each variant, ‘gawk’ sets the ‘RT’ predefined variable.
@@ -6457,7 +6585,7 @@ COMMAND ‘|& getline’ Sets ‘$0’, ‘NF’, and ‘RT’ ‘gawk’
COMMAND ‘|& getline’ Sets VAR and ‘RT’ ‘gawk’
VAR
-Table 4.1: ‘getline’ variants and what they set
+Table 4.2: ‘getline’ variants and what they set

File: gawk.info, Node: Read Timeout, Next: Retrying Input, Prev: Getline, Up: Reading Files
@@ -6723,6 +6851,7 @@ function.
‘gawk’ allows access to inherited file
descriptors.
* Close Files And Pipes:: Closing Input and Output Files and Pipes.
+* Noflush:: Speeding Up Pipe Output.
* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
@@ -7655,7 +7784,7 @@ that ‘gawk’ provides:
behavior.

-File: gawk.info, Node: Close Files And Pipes, Next: Nonfatal, Prev: Special Files, Up: Printing
+File: gawk.info, Node: Close Files And Pipes, Next: Noflush, Prev: Special Files, Up: Printing
5.9 Closing Input and Output Redirections
=========================================
@@ -7847,9 +7976,46 @@ co-process was the full 16-bit exit value as defined by the ‘wait()’
system call.

-File: gawk.info, Node: Nonfatal, Next: Output Summary, Prev: Close Files And Pipes, Up: Printing
+File: gawk.info, Node: Noflush, Next: Nonfatal, Prev: Close Files And Pipes, Up: Printing
+
+5.10 Speeding Up Pipe Output
+============================
+
+This minor node describes a ‘gawk’-specific feature.
+
+ Normally, when you send data down a pipeline to a command with
+‘print’ or ‘printf’, ‘gawk’ “flushes” the output down the pipe. That
+is, output is not buffered, but written directly. This assures, that
+pipeline output intermixed with ‘gawk’’s output comes out in the
+expected order:
+
+ print "something" # goes to standard output
+ print "something else" | "some-command" # also to standard output
+ print "more stuff" # and this too
+
+ There can be a price to pay for this; flushing data down the pipeline
+uses more CPU time, and in certain environments this can become
+expensive.
+
+ You can tell ‘gawk’ not to flush buffered data in one of two ways:
+
+ • Set ‘PROCINFO["BUFFERPIPE"]’ to any value. When this is done,
+ ‘gawk’ will buffer data for all pipelines.
-5.10 Enabling Nonfatal Output
+ • Set ‘PROCINFO["COMMAND", "BUFFERPIPE"]’ to any value. In this
+ case, only COMMAND’s data will be fully buffered.
+
+ You _must_ create one or the other of these elements in ‘PROCINFO’
+before the first ‘print’ or ‘printf’ to the pipeline. Doing so after
+output has already been sent is too late.
+
+ Be aware that using this feature may change the output behavior of
+your programs, so exercise caution.
+
+
+File: gawk.info, Node: Nonfatal, Next: Output Summary, Prev: Noflush, Up: Printing
+
+5.11 Enabling Nonfatal Output
=============================
This minor node describes a ‘gawk’-specific feature.
@@ -7909,7 +8075,7 @@ is enabled for a given socket, ‘gawk’ only retries once, relying on

File: gawk.info, Node: Output Summary, Next: Output Exercises, Prev: Nonfatal, Up: Printing
-5.11 Summary
+5.12 Summary
============
• The ‘print’ statement prints comma-separated expressions. Each
@@ -7939,7 +8105,7 @@ File: gawk.info, Node: Output Summary, Next: Output Exercises, Prev: Nonfatal

File: gawk.info, Node: Output Exercises, Prev: Output Summary, Up: Printing
-5.12 Exercises
+5.13 Exercises
==============
1. Rewrite the program:
@@ -8091,7 +8257,7 @@ Other Versions::) elide the backslash and newline, as in C:
In POSIX mode (*note Options::), ‘gawk’ does not allow escaped
newlines. Otherwise, it behaves as just described.
- BWK ‘awk’ and BusyBox ‘awk’ remove the backslash but leave the
+ BWK ‘awk’(2) and BusyBox ‘awk’ remove the backslash but leave the
newline intact, as part of the string:
$ nawk 'BEGIN { print "hello, \
@@ -8106,6 +8272,8 @@ uses double-precision floating-point numbers. On most modern systems,
these are in IEEE 754 standard format. *Note Arbitrary Precision
Arithmetic::, for much more information.
+ (2) In all examples throughout this Info file, ‘nawk’ is BWK ‘awk’.
+

File: gawk.info, Node: Nondecimal-numbers, Next: Regexp Constants, Prev: Scalar Constants, Up: Constants
@@ -11541,6 +11709,13 @@ they are not special:
The following elements allow you to change ‘gawk’’s behavior:
+ ‘PROCINFO["BUFFERPIPE"]’
+ If this element exists, all output to pipelines becomes
+ buffered. *Note Noflush::.
+
+ ‘PROCINFO["COMMAND", "BUFFERPIPE"]’
+ Make output to COMMAND buffered. *Note Noflush::.
+
‘PROCINFO["NONFATAL"]’
If this element exists, then I/O errors for all redirections
become nonfatal. *Note Nonfatal::.
@@ -13472,6 +13647,13 @@ Options::):
The value returned by this call to ‘split()’ is three.
+ If ‘gawk’ is invoked with ‘--csv’, then a two-argument call to
+ ‘split()’ splits the string using the CSV parsing rules as
+ described in *note Comma Separated Fields::. With three and four
+ arguments, ‘split()’ works as just described. The four-argument
+ call makes no sense, since each element of SEPS would simply
+ consist of a string containing a comma.
+
As with input field-splitting, when the value of FIELDSEP is ‘" "’,
leading and trailing whitespace is ignored in values assigned to
the elements of ARRAY but not in SEPS, and the elements are
@@ -15378,9 +15560,9 @@ others do this:
⊣ 1
Or ‘awk’ could wait until runtime to set the type of ‘a’. In this
-case, since ‘a’ was never assigned used before being passed to the
-function, how the function uses it forces the type to be resolved to
-either scalar or array. ‘gawk’ and the MKS ‘awk’ do this:
+case, since ‘a’ was never used before being passed to the function, how
+the function uses it forces the type to be resolved to either scalar or
+array. ‘gawk’ and the MKS ‘awk’ do this:
$ gawk -v A=0 -f funky.awk
⊣ <>
@@ -15956,6 +16138,7 @@ programming use.
* Readfile Function:: A function to read an entire file at once.
* Shell Quoting:: A function to quote strings for the shell.
* Isnumeric Function:: A function to test whether a value is numeric.
+* To CSV Function:: A function to convert output to CSV format.

File: gawk.info, Node: Strtonum Function, Next: Assert Function, Up: General Functions
@@ -16543,7 +16726,7 @@ three-character string ‘"\"'\""’:
}

-File: gawk.info, Node: Isnumeric Function, Prev: Shell Quoting, Up: General Functions
+File: gawk.info, Node: Isnumeric Function, Next: To CSV Function, Prev: Shell Quoting, Up: General Functions
10.2.10 Checking Whether A Value Is Numeric
-------------------------------------------
@@ -16580,6 +16763,69 @@ yield the original string. On the other hand, it uses the ‘typeof()’
function (*note Type Functions::), which is specific to ‘gawk’.

+File: gawk.info, Node: To CSV Function, Prev: Isnumeric Function, Up: General Functions
+
+10.2.11 Producing CSV Data
+--------------------------
+
+‘gawk’’s ‘--csv’ option causes ‘gawk’ to process CSV data (*note Comma
+Separated Fields::).
+
+ But what if you have regular data that you want to output in CSV
+format? This minor node provides functions for doing that.
+
+ The first function, ‘tocsv()’, takes an array of data fields as
+input. The array should be indexed starting from one. The optional
+second parameter is the separator to use. If none is supplied, the
+default is a comma.
+
+ The function takes care to quote fields that contain double quotes,
+newlines, or the separator character. It then builds up the final CSV
+record and returns it.
+
+ # tocsv.awk --- convert data to CSV format
+
+ function tocsv(fields, sep, i, j, nfields, result)
+ {
+ if (length(fields) == 0)
+ return ""
+
+ if (sep == "")
+ sep = ","
+ delete nfields
+ for (i = 1; i in fields; i++) {
+ nfields[i] = fields[i]
+ if (nfields[i] ~ /["\n]/ || index(nfields[i], sep) != 0) {
+ gsub(/"/, "\"\"", nfields[i]) # double up quotes
+ nfields[i] = "\"" nfields[i] "\"" # wrap in quotes
+ }
+ }
+
+ result = nfields[1]
+ j = length(nfields)
+ for (i = 2; i <= j; i++)
+ result = result sep nfields[i]
+
+ return result
+ }
+
+ The next function, ‘tocsv_rec()’ is a wrapper around ‘tocsv()’. Its
+intended use is for when you want to convert the current input record to
+CSV format. The function itself simply copies the fields into an array
+to pass to ‘tocsv()’ which does the work. It accepts an optional
+separator character as its first parameter, which it simply passes on to
+‘tocsv()’.
+
+ function tocsv_rec(sep, i, fields)
+ {
+ delete fields
+ for (i = 1; i <= NF; i++)
+ fields[i] = $i
+
+ return tocsv(fields, sep)
+ }
+
+
File: gawk.info, Node: Data File Management, Next: Getopt Function, Prev: General Functions, Up: Library Functions
10.3 Data file Management
@@ -30756,6 +31002,20 @@ unfortunately. It added the following features:
• ‘PROCINFO["pma"]’ exists if the PMA allocator is compiled in (*note
Auto-set::).
+ Version 5.3 added the following features:
+
+ • Comma separated value (CSV) field splitting (*note Comma Separated
+ Fields::).
+
+ • The ability to make ‘gawk’ buffer output to pipes (*note
+ Noflush::).
+
+ • The ‘\u’ escape sequence (*note Escape Sequences::).
+
+ • The need for GNU ‘libsigsegv’ was removed from ‘gawk’. The
+ value-add was never very much and it caused problems in some
+ environments.
+

File: gawk.info, Node: Common Extensions, Next: Ranges and Locales, Prev: Feature History, Up: Language History
@@ -30770,10 +31030,12 @@ Feature BWK ‘awk’ ‘mawk’ ‘gawk’ Now stand
--------------------------------------------------------------------------
‘**’ and ‘**=’ operators X X
‘\x’ escape sequence X X X
+‘\u’ escape sequence X X
‘/dev/stdin’ special file X X X
‘/dev/stdout’ special file X X X
‘/dev/stderr’ special file X X X
‘BINMODE’ variable X X
+CSV support X X
‘FS’ as null string X X X
‘delete’ without subscript X X X X
‘fflush()’ function X X X X
@@ -31131,7 +31393,7 @@ There are two ways to get GNU software:
supported. If you have the ‘wget’ program, you can use a command
like the following:
- wget https://ftp.gnu.org/gnu/gawk/gawk-5.2.2.tar.gz
+ wget https://ftp.gnu.org/gnu/gawk/gawk-5.3.0.tar.gz
The GNU software archive is mirrored around the world. The
up-to-date list of mirror sites is available from the main FSF website
@@ -31153,25 +31415,25 @@ compression programs: ‘gzip’, ‘bzip2’, and ‘xz’. For simplicity, th
rest of these instructions assume you are using the one compressed with
the GNU Gzip program (‘gzip’).
- Once you have the distribution (e.g., ‘gawk-5.2.2.tar.gz’), use
+ Once you have the distribution (e.g., ‘gawk-5.3.0.tar.gz’), use
‘gzip’ to expand the file and then use ‘tar’ to extract it. You can use
the following pipeline to produce the ‘gawk’ distribution:
- gzip -d -c gawk-5.2.2.tar.gz | tar -xvpf -
+ gzip -d -c gawk-5.3.0.tar.gz | tar -xvpf -
On a system with GNU ‘tar’, you can let ‘tar’ do the decompression
for you:
- tar -xvpzf gawk-5.2.2.tar.gz
+ tar -xvpzf gawk-5.3.0.tar.gz
-Extracting the archive creates a directory named ‘gawk-5.2.2’ in the
+Extracting the archive creates a directory named ‘gawk-5.3.0’ in the
current directory.
The distribution file name is of the form ‘gawk-V.R.P.tar.gz’. The V
represents the major version of ‘gawk’, the R represents the current
release of version V, and the P represents a “patch level”, meaning that
minor bugs have been fixed in the release. The current patch level is
-2, but when retrieving distributions, you should get the version with
+0, but when retrieving distributions, you should get the version with
the highest version, release, and patch level. (Note, however, that
patch levels greater than or equal to 60 denote “beta” or nonproduction
software; you might not want to retrieve such a version unless you don’t
@@ -31428,7 +31690,7 @@ Unix-derived systems, GNU/Linux, BSD-based systems, and the Cygwin
environment for MS-Windows.
After you have extracted the ‘gawk’ distribution, ‘cd’ to
-‘gawk-5.2.2’. As with most GNU software, you configure ‘gawk’ for your
+‘gawk-5.3.0’. As with most GNU software, you configure ‘gawk’ for your
system by running the ‘configure’ program. This program is a Bourne
shell script that is generated automatically using GNU Autoconf. (The
Autoconf software is described fully starting with *note Autoconf:
@@ -31848,8 +32110,8 @@ environment provides an excellent simulation of GNU/Linux, using Bash,
GCC, GNU Make, and other GNU programs. Compilation and installation for
Cygwin is the same as for a Unix system:
- tar -xvpzf gawk-5.2.2.tar.gz
- cd gawk-5.2.2
+ tar -xvpzf gawk-5.3.0.tar.gz
+ cd gawk-5.3.0
./configure
make && make check
@@ -32738,9 +33000,9 @@ B.6 Summary
• The ‘gawk’ distribution is available from the GNU Project’s main
distribution site, ‘ftp.gnu.org’. The canonical build recipe is:
- wget https://ftp.gnu.org/gnu/gawk/gawk-5.2.2.tar.gz
- tar -xvpzf gawk-5.2.2.tar.gz
- cd gawk-5.2.2
+ wget https://ftp.gnu.org/gnu/gawk/gawk-5.3.0.tar.gz
+ tar -xvpzf gawk-5.3.0.tar.gz
+ cd gawk-5.3.0
./configure && make && make check
NOTE: Because of the ‘https://’ URL, you may have to supply
@@ -35757,7 +36019,7 @@ Index
* * (asterisk), *= operator <1>: Precedence. (line 94)
* * (asterisk), **= operator <1>: Precedence. (line 94)
* * (asterisk), * operator, null strings, matching: String Functions.
- (line 563)
+ (line 570)
* + (plus sign), regexp operator: Regexp Operator Details.
(line 107)
* + (plus sign), += operator: Assignment Ops. (line 81)
@@ -35769,7 +36031,7 @@ Index
* + (plus sign), += operator <1>: Precedence. (line 94)
* , (comma), in range patterns: Ranges. (line 6)
* - (hyphen), file names beginning with: Options. (line 63)
-* - (hyphen), -- end of options marker: Options. (line 354)
+* - (hyphen), -- end of options marker: Options. (line 360)
* - (hyphen), in bracket expressions: Bracket Expressions. (line 25)
* - (hyphen), -= operator: Assignment Ops. (line 129)
* - (hyphen), -- operator: Increment Ops. (line 48)
@@ -35778,9 +36040,10 @@ Index
* - (hyphen), - operator <1>: Precedence. (line 57)
* - (hyphen), -= operator <1>: Precedence. (line 94)
* --assign option: Options. (line 36)
-* --bignum option: Options. (line 242)
+* --bignum option: Options. (line 248)
* --characters-as-bytes option: Options. (line 72)
* --copyright option: Options. (line 92)
+* --csv option: Options. (line 203)
* --debug option: Options. (line 111)
* --disable-extensions configuration option: Additional Configuration Options.
(line 9)
@@ -35804,22 +36067,22 @@ Index
* --help option: Options. (line 175)
* --include option: Options. (line 180)
* --lint option: Command Line. (line 20)
-* --lint option <1>: Options. (line 215)
-* --lint-old option: Options. (line 344)
-* --load option: Options. (line 203)
-* --no-optimize option: Options. (line 329)
-* --non-decimal-data option: Options. (line 255)
+* --lint option <1>: Options. (line 221)
+* --lint-old option: Options. (line 350)
+* --load option: Options. (line 209)
+* --no-optimize option: Options. (line 335)
+* --non-decimal-data option: Options. (line 261)
* --non-decimal-data option <1>: Nondecimal Data. (line 6)
* --non-decimal-data option, strtonum() function and: Nondecimal Data.
(line 35)
-* --optimize option: Options. (line 280)
-* --posix option: Options. (line 302)
-* --posix option, --traditional option and: Options. (line 317)
-* --pretty-print option: Options. (line 269)
-* --profile option: Options. (line 290)
+* --optimize option: Options. (line 286)
+* --posix option: Options. (line 308)
+* --posix option, --traditional option and: Options. (line 323)
+* --pretty-print option: Options. (line 275)
+* --profile option: Options. (line 296)
* --profile option <1>: Profiling. (line 12)
-* --re-interval option: Options. (line 323)
-* --sandbox option: Options. (line 334)
+* --re-interval option: Options. (line 329)
+* --sandbox option: Options. (line 340)
* --sandbox option, input redirection with getline: Getline. (line 19)
* --sandbox option, output redirection with print, printf: Redirection.
(line 6)
@@ -35828,9 +36091,9 @@ Index
* --source option: Options. (line 120)
* --trace option: Options. (line 197)
* --traditional option: Options. (line 85)
-* --traditional option, --posix option and: Options. (line 317)
-* --use-lc-numeric option: Options. (line 264)
-* --version option: Options. (line 349)
+* --traditional option, --posix option and: Options. (line 323)
+* --use-lc-numeric option: Options. (line 270)
+* --version option: Options. (line 355)
* -b option: Options. (line 72)
* -c option: Options. (line 85)
* -C option: Options. (line 92)
@@ -35838,33 +36101,34 @@ Index
* -D option: Options. (line 111)
* -e option: Options. (line 120)
* -E option: Options. (line 146)
-* -e option <1>: Options. (line 390)
+* -e option <1>: Options. (line 396)
* -f option: Long. (line 12)
* -F option: Options. (line 21)
* -f option <1>: Options. (line 25)
-* -F option, -Ft sets FS to TAB: Options. (line 362)
-* -f option, multiple uses: Options. (line 367)
+* -F option, -Ft sets FS to TAB: Options. (line 368)
+* -f option, multiple uses: Options. (line 373)
* -F option, command-line: Command Line Field Separator.
(line 6)
* -g option: Options. (line 168)
* -h option: Options. (line 175)
* -i option: Options. (line 180)
* -I option: Options. (line 197)
-* -l option: Options. (line 203)
-* -l option <1>: Options. (line 215)
-* -L option: Options. (line 344)
-* -M option: Options. (line 242)
-* -n option: Options. (line 255)
-* -N option: Options. (line 264)
-* -o option: Options. (line 269)
-* -O option: Options. (line 280)
-* -p option: Options. (line 290)
-* -P option: Options. (line 302)
-* -r option: Options. (line 323)
-* -s option: Options. (line 329)
-* -S option: Options. (line 334)
+* -k option: Options. (line 203)
+* -l option: Options. (line 209)
+* -l option <1>: Options. (line 221)
+* -L option: Options. (line 350)
+* -M option: Options. (line 248)
+* -n option: Options. (line 261)
+* -N option: Options. (line 270)
+* -o option: Options. (line 275)
+* -O option: Options. (line 286)
+* -p option: Options. (line 296)
+* -P option: Options. (line 308)
+* -r option: Options. (line 329)
+* -s option: Options. (line 335)
+* -S option: Options. (line 340)
* -v option: Options. (line 36)
-* -V option: Options. (line 349)
+* -V option: Options. (line 355)
* -v option <1>: Assignment Options. (line 12)
* -W option: Options. (line 50)
* . (period), regexp operator: Regexp Operator Details.
@@ -35953,11 +36217,12 @@ Index
* \ (backslash), \v escape sequence: Escape Sequences. (line 53)
* \ (backslash), \NNN escape sequence: Escape Sequences. (line 56)
* \ (backslash), \x escape sequence: Escape Sequences. (line 61)
-* \ (backslash), \/ escape sequence: Escape Sequences. (line 76)
-* \ (backslash), \" escape sequence: Escape Sequences. (line 85)
-* \ (backslash), in escape sequences <1>: Escape Sequences. (line 103)
+* \ (backslash), \u escape sequence: Escape Sequences. (line 76)
+* \ (backslash), \/ escape sequence: Escape Sequences. (line 90)
+* \ (backslash), \" escape sequence: Escape Sequences. (line 99)
+* \ (backslash), in escape sequences <1>: Escape Sequences. (line 117)
* \ (backslash), in escape sequences, POSIX and: Escape Sequences.
- (line 108)
+ (line 122)
* \ (backslash), regexp operator: Regexp Operator Details.
(line 14)
* \ (backslash), in bracket expressions: Bracket Expressions. (line 25)
@@ -36046,13 +36311,13 @@ Index
* adding, features to gawk: Adding Code. (line 6)
* advanced features, fixed-width data: Constant Size. (line 6)
* advanced features, specifying field content: Splitting By Content.
- (line 14)
+ (line 17)
* advanced features, gawk: Advanced Features. (line 6)
* advanced features, nondecimal input data: Nondecimal Data. (line 6)
* advanced features, processes, communicating with: Two-way I/O.
(line 6)
* advanced features, network programming: TCP/IP Networking. (line 6)
-* Aho, Alfred: History. (line 17)
+* Aho, Alfred: History. (line 21)
* Aho, Alfred <1>: Contributors. (line 12)
* alarm clock example program: Alarm Program. (line 11)
* alarm.awk program: Alarm Program. (line 31)
@@ -36100,7 +36365,7 @@ Index
* arguments, command-line <1>: Auto-set. (line 15)
* arguments, command-line <2>: ARGC and ARGV. (line 6)
* arguments, processing: Getopt Function. (line 6)
-* ARGV array: Options. (line 334)
+* ARGV array: Options. (line 340)
* ARGV array, indexing into: Other Arguments. (line 21)
* arithmetic operators: Arithmetic Ops. (line 6)
* array manipulation in extensions: Array Manipulation. (line 6)
@@ -36198,7 +36463,7 @@ Index
* asterisk (*), *= operator <1>: Precedence. (line 94)
* asterisk (*), **= operator <1>: Precedence. (line 94)
* asterisk (*), * operator, null strings, matching: String Functions.
- (line 563)
+ (line 570)
* at-sign (@), @include directive: Include Files. (line 8)
* at-sign (@), @load directive: Loading Shared Libraries.
(line 8)
@@ -36216,7 +36481,7 @@ Index
* awk, POSIX and <1>: Preface. (line 21)
* awk, gawk and: Preface. (line 21)
* awk, uses for: Preface. (line 21)
-* awk, history of: History. (line 17)
+* awk, history of: History. (line 21)
* awk, new vs. old: Names. (line 6)
* awk, terms describing: This Manual. (line 6)
* awk, gawk and <1>: This Manual. (line 14)
@@ -36224,7 +36489,7 @@ Index
* awk, uses for <1>: Getting Started. (line 12)
* awk, uses for <2>: When. (line 6)
* awk, invoking: Command Line. (line 6)
-* awk, profiling, enabling: Options. (line 290)
+* awk, profiling, enabling: Options. (line 296)
* awk, implementations, limits: Getline Notes. (line 14)
* awk, implementation issues, pipes: Redirection. (line 129)
* awk, new vs. old, OFMT variable: Strings And Numbers. (line 56)
@@ -36276,7 +36541,7 @@ Index
(line 41)
* awkcc, awk to C translator: Other Versions. (line 167)
* AWKgo: Other Versions. (line 133)
-* AWKLIBPATH environment variable: Options. (line 203)
+* AWKLIBPATH environment variable: Options. (line 209)
* AWKLIBPATH environment variable <1>: AWKLIBPATH Variable. (line 6)
* AWKLIBPATH environment variable <2>: Loading Shared Libraries.
(line 8)
@@ -36326,11 +36591,12 @@ Index
* backslash (\), \v escape sequence: Escape Sequences. (line 53)
* backslash (\), \NNN escape sequence: Escape Sequences. (line 56)
* backslash (\), \x escape sequence: Escape Sequences. (line 61)
-* backslash (\), \/ escape sequence: Escape Sequences. (line 76)
-* backslash (\), \" escape sequence: Escape Sequences. (line 85)
-* backslash (\), in escape sequences <1>: Escape Sequences. (line 103)
+* backslash (\), \u escape sequence: Escape Sequences. (line 76)
+* backslash (\), \/ escape sequence: Escape Sequences. (line 90)
+* backslash (\), \" escape sequence: Escape Sequences. (line 99)
+* backslash (\), in escape sequences <1>: Escape Sequences. (line 117)
* backslash (\), in escape sequences, POSIX and: Escape Sequences.
- (line 108)
+ (line 122)
* backslash (\), regexp operator: Regexp Operator Details.
(line 14)
* backslash (\), in bracket expressions: Bracket Expressions. (line 25)
@@ -36363,7 +36629,7 @@ Index
* Beebe, Nelson H.F.: Acknowledgments. (line 60)
* Beebe, Nelson H.F. <1>: Numeric Functions. (line 32)
* Beebe, Nelson H.F. <2>: Other Versions. (line 82)
-* BEGIN pattern: Field Separators. (line 44)
+* BEGIN pattern: Field Separators. (line 45)
* BEGIN pattern, getline and: Getline Notes. (line 19)
* BEGIN pattern, headings, adding: Print Examples. (line 42)
* BEGIN pattern, OFS/ORS variables, assigning values to: Output Separators.
@@ -36461,7 +36727,7 @@ Index
* Brennan, Michael <5>: Other Versions. (line 6)
* Brennan, Michael <6>: Other Versions. (line 39)
* Brian Kernighan’s awk: When. (line 21)
-* Brian Kernighan’s awk <1>: Escape Sequences. (line 112)
+* Brian Kernighan’s awk <1>: Escape Sequences. (line 126)
* Brian Kernighan’s awk <2>: GNU Regexp Operators.
(line 84)
* Brian Kernighan’s awk <3>: gawk split records. (line 71)
@@ -36474,7 +36740,7 @@ Index
* Brian Kernighan’s awk <9>: Continue Statement. (line 44)
* Brian Kernighan’s awk <10>: Nextfile Statement. (line 47)
* Brian Kernighan’s awk <11>: Delete. (line 51)
-* Brian Kernighan’s awk <12>: String Functions. (line 510)
+* Brian Kernighan’s awk <12>: String Functions. (line 517)
* Brian Kernighan’s awk <13>: Gory Details. (line 19)
* Brian Kernighan’s awk <14>: I/O Functions. (line 43)
* Brian Kernighan’s awk, extensions: BTL. (line 6)
@@ -36541,7 +36807,7 @@ Index
* case sensitivity, string comparisons and: User-modified. (line 79)
* case sensitivity, regexps and <1>: User-modified. (line 79)
* case sensitivity, array indices and: Array Intro. (line 100)
-* case sensitivity, converting case: String Functions. (line 540)
+* case sensitivity, converting case: String Functions. (line 547)
* case sensitivity, example programs: Library Functions. (line 50)
* CGI, awk scripts for: Options. (line 146)
* character sets (machine character encodings): Ordinal Functions.
@@ -36585,10 +36851,16 @@ Index
* columns, aligning: Print Examples. (line 69)
* columns, cutting: Cut Program. (line 6)
* comma (,), in range patterns: Ranges. (line 6)
+* comma separated values (CSV) data, -k option: Options. (line 203)
+* comma separated values (CSV) data, --csv option: Options. (line 203)
+* comma separated values (CSV) data, records and fields: Comma Separated Fields.
+ (line 6)
* Comma separated values (CSV) data, parsing with FPAT: Splitting By Content.
- (line 20)
+ (line 23)
* Comma separated values (CSV) data, parsing with FPAT library: More CSV.
(line 52)
+* comma separated values (CSV) data, generating CSV data: To CSV Function.
+ (line 6)
* command completion, in debugger: Readline Support. (line 6)
* command line, formats: Running gawk. (line 12)
* command line, option -f: Long. (line 12)
@@ -36614,6 +36886,7 @@ Index
* commenting: Comments. (line 6)
* commenting, backslash continuation and: Statements/Lines. (line 77)
* common extensions, \x escape sequence: Escape Sequences. (line 61)
+* common extensions, \u escape sequence: Escape Sequences. (line 76)
* common extensions, RS as a regexp: gawk split records. (line 6)
* common extensions, single character fields: Single Character Fields.
(line 6)
@@ -36682,9 +36955,9 @@ Index
* converting, numbers to strings: Strings And Numbers. (line 6)
* converting, integer array subscripts to strings: Numeric Array Subscripts.
(line 31)
-* converting, string to numbers <1>: String Functions. (line 408)
-* converting, string to lower case: String Functions. (line 541)
-* converting, string to upper case: String Functions. (line 547)
+* converting, string to numbers <1>: String Functions. (line 415)
+* converting, string to lower case: String Functions. (line 548)
+* converting, string to upper case: String Functions. (line 554)
* converting, dates to timestamps: Time Functions. (line 77)
* converting, string to numbers <2>: Bitwise Functions. (line 110)
* converting, numbers to strings <1>: Bitwise Functions. (line 110)
@@ -36702,12 +36975,18 @@ Index
* cosine: Numeric Functions. (line 15)
* counting words, lines, characters, and bytes: Wc Program. (line 6)
* csh utility: Statements/Lines. (line 45)
-* csh utility, POSIXLY_CORRECT environment variable: Options. (line 411)
+* csh utility, POSIXLY_CORRECT environment variable: Options. (line 417)
* csh utility, |& operator, comparison with: Two-way I/O. (line 27)
+* CSV (comma separated values) data, -k option: Options. (line 203)
+* CSV (comma separated values) data, --csv option: Options. (line 203)
+* CSV (comma separated values) data, records and fields: Comma Separated Fields.
+ (line 6)
* CSV (comma separated values) data, parsing with FPAT: Splitting By Content.
- (line 20)
+ (line 23)
* CSV (comma separated values) data, parsing with CSVMODE library: More CSV.
(line 52)
+* CSV (comma separated values) data, generating CSV data: To CSV Function.
+ (line 6)
* CSVMODE library for gawk: More CSV. (line 52)
* ctime() user-defined function: Function Example. (line 74)
* Curreli, Marco: Contributors. (line 147)
@@ -36731,7 +37010,7 @@ Index
* dark corner, empty programs: Command Line. (line 20)
* dark corner, escape sequences: Other Arguments. (line 46)
* dark corner, escape sequences, for metacharacters: Escape Sequences.
- (line 143)
+ (line 157)
* dark corner, input files: awk split records. (line 104)
* dark corner, strings, storing: gawk split records. (line 94)
* dark corner, NF variable, decrementing: Changing Fields. (line 107)
@@ -36767,13 +37046,13 @@ Index
* dark corner, exit statement: Exit Statement. (line 30)
* dark corner, value of ARGV[0]: Auto-set. (line 39)
* dark corner, FILENAME variable <1>: Auto-set. (line 108)
-* dark corner, FNR/NR variables: Auto-set. (line 409)
+* dark corner, FNR/NR variables: Auto-set. (line 416)
* dark corner, array subscripts: Uninitialized Subscripts.
(line 43)
* dark corner, regexp as second argument to index(): String Functions.
(line 178)
* dark corner, length() function: String Functions. (line 200)
-* dark corner, split() function: String Functions. (line 379)
+* dark corner, split() function: String Functions. (line 386)
* dark corner, parameter name restrictions: Definition Syntax.
(line 44)
* dark corner <1>: Glossary. (line 266)
@@ -36933,7 +37212,7 @@ Index
* debugging, example session: Sample Debugging Session.
(line 6)
* debugging gawk, bug reports: Bugs. (line 9)
-* decimal point character, locale specific: Options. (line 314)
+* decimal point character, locale specific: Options. (line 320)
* decrement operators: Increment Ops. (line 35)
* default keyword: Switch Statement. (line 6)
* Deifik, Scott: Acknowledgments. (line 60)
@@ -37014,8 +37293,8 @@ Index
* differences in awk and gawk, ERRNO variable: Auto-set. (line 87)
* differences in awk and gawk, FUNCTAB variable: Auto-set. (line 134)
* differences in awk and gawk, PROCINFO array: Auto-set. (line 148)
-* differences in awk and gawk, RS/RT variables <3>: Auto-set. (line 348)
-* differences in awk and gawk, SYMTAB variable: Auto-set. (line 352)
+* differences in awk and gawk, RS/RT variables <3>: Auto-set. (line 355)
+* differences in awk and gawk, SYMTAB variable: Auto-set. (line 359)
* differences in awk and gawk, ARGC/ARGV variables: ARGC and ARGV.
(line 89)
* differences in awk and gawk, array elements, deleting: Delete.
@@ -37027,7 +37306,7 @@ Index
* differences in awk and gawk, match() function: String Functions.
(line 276)
* differences in awk and gawk, split() function: String Functions.
- (line 364)
+ (line 371)
* differences in awk and gawk, indirect function calls: Indirect Calls.
(line 6)
* differences in awk and gawk, BINMODE variable <1>: PC Using.
@@ -37130,8 +37409,8 @@ Index
* endpwent() user-defined function: Passwd Functions. (line 210)
* English, Steve: Advanced Features. (line 6)
* ENVIRON array: Auto-set. (line 59)
-* environment variables, AWKLIBPATH: Options. (line 203)
-* environment variables, POSIXLY_CORRECT: Options. (line 396)
+* environment variables, AWKLIBPATH: Options. (line 209)
+* environment variables, POSIXLY_CORRECT: Options. (line 402)
* environment variables, used by gawk: Environment Variables.
(line 6)
* environment variables, AWKPATH: AWKPATH Variable. (line 6)
@@ -37295,6 +37574,7 @@ Index
* extensions, loadable, loading, @load directive: Loading Shared Libraries.
(line 8)
* extensions, common, \x escape sequence: Escape Sequences. (line 61)
+* extensions, common, \u escape sequence: Escape Sequences. (line 76)
* extensions, common, RS as a regexp: gawk split records. (line 6)
* extensions, common, single character fields: Single Character Fields.
(line 6)
@@ -37334,15 +37614,15 @@ Index
* features, deprecated: Obsolete. (line 6)
* features, undocumented: Undocumented. (line 6)
* features, adding to gawk: Adding Code. (line 6)
-* Fenlason, Jay: History. (line 30)
+* Fenlason, Jay: History. (line 34)
* Fenlason, Jay <1>: Contributors. (line 19)
* fflush: I/O Functions. (line 28)
* field numbers: Nonconstant Fields. (line 6)
* field operator $: Fields. (line 19)
* field operators, dollar sign as: Fields. (line 19)
-* field separator: Field Separators. (line 15)
-* field separator, choice of: Field Separators. (line 50)
-* field separator, regular expression as: Field Separators. (line 50)
+* field separator: Field Separators. (line 16)
+* field separator, choice of: Field Separators. (line 51)
+* field separator, regular expression as: Field Separators. (line 51)
* field separator, whitespace as: Default Field Splitting.
(line 6)
* field separator, FS variable and: Default Field Splitting.
@@ -37367,8 +37647,8 @@ Index
* fields, numbers: Nonconstant Fields. (line 6)
* fields, changing contents of: Changing Fields. (line 6)
* fields, adding: Changing Fields. (line 53)
-* fields, separating: Field Separators. (line 15)
-* fields, separating <1>: Field Separators. (line 15)
+* fields, separating: Field Separators. (line 16)
+* fields, separating <1>: Field Separators. (line 16)
* fields, single-character: Single Character Fields.
(line 6)
* fields, printing: Print Examples. (line 20)
@@ -37458,7 +37738,7 @@ Index
(line 12)
* FNR variable: Records. (line 6)
* FNR variable <1>: Auto-set. (line 118)
-* FNR variable, changing: Auto-set. (line 409)
+* FNR variable, changing: Auto-set. (line 416)
* for statement: For Statement. (line 6)
* for statement, looping over arrays: Scanning an Array. (line 20)
* fork() extension function: Extension Sample Fork.
@@ -37472,7 +37752,7 @@ Index
* format time string: Time Functions. (line 50)
* formats, numeric output: OFMT. (line 6)
* formatting, output: Printf. (line 6)
-* formatting, strings: String Functions. (line 401)
+* formatting, strings: String Functions. (line 408)
* forward slash (/), to enclose regular expressions: Regexp. (line 10)
* forward slash (/), /= operator: Assignment Ops. (line 129)
* forward slash (/), /= operator, vs. /=.../ regexp constant: Assignment Ops.
@@ -37481,7 +37761,7 @@ Index
* forward slash (/), /= operator <1>: Precedence. (line 94)
* forward slash (/), patterns and: Expression Patterns. (line 24)
* FPAT variable: Splitting By Content.
- (line 30)
+ (line 33)
* FPAT variable <1>: User-modified. (line 46)
* frame debugger command: Execution Stack. (line 27)
* frawk: Other Versions. (line 117)
@@ -37493,9 +37773,9 @@ Index
* Free Software Foundation (FSF) <3>: Glossary. (line 403)
* FreeBSD: Glossary. (line 747)
* FS variable, --field-separator option and: Options. (line 21)
-* FS variable, TAB character as: Options. (line 311)
-* FS variable: Field Separators. (line 15)
-* FS variable, changing value of: Field Separators. (line 34)
+* FS variable, TAB character as: Options. (line 317)
+* FS variable: Field Separators. (line 16)
+* FS variable, changing value of: Field Separators. (line 35)
* FS variable, containing ^: Regexp Field Splitting.
(line 58)
* FS variable, null string as: Single Character Fields.
@@ -37568,12 +37848,12 @@ Index
* gawk, uses for: Preface. (line 34)
* gawk, awk and <1>: This Manual. (line 14)
* gawk, newlines in: Statements/Lines. (line 12)
-* gawk, extensions, disabling: Options. (line 302)
-* gawk, version of, printing information about: Options. (line 349)
+* gawk, extensions, disabling: Options. (line 308)
+* gawk, version of, printing information about: Options. (line 355)
* gawk, ARGIND variable in: Other Arguments. (line 21)
* gawk, PROCINFO array in: Other Arguments. (line 21)
-* gawk, escape sequences: Escape Sequences. (line 120)
-* gawk, escape sequences <1>: Escape Sequences. (line 120)
+* gawk, escape sequences: Escape Sequences. (line 134)
+* gawk, escape sequences <1>: Escape Sequences. (line 134)
* gawk, regular expressions, precedence: Regexp Operator Details.
(line 142)
* gawk, interval expressions and: Interval Expressions.
@@ -37592,7 +37872,7 @@ Index
* gawk, RT variable in <1>: gawk split records. (line 66)
* gawk, FIELDWIDTHS variable in: Fixed width data. (line 17)
* gawk, FPAT variable in: Splitting By Content.
- (line 30)
+ (line 33)
* gawk, splitting fields and: Testing field creation.
(line 6)
* gawk, RT variable in <2>: Multiple Line. (line 138)
@@ -37622,8 +37902,8 @@ Index
* gawk, FUNCTAB array in: Auto-set. (line 134)
* gawk, PROCINFO array in <1>: Auto-set. (line 148)
* gawk, version of: Auto-set. (line 262)
-* gawk, RT variable in <3>: Auto-set. (line 348)
-* gawk, SYMTAB array in: Auto-set. (line 352)
+* gawk, RT variable in <3>: Auto-set. (line 355)
+* gawk, SYMTAB array in: Auto-set. (line 359)
* gawk, IGNORECASE variable in <2>: Array Intro. (line 100)
* gawk, function arguments and: Calling Built-in. (line 16)
* gawk, IGNORECASE variable in <3>: String Functions. (line 57)
@@ -37777,7 +38057,7 @@ Index
* gsub: Standard Regexp Constants.
(line 43)
* gsub <1>: String Functions. (line 153)
-* gsub() function, arguments of: String Functions. (line 480)
+* gsub() function, arguments of: String Functions. (line 487)
* gsub() function, escape processing: Gory Details. (line 6)
* Guerrero, Juan Manuel: Acknowledgments. (line 60)
* Guerrero, Juan Manuel <1>: Contributors. (line 150)
@@ -37792,13 +38072,13 @@ Index
* help debugger command: Miscellaneous Debugger Commands.
(line 67)
* hexadecimal numbers: Nondecimal-numbers. (line 6)
-* hexadecimal values, enabling interpretation of: Options. (line 255)
+* hexadecimal values, enabling interpretation of: Options. (line 261)
* history expansion, in debugger: Readline Support. (line 6)
* histsort.awk program: History Sorting. (line 25)
* Hughes, Phil: Acknowledgments. (line 43)
* HUP signal, for dynamic profiling: Profiling. (line 217)
* hyphen (-), file names beginning with: Options. (line 63)
-* hyphen (-), -- end of options marker: Options. (line 354)
+* hyphen (-), -- end of options marker: Options. (line 360)
* hyphen (-), in bracket expressions: Bracket Expressions. (line 25)
* hyphen (-), -= operator: Assignment Ops. (line 129)
* hyphen (-), -- operator: Increment Ops. (line 48)
@@ -37944,13 +38224,15 @@ Index
* Kelly, Terence <1>: Persistent Memory. (line 127)
* Kelly, Terence <2>: Feature History. (line 510)
* Kenobi, Obi-Wan: Undocumented. (line 6)
-* Kernighan, Brian: History. (line 17)
+* Kernighan, Brian: History. (line 21)
* Kernighan, Brian, quotes: Conventions. (line 38)
* Kernighan, Brian <1>: Acknowledgments. (line 79)
-* Kernighan, Brian, quotes <1>: Getline/Pipe. (line 6)
-* Kernighan, Brian, quotes <2>: Concatenation. (line 6)
-* Kernighan, Brian, quotes <3>: Library Functions. (line 12)
-* Kernighan, Brian, quotes <4>: Programs Exercises. (line 26)
+* Kernighan, Brian, quotes <1>: Comma Separated Fields.
+ (line 46)
+* Kernighan, Brian, quotes <2>: Getline/Pipe. (line 6)
+* Kernighan, Brian, quotes <3>: Concatenation. (line 6)
+* Kernighan, Brian, quotes <4>: Library Functions. (line 12)
+* Kernighan, Brian, quotes <5>: Programs Exercises. (line 26)
* Kernighan, Brian <2>: BTL. (line 6)
* Kernighan, Brian <3>: Contributors. (line 12)
* Kernighan, Brian <4>: Other Versions. (line 13)
@@ -38028,9 +38310,9 @@ Index
* lines, counting: Wc Program. (line 6)
* lines, duplicate, removing: History Sorting. (line 6)
* lint checking, empty programs: Command Line. (line 16)
-* lint checking, issuing warnings: Options. (line 215)
+* lint checking, issuing warnings: Options. (line 221)
* lint checking, POSIXLY_CORRECT environment variable: Options.
- (line 396)
+ (line 402)
* lint checking: User-modified. (line 90)
* lint checking, array subscripts: Uninitialized Subscripts.
(line 43)
@@ -38043,13 +38325,13 @@ Index
* list function definitions, in debugger: Debugger Info. (line 30)
* @load directive: Loading Shared Libraries.
(line 8)
-* loading extensions: Options. (line 203)
+* loading extensions: Options. (line 209)
* loading extensions, @load directive: Loading Shared Libraries.
(line 8)
* local variables, in a function: Variable Scope. (line 6)
* local variables, show in debugger: Debugger Info. (line 34)
* locale categories: Explaining gettext. (line 81)
-* locale decimal point character: Options. (line 314)
+* locale decimal point character: Options. (line 320)
* locale, definition of: Locales. (line 6)
* log: Numeric Functions. (line 28)
* log files, timestamps in: Time Functions. (line 6)
@@ -38088,8 +38370,8 @@ Index
* matching, leftmost longest: Multiple Line. (line 26)
* matching, expressions: Typing and Comparison.
(line 9)
-* matching, null strings: String Functions. (line 563)
-* mawk utility: Escape Sequences. (line 120)
+* matching, null strings: String Functions. (line 570)
+* mawk utility: Escape Sequences. (line 134)
* mawk utility <1>: Getline/Pipe. (line 62)
* mawk utility <2>: Concatenation. (line 36)
* mawk utility <3>: Nextfile Statement. (line 47)
@@ -38107,7 +38389,7 @@ Index
* message object files, converting from portable object files: I18N Example.
(line 80)
* messages from extensions: Printing Messages. (line 6)
-* metacharacters, escape sequences for: Escape Sequences. (line 139)
+* metacharacters, escape sequences for: Escape Sequences. (line 153)
* metacharacters, in regular expressions: Regexp Operators. (line 6)
* minimum precision required by MPFR library: Auto-set. (line 279)
* Minshall, Greg: Getopt Function. (line 105)
@@ -38168,7 +38450,7 @@ Index
* networks, support for: Special Network. (line 6)
* networks, programming: TCP/IP Networking. (line 6)
* newlines: Statements/Lines. (line 6)
-* newlines <1>: Options. (line 308)
+* newlines <1>: Options. (line 314)
* newlines, in dynamic regexps: Computed Regexps. (line 60)
* newlines, in regexp constants: Computed Regexps. (line 70)
* newlines, as record separators: awk split records. (line 12)
@@ -38206,7 +38488,7 @@ Index
* not Boolean-logic operator: Boolean Ops. (line 6)
* NR variable: Records. (line 6)
* NR variable <1>: Auto-set. (line 143)
-* NR variable, changing: Auto-set. (line 409)
+* NR variable, changing: Auto-set. (line 416)
* null strings, in gawk arguments, quoting and: Quoting. (line 82)
* null strings, in gawk arguments, quoting and <1>: Other Arguments.
(line 73)
@@ -38219,7 +38501,7 @@ Index
* null strings, as array subscripts: Uninitialized Subscripts.
(line 43)
* null strings, deleting array elements and: Delete. (line 27)
-* null strings, matching: String Functions. (line 563)
+* null strings, matching: String Functions. (line 570)
* null strings <3>: Basic Data Typing. (line 26)
* number of array elements: String Functions. (line 214)
* number sign (#), #! (executable scripts): Executable Scripts.
@@ -38245,7 +38527,7 @@ Index
* o debugger command (alias for option): Debugger Info. (line 57)
* obsolete features: Obsolete. (line 6)
* octal numbers: Nondecimal-numbers. (line 6)
-* octal values, enabling interpretation of: Options. (line 255)
+* octal values, enabling interpretation of: Options. (line 261)
* OFMT variable: OFMT. (line 15)
* OFMT variable, POSIX awk and: OFMT. (line 27)
* OFMT variable <1>: Strings And Numbers. (line 56)
@@ -38386,10 +38668,10 @@ Index
* portability, #! (executable scripts): Executable Scripts. (line 29)
* portability, ARGV variable: Executable Scripts. (line 55)
* portability, backslash continuation and: Statements/Lines. (line 30)
-* portability, POSIXLY_CORRECT environment variable: Options. (line 416)
-* portability: Escape Sequences. (line 103)
+* portability, POSIXLY_CORRECT environment variable: Options. (line 422)
+* portability: Escape Sequences. (line 117)
* portability, backslash in escape sequences: Escape Sequences.
- (line 108)
+ (line 122)
* portability, data files as single record: gawk split records.
(line 77)
* portability, NF variable, decrementing: Changing Fields. (line 115)
@@ -38402,7 +38684,7 @@ Index
* portability, operators, not in POSIX awk: Precedence. (line 97)
* portability, deleting array elements: Delete. (line 56)
* portability, length() function: String Functions. (line 193)
-* portability, substr() function: String Functions. (line 530)
+* portability, substr() function: String Functions. (line 537)
* portability, functions, defining: Definition Syntax. (line 114)
* portability, next statement in user-defined functions: Function Caveats.
(line 26)
@@ -38428,7 +38710,7 @@ Index
* POSIX awk: This Manual. (line 14)
* POSIX awk, GNU long options and: Options. (line 15)
* POSIX awk, backslashes in string constants: Escape Sequences.
- (line 108)
+ (line 122)
* POSIX awk, period (.), using: Regexp Operator Details.
(line 47)
* POSIX awk, regular expressions and: Regexp Operator Details.
@@ -38462,8 +38744,8 @@ Index
* POSIX awk, date utility and: Time Functions. (line 254)
* POSIX awk, function keyword in: Definition Syntax. (line 99)
* POSIX awk, changes in awk versions: POSIX. (line 6)
-* POSIX mode: Options. (line 302)
-* POSIX mode <1>: Options. (line 396)
+* POSIX mode: Options. (line 308)
+* POSIX mode <1>: Options. (line 402)
* POSIX mode <2>: Regexp Operator Details.
(line 47)
* POSIX mode <3>: Input Summary. (line 69)
@@ -38476,13 +38758,13 @@ Index
(line 12)
* POSIX mode <9>: POSIX String Comparison.
(line 34)
-* POSIX mode <10>: String Functions. (line 397)
+* POSIX mode <10>: String Functions. (line 404)
* POSIX mode <11>: Controlling Array Traversal.
(line 226)
* POSIX mode <12>: POSIX Floating Point Problems.
(line 83)
* POSIX mode <13>: Feature History. (line 315)
-* POSIXLY_CORRECT environment variable: Options. (line 396)
+* POSIXLY_CORRECT environment variable: Options. (line 402)
* POSIXLY_CORRECT environment variable <1>: Other Environment Variables.
(line 33)
* POSIXLY_CORRECT environment variable <2>: Invoking Summary. (line 49)
@@ -38499,7 +38781,7 @@ Index
* predefined variables, conveying information: Auto-set. (line 6)
* pretty printer, interaction with namespaces: Namespace And Features.
(line 9)
-* pretty printing: Options. (line 267)
+* pretty printing: Options. (line 273)
* pretty printing <1>: Profiling. (line 228)
* pretty printing, profiling, difference with: Profiling. (line 235)
* print debugger command: Viewing And Changing Data.
@@ -38674,7 +38956,7 @@ Index
(line 149)
* register loadable extension: Registration Functions.
(line 6)
-* regular expressions, interval expressions and: Options. (line 323)
+* regular expressions, interval expressions and: Options. (line 329)
* regular expressions: Regexp. (line 6)
* regular expressions, as patterns: Regexp Usage. (line 6)
* regular expressions, operators: Regexp Usage. (line 19)
@@ -38700,13 +38982,13 @@ Index
* regular expressions, case sensitivity: Case-sensitivity. (line 6)
* regular expressions, as record separators: awk split records.
(line 118)
-* regular expressions, as field separators: Field Separators. (line 50)
+* regular expressions, as field separators: Field Separators. (line 51)
* regular expressions, as field separators <1>: Regexp Field Splitting.
(line 6)
* regular expressions, as patterns <1>: Regexp Patterns. (line 6)
* regular expressions, case sensitivity <1>: User-modified. (line 79)
* regular expressions, searching for: Egrep Program. (line 6)
-* replace in string: String Functions. (line 426)
+* replace in string: String Functions. (line 433)
* retrying input: Retrying Input. (line 6)
* return debugger command: Debugger Execution Control.
(line 54)
@@ -38729,7 +39011,7 @@ Index
* right angle bracket (>), >> operator (I/O) <1>: Precedence. (line 64)
* right shift, bitwise: Bitwise Functions. (line 33)
* Ritchie, Dennis: Basic Data Typing. (line 54)
-* RLENGTH variable: Auto-set. (line 335)
+* RLENGTH variable: Auto-set. (line 342)
* RLENGTH variable, match() function and: String Functions. (line 241)
* Robbins, Miriam: Acknowledgments. (line 94)
* Robbins, Jean: Acknowledgments. (line 94)
@@ -38759,13 +39041,13 @@ Index
* RS variable, multiline records and: Multiple Line. (line 17)
* RS variable <1>: User-modified. (line 135)
* rshift: Bitwise Functions. (line 55)
-* RSTART variable: Auto-set. (line 341)
+* RSTART variable: Auto-set. (line 348)
* RSTART variable, match() function and: String Functions. (line 241)
* RT variable: awk split records. (line 118)
* RT variable <1>: gawk split records. (line 66)
* RT variable <2>: Multiple Line. (line 138)
-* RT variable <3>: Auto-set. (line 348)
-* Rubin, Paul: History. (line 30)
+* RT variable <3>: Auto-set. (line 355)
+* Rubin, Paul: History. (line 34)
* Rubin, Paul <1>: Contributors. (line 16)
* rule, definition of: Getting Started. (line 21)
* run debugger command: Debugger Execution Control.
@@ -38775,7 +39057,7 @@ Index
(line 68)
* sample debugging session: Sample Debugging Session.
(line 6)
-* sandbox mode: Options. (line 334)
+* sandbox mode: Options. (line 340)
* Saturday Night Live: Dynamic Typing. (line 6)
* save debugger options: Debugger Info. (line 85)
* scalar or array: Type Functions. (line 11)
@@ -38783,7 +39065,7 @@ Index
* scanning arrays: Scanning an Array. (line 6)
* scanning multidimensional arrays: Multiscanning. (line 11)
* Schorr, Andrew: Acknowledgments. (line 60)
-* Schorr, Andrew <1>: Auto-set. (line 379)
+* Schorr, Andrew <1>: Auto-set. (line 386)
* Schorr, Andrew <2>: Contributors. (line 136)
* Schreiber, Bert: Acknowledgments. (line 38)
* Schreiber, Rita: Acknowledgments. (line 38)
@@ -38871,8 +39153,8 @@ Index
* side effects, array indexing: Reference to Elements.
(line 43)
* side effects, match() function: String Functions. (line 241)
-* side effects, sub() function: String Functions. (line 480)
-* side effects, gsub() function: String Functions. (line 480)
+* side effects, sub() function: String Functions. (line 487)
+* side effects, gsub() function: String Functions. (line 487)
* side effects, asort() function: Array Sorting Functions.
(line 24)
* side effects, asorti() function: Array Sorting Functions.
@@ -38882,9 +39164,9 @@ Index
* sidebar, Quoting Shell Variables On The awk Command Line: Other Arguments.
(line 71)
* sidebar, Backslash Before Regular Characters: Escape Sequences.
- (line 106)
+ (line 120)
* sidebar, Escape Sequences for Metacharacters: Escape Sequences.
- (line 137)
+ (line 151)
* sidebar, What About The Empty Regexp?: Regexp Operator Details.
(line 147)
* sidebar, Using \n in Bracket Expressions of Dynamic Regexps: Computed Regexps.
@@ -38893,10 +39175,12 @@ Index
(line 50)
* sidebar, RS = "\0" Is Not Portable: gawk split records. (line 75)
* sidebar, Understanding $0: Changing Fields. (line 135)
+* sidebar, Carriage-Return–Line-Feed Line Endings In CSV Files: Comma Separated Fields.
+ (line 46)
* sidebar, Changing FS Does Not Affect the Fields: Full Line Fields.
(line 14)
* sidebar, FS and IGNORECASE: Field Splitting Summary.
- (line 37)
+ (line 45)
* sidebar, Piping into sh: Redirection. (line 134)
* sidebar, A Constant’s Base Does Not Affect Its Value: Nondecimal-numbers.
(line 63)
@@ -38905,8 +39189,8 @@ Index
* sidebar, Syntactic Ambiguities Between /= and Regular Expressions: Assignment Ops.
(line 148)
* sidebar, Operator Evaluation Order: Increment Ops. (line 58)
-* sidebar, Changing NR and FNR: Auto-set. (line 407)
-* sidebar, Matching the Null String: String Functions. (line 561)
+* sidebar, Changing NR and FNR: Auto-set. (line 414)
+* sidebar, Matching the Null String: String Functions. (line 568)
* sidebar, Interactive Versus Noninteractive Buffering: I/O Functions.
(line 73)
* sidebar, Controlling Output Buffering with system(): I/O Functions.
@@ -38985,7 +39269,7 @@ Index
* split() function, array elements, deleting: Delete. (line 61)
* split.awk program: Split Program. (line 51)
* sprintf: OFMT. (line 15)
-* sprintf <1>: String Functions. (line 401)
+* sprintf <1>: String Functions. (line 408)
* sprintf() function, print/printf statements and: Round Function.
(line 6)
* sqrt: Numeric Functions. (line 77)
@@ -39037,22 +39321,22 @@ Index
* strings, converting, numbers to: User-modified. (line 30)
* strings, converting, numbers to <1>: User-modified. (line 107)
* strings, splitting, example: String Functions. (line 350)
-* strings, converting letter case: String Functions. (line 540)
+* strings, converting letter case: String Functions. (line 547)
* strings, converting <1>: Bitwise Functions. (line 110)
* strings, merging arrays into: Join Function. (line 6)
* strings, for localization: Programmer i18n. (line 13)
* strings, extracting: String Extraction. (line 6)
* strptime() extension function: Extension Sample Time.
(line 31)
-* strtonum: String Functions. (line 408)
+* strtonum: String Functions. (line 415)
* strtonum() function (gawk), --non-decimal-data option and: Nondecimal Data.
(line 35)
* STR_CHAIN_MAX environment variable: Other Environment Variables.
(line 91)
* sub: Standard Regexp Constants.
(line 43)
-* sub <1>: String Functions. (line 426)
-* sub() function, arguments of: String Functions. (line 480)
+* sub <1>: String Functions. (line 433)
+* sub() function, arguments of: String Functions. (line 487)
* sub() function, escape processing: Gory Details. (line 6)
* subscript separators: User-modified. (line 148)
* subscripts in arrays, numbers as: Numeric Array Subscripts.
@@ -39066,12 +39350,12 @@ Index
* SUBSEP variable, multidimensional arrays and: Multidimensional.
(line 16)
* substitute in string: String Functions. (line 98)
-* substr: String Functions. (line 499)
-* substring: String Functions. (line 499)
+* substr: String Functions. (line 506)
+* substring: String Functions. (line 506)
* Sumner, Andrew: Other Versions. (line 64)
* supplementary groups of gawk process: Auto-set. (line 292)
* switch statement: Switch Statement. (line 6)
-* SYMTAB array: Auto-set. (line 352)
+* SYMTAB array: Auto-set. (line 359)
* syntactic ambiguity: /= operator vs. /=.../ regexp constant: Assignment Ops.
(line 150)
* system: I/O Functions. (line 105)
@@ -39130,8 +39414,10 @@ Index
* timestamps, converting dates to: Time Functions. (line 77)
* timestamps, formatted: Getlocaltime Function.
(line 6)
-* tolower: String Functions. (line 541)
-* toupper: String Functions. (line 547)
+* tocsv() user-defined function: To CSV Function. (line 21)
+* tocsv_rec() user-defined function: To CSV Function. (line 54)
+* tolower: String Functions. (line 548)
+* toupper: String Functions. (line 554)
* tr utility: Translate Program. (line 6)
* trace debugger command: Miscellaneous Debugger Commands.
(line 108)
@@ -39142,12 +39428,12 @@ Index
* treating files, as single records: gawk split records. (line 104)
* troubleshooting, typographical errors, global variables: Options.
(line 102)
-* troubleshooting, --non-decimal-data option: Options. (line 255)
+* troubleshooting, --non-decimal-data option: Options. (line 261)
* troubleshooting, backslash before nonspecial character: Escape Sequences.
- (line 108)
+ (line 122)
* troubleshooting, regexp constants vs. string constants: Computed Regexps.
(line 40)
-* troubleshooting, awk uses FS not IFS: Field Separators. (line 29)
+* troubleshooting, awk uses FS not IFS: Field Separators. (line 30)
* troubleshooting, fatal errors, field widths, specifying: Fixed width data.
(line 17)
* troubleshooting, print statement, omitting commas: Print Examples.
@@ -39164,8 +39450,8 @@ Index
* troubleshooting, gawk, fatal errors, function arguments: Calling Built-in.
(line 16)
* troubleshooting, match() function: String Functions. (line 305)
-* troubleshooting, gsub()/sub() functions: String Functions. (line 490)
-* troubleshooting, substr() function: String Functions. (line 517)
+* troubleshooting, gsub()/sub() functions: String Functions. (line 497)
+* troubleshooting, substr() function: String Functions. (line 524)
* troubleshooting, fflush() function: I/O Functions. (line 62)
* troubleshooting, system() function: I/O Functions. (line 127)
* troubleshooting, readable data files: File Checking. (line 6)
@@ -39173,7 +39459,7 @@ Index
* troubleshooting, gawk, bug reports: Bugs. (line 9)
* troubleshooting, gawk: Compatibility Mode. (line 6)
* true, logical: Truth Values. (line 6)
-* Trueman, David: History. (line 30)
+* Trueman, David: History. (line 34)
* Trueman, David <1>: Acknowledgments. (line 47)
* Trueman, David <2>: Contributors. (line 31)
* trunc-mod operation: Arithmetic Ops. (line 66)
@@ -39205,7 +39491,7 @@ Index
* Unix, awk scripts and: Executable Scripts. (line 6)
* Unix: Glossary. (line 747)
* Unix awk, backslashes in escape sequences: Escape Sequences.
- (line 120)
+ (line 134)
* Unix awk, password files, field separators and: Command Line Field Separator.
(line 62)
* Unix awk, close() function and: Close Return Value. (line 6)
@@ -39317,20 +39603,20 @@ Index
* Wall, Larry: Array Intro. (line 6)
* Wall, Larry <1>: Future Extensions. (line 6)
* Wallin, Anders: Contributors. (line 106)
-* warnings, issuing: Options. (line 215)
+* warnings, issuing: Options. (line 221)
* watch debugger command: Viewing And Changing Data.
(line 70)
* watchpoint (debugger): Debugging Terms. (line 42)
* watchpoints, show in debugger: Debugger Info. (line 51)
* wc utility: Wc Program. (line 6)
* wc.awk program: wc program. (line 51)
-* Weinberger, Peter: History. (line 17)
+* Weinberger, Peter: History. (line 21)
* Weinberger, Peter <1>: Contributors. (line 12)
* where debugger command (alias for backtrace): Execution Stack.
(line 13)
* while statement, use of regexps in: Regexp Usage. (line 19)
* while statement: While Statement. (line 6)
-* whitespace, newlines as: Options. (line 308)
+* whitespace, newlines as: Options. (line 314)
* whitespace, definition of: Fields. (line 6)
* whitespace, as field separators: Default Field Splitting.
(line 6)
@@ -39366,618 +39652,623 @@ Index

Tag Table:
Node: Top1229
-Node: Foreword346679
-Node: Foreword451279
-Node: Preface52828
-Ref: Preface-Footnote-155820
-Ref: Preface-Footnote-255929
-Ref: Preface-Footnote-356163
-Node: History56309
-Node: Names58773
-Ref: Names-Footnote-159936
-Node: This Manual60099
-Ref: This Manual-Footnote-167049
-Node: Conventions67161
-Node: Manual History69639
-Ref: Manual History-Footnote-172676
-Ref: Manual History-Footnote-272723
-Node: How To Contribute72801
-Node: Acknowledgments73751
-Node: Getting Started78749
-Node: Running gawk81276
-Node: One-shot82494
-Node: Read Terminal83797
-Node: Long85857
-Node: Executable Scripts87438
-Ref: Executable Scripts-Footnote-190213
-Node: Comments90320
-Node: Quoting92858
-Node: DOS Quoting98507
-Node: Sample Data Files100593
-Node: Very Simple103230
-Node: Two Rules109509
-Node: More Complex111463
-Node: Statements/Lines113903
-Ref: Statements/Lines-Footnote-1118783
-Node: Other Features119072
-Node: When120040
-Ref: When-Footnote-1121846
-Node: Intro Summary121911
-Node: Invoking Gawk122867
-Node: Command Line124437
-Node: Options125288
-Ref: Options-Footnote-1144437
-Ref: Options-Footnote-2144672
-Node: Other Arguments144697
-Node: Naming Standard Input148874
-Node: Environment Variables150144
-Node: AWKPATH Variable150718
-Ref: AWKPATH Variable-Footnote-1154308
-Ref: AWKPATH Variable-Footnote-2154342
-Node: AWKLIBPATH Variable154735
-Ref: AWKLIBPATH Variable-Footnote-1156510
-Node: Other Environment Variables156907
-Node: Exit Status161403
-Node: Include Files162118
-Node: Loading Shared Libraries166178
-Node: Obsolete167670
-Node: Undocumented168306
-Node: Invoking Summary168605
-Node: Regexp171632
-Node: Regexp Usage173126
-Node: Escape Sequences175227
-Node: Regexp Operators181758
-Node: Regexp Operator Details182251
-Ref: Regexp Operator Details-Footnote-1190117
-Node: Interval Expressions190276
-Ref: Interval Expressions-Footnote-1192545
-Node: Bracket Expressions192645
-Ref: table-char-classes195205
-Node: Leftmost Longest198727
-Node: Computed Regexps200087
-Node: GNU Regexp Operators203610
-Node: Case-sensitivity207633
-Ref: Case-sensitivity-Footnote-1210590
-Ref: Case-sensitivity-Footnote-2210835
-Node: Regexp Summary210951
-Node: Reading Files212475
-Node: Records214792
-Node: awk split records215903
-Node: gawk split records220793
-Ref: gawk split records-Footnote-1226087
-Node: Fields226124
-Node: Nonconstant Fields229011
-Ref: Nonconstant Fields-Footnote-1231322
-Node: Changing Fields231538
-Node: Field Separators237846
-Node: Default Field Splitting240662
-Node: Regexp Field Splitting241805
-Node: Single Character Fields245634
-Node: Command Line Field Separator246729
-Node: Full Line Fields250116
-Ref: Full Line Fields-Footnote-1251696
-Ref: Full Line Fields-Footnote-2251742
-Node: Field Splitting Summary251850
-Node: Constant Size254019
-Node: Fixed width data254763
-Node: Skipping intervening258282
-Node: Allowing trailing data259084
-Node: Fields with fixed data260149
-Node: Splitting By Content261775
-Ref: Splitting By Content-Footnote-1265714
-Node: More CSV265877
-Node: FS versus FPAT267530
-Node: Testing field creation268739
-Node: Multiple Line270432
-Node: Getline276914
-Node: Plain Getline279500
-Node: Getline/Variable282150
-Node: Getline/File283347
-Node: Getline/Variable/File284795
-Ref: Getline/Variable/File-Footnote-1286440
-Node: Getline/Pipe286536
-Node: Getline/Variable/Pipe289349
-Node: Getline/Coprocess290532
-Node: Getline/Variable/Coprocess291855
-Node: Getline Notes292621
-Node: Getline Summary295582
-Ref: table-getline-variants296026
-Node: Read Timeout296931
-Ref: Read Timeout-Footnote-1300895
-Node: Retrying Input300953
-Node: Command-line directories302220
-Node: Input Summary303158
-Node: Input Exercises306538
-Node: Printing306978
-Node: Print308864
-Node: Print Examples310370
-Node: Output Separators313223
-Node: OFMT315334
-Node: Printf316757
-Node: Basic Printf317562
-Node: Control Letters319198
-Node: Format Modifiers324667
-Node: Printf Examples330953
-Node: Redirection333498
-Node: Special FD340572
-Ref: Special FD-Footnote-1343862
-Node: Special Files343948
-Node: Other Inherited Files344577
-Node: Special Network345642
-Node: Special Caveats346530
-Node: Close Files And Pipes347513
-Ref: Close Files And Pipes-Footnote-1353650
-Node: Close Return Value353806
-Ref: table-close-pipe-return-values355081
-Ref: Close Return Value-Footnote-1355915
-Node: Nonfatal356071
-Node: Output Summary358502
-Node: Output Exercises359788
-Node: Expressions360479
-Node: Values361681
-Node: Constants362359
-Node: Scalar Constants363056
-Ref: Scalar Constants-Footnote-1365631
-Node: Nondecimal-numbers365881
-Node: Regexp Constants369002
-Node: Using Constant Regexps369548
-Node: Standard Regexp Constants370194
-Node: Strong Regexp Constants373494
-Node: Variables377345
-Node: Using Variables378010
-Node: Assignment Options379990
-Node: Conversion382552
-Node: Strings And Numbers383084
-Ref: Strings And Numbers-Footnote-1386303
-Node: Locale influences conversions386412
-Ref: table-locale-affects389262
-Node: All Operators389905
-Node: Arithmetic Ops390546
-Node: Concatenation393376
-Ref: Concatenation-Footnote-1396326
-Node: Assignment Ops396449
-Ref: table-assign-ops401588
-Node: Increment Ops402970
-Node: Truth Values and Conditions406569
-Node: Truth Values407695
-Node: Typing and Comparison408786
-Node: Variable Typing409622
-Ref: Variable Typing-Footnote-1416284
-Ref: Variable Typing-Footnote-2416364
-Node: Comparison Operators416447
-Ref: table-relational-ops416874
-Node: POSIX String Comparison420560
-Ref: POSIX String Comparison-Footnote-1422319
-Ref: POSIX String Comparison-Footnote-2422462
-Node: Boolean Ops422546
-Ref: Boolean Ops-Footnote-1427239
-Node: Conditional Exp427335
-Node: Function Calls429121
-Node: Precedence433071
-Node: Locales436948
-Node: Expressions Summary438630
-Node: Patterns and Actions441293
-Node: Pattern Overview442435
-Node: Regexp Patterns444161
-Node: Expression Patterns444707
-Node: Ranges448616
-Node: BEGIN/END451794
-Node: Using BEGIN/END452607
-Ref: Using BEGIN/END-Footnote-1455517
-Node: I/O And BEGIN/END455627
-Node: BEGINFILE/ENDFILE458108
-Node: Empty461549
-Node: Using Shell Variables461866
-Node: Action Overview464204
-Node: Statements466639
-Node: If Statement468537
-Node: While Statement470106
-Node: Do Statement472194
-Node: For Statement473380
-Node: Switch Statement476737
-Node: Break Statement479288
-Node: Continue Statement481480
-Node: Next Statement483412
-Node: Nextfile Statement485909
-Node: Exit Statement488770
-Node: Built-in Variables491303
-Node: User-modified492482
-Node: Auto-set500693
-Ref: Auto-set-Footnote-1518546
-Ref: Auto-set-Footnote-2518764
-Node: ARGC and ARGV518820
-Node: Pattern Action Summary523259
-Node: Arrays525875
-Node: Array Basics527252
-Node: Array Intro528102
-Ref: figure-array-elements530118
-Ref: Array Intro-Footnote-1532987
-Node: Reference to Elements533119
-Node: Assigning Elements535641
-Node: Array Example536136
-Node: Scanning an Array538105
-Node: Controlling Scanning541202
-Ref: Controlling Scanning-Footnote-1547848
-Node: Numeric Array Subscripts548172
-Node: Uninitialized Subscripts550446
-Node: Delete552125
-Ref: Delete-Footnote-1554939
-Node: Multidimensional554996
-Node: Multiscanning558201
-Node: Arrays of Arrays559873
-Node: Arrays Summary564773
-Node: Functions566962
-Node: Built-in568022
-Node: Calling Built-in569211
-Node: Boolean Functions571258
-Node: Numeric Functions571828
-Ref: Numeric Functions-Footnote-1576021
-Ref: Numeric Functions-Footnote-2576705
-Ref: Numeric Functions-Footnote-3576757
-Node: String Functions577033
-Ref: String Functions-Footnote-1602863
-Ref: String Functions-Footnote-2602997
-Ref: String Functions-Footnote-3603257
-Node: Gory Details603344
-Ref: table-sub-escapes605251
-Ref: table-sub-proposed606897
-Ref: table-posix-sub608407
-Ref: table-gensub-escapes610095
-Ref: Gory Details-Footnote-1611029
-Node: I/O Functions611183
-Ref: table-system-return-values617870
-Ref: I/O Functions-Footnote-1620041
-Ref: I/O Functions-Footnote-2620189
-Node: Time Functions620309
-Ref: Time Functions-Footnote-1631465
-Ref: Time Functions-Footnote-2631541
-Ref: Time Functions-Footnote-3631703
-Ref: Time Functions-Footnote-4631814
-Ref: Time Functions-Footnote-5631932
-Ref: Time Functions-Footnote-6632167
-Node: Bitwise Functions632449
-Ref: table-bitwise-ops633051
-Ref: Bitwise Functions-Footnote-1639305
-Ref: Bitwise Functions-Footnote-2639484
-Node: Type Functions639681
-Node: I18N Functions643274
-Node: User-defined645017
-Node: Definition Syntax645837
-Ref: Definition Syntax-Footnote-1651665
-Node: Function Example651742
-Ref: Function Example-Footnote-1654721
-Node: Function Calling654743
-Node: Calling A Function655337
-Node: Variable Scope656307
-Node: Pass By Value/Reference659361
-Node: Function Caveats662093
-Ref: Function Caveats-Footnote-1664188
-Node: Return Statement664312
-Node: Dynamic Typing667367
-Node: Indirect Calls669768
-Node: Functions Summary680927
-Node: Library Functions683704
-Ref: Library Functions-Footnote-1687252
-Ref: Library Functions-Footnote-2687395
-Node: Library Names687570
-Ref: Library Names-Footnote-1691364
-Ref: Library Names-Footnote-2691591
-Node: General Functions691687
-Node: Strtonum Function692881
-Node: Assert Function695963
-Node: Round Function699415
-Node: Cliff Random Function700993
-Node: Ordinal Functions702026
-Ref: Ordinal Functions-Footnote-1705135
-Ref: Ordinal Functions-Footnote-2705387
-Node: Join Function705601
-Ref: Join Function-Footnote-1707404
-Node: Getlocaltime Function707608
-Node: Readfile Function711382
-Node: Shell Quoting713411
-Node: Isnumeric Function714867
-Node: Data File Management716279
-Node: Filetrans Function716911
-Node: Rewind Function721205
-Node: File Checking723184
-Ref: File Checking-Footnote-1724556
-Node: Empty Files724763
-Node: Ignoring Assigns726830
-Node: Getopt Function728404
-Ref: Getopt Function-Footnote-1744238
-Node: Passwd Functions744450
-Ref: Passwd Functions-Footnote-1753632
-Node: Group Functions753720
-Ref: Group Functions-Footnote-1761858
-Node: Walking Arrays762071
-Node: Library Functions Summary765119
-Node: Library Exercises766543
-Node: Sample Programs767030
-Node: Running Examples767812
-Node: Clones768564
-Node: Cut Program769836
-Node: Egrep Program780277
-Node: Id Program789594
-Node: Split Program799708
-Ref: Split Program-Footnote-1809943
-Node: Tee Program810130
-Node: Uniq Program813039
-Node: Wc Program820904
-Node: Bytes vs. Characters821299
-Node: Using extensions822901
-Node: wc program823681
-Node: Miscellaneous Programs828687
-Node: Dupword Program829916
-Node: Alarm Program831979
-Node: Translate Program836892
-Ref: Translate Program-Footnote-1841633
-Node: Labels Program841911
-Ref: Labels Program-Footnote-1845352
-Node: Word Sorting845444
-Node: History Sorting849638
-Node: Extract Program851913
-Node: Simple Sed860182
-Node: Igawk Program863398
-Ref: Igawk Program-Footnote-1878645
-Ref: Igawk Program-Footnote-2878851
-Ref: Igawk Program-Footnote-3878981
-Node: Anagram Program879108
-Node: Signature Program882204
-Node: Programs Summary883456
-Node: Programs Exercises884714
-Ref: Programs Exercises-Footnote-1889030
-Node: Advanced Features889116
-Node: Nondecimal Data891610
-Node: Boolean Typed Values893240
-Node: Array Sorting895215
-Node: Controlling Array Traversal895944
-Ref: Controlling Array Traversal-Footnote-1904451
-Node: Array Sorting Functions904573
-Ref: Array Sorting Functions-Footnote-1910692
-Node: Two-way I/O910900
-Ref: Two-way I/O-Footnote-1918895
-Ref: Two-way I/O-Footnote-2919086
-Node: TCP/IP Networking919168
-Node: Profiling922348
-Node: Persistent Memory932058
-Ref: Persistent Memory-Footnote-1941016
-Node: Extension Philosophy941147
-Node: Advanced Features Summary942682
-Node: Internationalization944952
-Node: I18N and L10N946658
-Node: Explaining gettext947353
-Ref: Explaining gettext-Footnote-1953506
-Ref: Explaining gettext-Footnote-2953701
-Node: Programmer i18n953866
-Ref: Programmer i18n-Footnote-1958979
-Node: Translator i18n959028
-Node: String Extraction959864
-Ref: String Extraction-Footnote-1961042
-Node: Printf Ordering961140
-Ref: Printf Ordering-Footnote-1964002
-Node: I18N Portability964070
-Ref: I18N Portability-Footnote-1966644
-Node: I18N Example966715
-Ref: I18N Example-Footnote-1970115
-Ref: I18N Example-Footnote-2970191
-Node: Gawk I18N970308
-Node: I18N Summary970964
-Node: Debugger972365
-Node: Debugging973389
-Node: Debugging Concepts973838
-Node: Debugging Terms975664
-Node: Awk Debugging978277
-Ref: Awk Debugging-Footnote-1979254
-Node: Sample Debugging Session979394
-Node: Debugger Invocation979946
-Node: Finding The Bug981575
-Node: List of Debugger Commands988261
-Node: Breakpoint Control989638
-Node: Debugger Execution Control993470
-Node: Viewing And Changing Data996950
-Node: Execution Stack1000688
-Node: Debugger Info1002369
-Node: Miscellaneous Debugger Commands1006668
-Node: Readline Support1011921
-Node: Limitations1012867
-Node: Debugging Summary1015511
-Node: Namespaces1016814
-Node: Global Namespace1017941
-Node: Qualified Names1019386
-Node: Default Namespace1020421
-Node: Changing The Namespace1021196
-Node: Naming Rules1022890
-Node: Internal Name Management1024805
-Node: Namespace Example1025875
-Node: Namespace And Features1028458
-Node: Namespace Summary1029915
-Node: Arbitrary Precision Arithmetic1031428
-Node: Computer Arithmetic1032947
-Ref: table-numeric-ranges1036764
-Ref: table-floating-point-ranges1037262
-Ref: Computer Arithmetic-Footnote-11037921
-Node: Math Definitions1037980
-Ref: table-ieee-formats1041025
-Node: MPFR features1041599
-Node: MPFR On Parole1042052
-Ref: MPFR On Parole-Footnote-11042896
-Node: MPFR Intro1043055
-Node: FP Math Caution1044745
-Ref: FP Math Caution-Footnote-11045819
-Node: Inexactness of computations1046196
-Node: Inexact representation1047227
-Node: Comparing FP Values1048610
-Node: Errors accumulate1049868
-Node: Strange values1051335
-Ref: Strange values-Footnote-11054001
-Node: Getting Accuracy1054106
-Node: Try To Round1056843
-Node: Setting precision1057750
-Ref: table-predefined-precision-strings1058455
-Node: Setting the rounding mode1060340
-Ref: table-gawk-rounding-modes1060722
-Ref: Setting the rounding mode-Footnote-11064780
-Node: Arbitrary Precision Integers1064963
-Ref: Arbitrary Precision Integers-Footnote-11068175
-Node: Checking for MPFR1068331
-Node: POSIX Floating Point Problems1069821
-Ref: POSIX Floating Point Problems-Footnote-11074685
-Node: Floating point summary1074723
-Node: Dynamic Extensions1076987
-Node: Extension Intro1078586
-Node: Plugin License1079894
-Node: Extension Mechanism Outline1080707
-Ref: figure-load-extension1081158
-Ref: figure-register-new-function1082743
-Ref: figure-call-new-function1083853
-Node: Extension API Description1085977
-Node: Extension API Functions Introduction1087706
-Ref: table-api-std-headers1089604
-Node: General Data Types1094068
-Ref: General Data Types-Footnote-11103236
-Node: Memory Allocation Functions1103551
-Ref: Memory Allocation Functions-Footnote-11108276
-Node: Constructor Functions1108375
-Node: API Ownership of MPFR and GMP Values1112280
-Node: Registration Functions1113841
-Node: Extension Functions1114545
-Node: Exit Callback Functions1120121
-Node: Extension Version String1121440
-Node: Input Parsers1122135
-Node: Output Wrappers1136779
-Node: Two-way processors1141627
-Node: Printing Messages1143988
-Ref: Printing Messages-Footnote-11145202
-Node: Updating ERRNO1145357
-Node: Requesting Values1146156
-Ref: table-value-types-returned1146909
-Node: Accessing Parameters1148018
-Node: Symbol Table Access1149302
-Node: Symbol table by name1149818
-Ref: Symbol table by name-Footnote-11153029
-Node: Symbol table by cookie1153161
-Ref: Symbol table by cookie-Footnote-11157442
-Node: Cached values1157506
-Ref: Cached values-Footnote-11161150
-Node: Array Manipulation1161307
-Ref: Array Manipulation-Footnote-11162410
-Node: Array Data Types1162447
-Ref: Array Data Types-Footnote-11165269
-Node: Array Functions1165369
-Node: Flattening Arrays1170398
-Node: Creating Arrays1177450
-Node: Redirection API1182300
-Node: Extension API Variables1185321
-Node: Extension Versioning1186046
-Ref: gawk-api-version1186483
-Node: Extension GMP/MPFR Versioning1188271
-Node: Extension API Informational Variables1189977
-Node: Extension API Boilerplate1191138
-Node: Changes from API V11195274
-Node: Finding Extensions1196908
-Node: Extension Example1197483
-Node: Internal File Description1198307
-Node: Internal File Ops1202631
-Ref: Internal File Ops-Footnote-11214189
-Node: Using Internal File Ops1214337
-Ref: Using Internal File Ops-Footnote-11216768
-Node: Extension Samples1217046
-Node: Extension Sample File Functions1218615
-Node: Extension Sample Fnmatch1226753
-Node: Extension Sample Fork1228348
-Node: Extension Sample Inplace1229624
-Node: Extension Sample Ord1233296
-Node: Extension Sample Readdir1234172
-Ref: table-readdir-file-types1235069
-Node: Extension Sample Revout1236207
-Node: Extension Sample Rev2way1236804
-Node: Extension Sample Read write array1237556
-Node: Extension Sample Readfile1240830
-Node: Extension Sample Time1241961
-Node: Extension Sample API Tests1244251
-Node: gawkextlib1244759
-Node: Extension summary1247795
-Node: Extension Exercises1251653
-Node: Language History1252931
-Node: V7/SVR3.11254645
-Node: SVR41256995
-Node: POSIX1258527
-Node: BTL1259952
-Node: POSIX/GNU1260721
-Node: Feature History1267252
-Node: Common Extensions1286370
-Node: Ranges and Locales1287739
-Ref: Ranges and Locales-Footnote-11292540
-Ref: Ranges and Locales-Footnote-21292567
-Ref: Ranges and Locales-Footnote-31292806
-Node: Contributors1293029
-Node: History summary1299234
-Node: Installation1300680
-Node: Gawk Distribution1301644
-Node: Getting1302136
-Node: Extracting1303135
-Node: Distribution contents1304847
-Node: Unix Installation1312927
-Node: Quick Installation1313749
-Node: Compiling with MPFR1316295
-Node: Shell Startup Files1317001
-Node: Additional Configuration Options1318158
-Node: Configuration Philosophy1320545
-Node: Compiling from Git1323047
-Node: Building the Documentation1323606
-Node: Non-Unix Installation1325018
-Node: PC Installation1325494
-Node: PC Binary Installation1326367
-Node: PC Compiling1327272
-Node: PC Using1328450
-Node: Cygwin1332178
-Node: MSYS1333434
-Node: OpenVMS Installation1334066
-Node: OpenVMS Compilation1334747
-Ref: OpenVMS Compilation-Footnote-11336230
-Node: OpenVMS Dynamic Extensions1336292
-Node: OpenVMS Installation Details1337928
-Node: OpenVMS Running1340363
-Node: OpenVMS GNV1344500
-Node: Bugs1345255
-Node: Bug definition1346179
-Node: Bug address1349830
-Node: Usenet1353421
-Node: Performance bugs1354652
-Node: Asking for help1357670
-Node: Maintainers1359661
-Node: Other Versions1360688
-Node: Installation summary1369620
-Node: Notes1371004
-Node: Compatibility Mode1371814
-Node: Additions1372636
-Node: Accessing The Source1373581
-Node: Adding Code1375116
-Node: New Ports1382252
-Node: Derived Files1386762
-Ref: Derived Files-Footnote-11392609
-Ref: Derived Files-Footnote-21392644
-Ref: Derived Files-Footnote-31393261
-Node: Future Extensions1393375
-Node: Implementation Limitations1394047
-Node: Extension Design1395289
-Node: Old Extension Problems1396453
-Ref: Old Extension Problems-Footnote-11398029
-Node: Extension New Mechanism Goals1398090
-Ref: Extension New Mechanism Goals-Footnote-11401586
-Node: Extension Other Design Decisions1401787
-Node: Extension Future Growth1403986
-Node: Notes summary1404610
-Node: Basic Concepts1405823
-Node: Basic High Level1406508
-Ref: figure-general-flow1406790
-Ref: figure-process-flow1407497
-Ref: Basic High Level-Footnote-11410898
-Node: Basic Data Typing1411087
-Node: Glossary1414505
-Node: Copying1447627
-Node: GNU Free Documentation License1485388
-Node: Index1510711
+Node: Foreword346932
+Node: Foreword451532
+Node: Preface53081
+Ref: Preface-Footnote-156073
+Ref: Preface-Footnote-256182
+Ref: Preface-Footnote-356416
+Node: History56562
+Node: Names59180
+Ref: Names-Footnote-160343
+Node: This Manual60506
+Ref: This Manual-Footnote-167456
+Node: Conventions67568
+Node: Manual History70046
+Ref: Manual History-Footnote-173083
+Ref: Manual History-Footnote-273130
+Node: How To Contribute73208
+Node: Acknowledgments74158
+Node: Getting Started79156
+Node: Running gawk81683
+Node: One-shot82901
+Node: Read Terminal84204
+Node: Long86264
+Node: Executable Scripts87845
+Ref: Executable Scripts-Footnote-190620
+Node: Comments90727
+Node: Quoting93265
+Node: DOS Quoting98914
+Node: Sample Data Files101000
+Node: Very Simple103637
+Node: Two Rules109916
+Node: More Complex111870
+Node: Statements/Lines114310
+Ref: Statements/Lines-Footnote-1119190
+Node: Other Features119479
+Node: When120447
+Ref: When-Footnote-1122253
+Node: Intro Summary122318
+Node: Invoking Gawk123274
+Node: Command Line124844
+Node: Options125695
+Ref: Options-Footnote-1145072
+Ref: Options-Footnote-2145307
+Node: Other Arguments145332
+Node: Naming Standard Input149509
+Node: Environment Variables150779
+Node: AWKPATH Variable151353
+Ref: AWKPATH Variable-Footnote-1154943
+Ref: AWKPATH Variable-Footnote-2154977
+Node: AWKLIBPATH Variable155370
+Ref: AWKLIBPATH Variable-Footnote-1157145
+Node: Other Environment Variables157542
+Node: Exit Status162038
+Node: Include Files162753
+Node: Loading Shared Libraries166813
+Node: Obsolete168305
+Node: Undocumented168941
+Node: Invoking Summary169240
+Node: Regexp172267
+Node: Regexp Usage173761
+Node: Escape Sequences175862
+Node: Regexp Operators183198
+Node: Regexp Operator Details183691
+Ref: Regexp Operator Details-Footnote-1191557
+Node: Interval Expressions191716
+Ref: Interval Expressions-Footnote-1193985
+Node: Bracket Expressions194085
+Ref: table-char-classes196645
+Node: Leftmost Longest200167
+Node: Computed Regexps201527
+Node: GNU Regexp Operators205050
+Node: Case-sensitivity209073
+Ref: Case-sensitivity-Footnote-1212030
+Ref: Case-sensitivity-Footnote-2212275
+Node: Regexp Summary212391
+Node: Reading Files213915
+Node: Records216232
+Node: awk split records217507
+Node: gawk split records222397
+Ref: gawk split records-Footnote-1227691
+Node: Fields227728
+Node: Nonconstant Fields230615
+Ref: Nonconstant Fields-Footnote-1232926
+Node: Changing Fields233142
+Node: Field Separators239450
+Node: Default Field Splitting242323
+Node: Regexp Field Splitting243466
+Node: Single Character Fields247295
+Node: Comma Separated Fields248384
+Ref: table-csv-examples249792
+Node: Command Line Field Separator252106
+Node: Full Line Fields255492
+Ref: Full Line Fields-Footnote-1257072
+Ref: Full Line Fields-Footnote-2257118
+Node: Field Splitting Summary257226
+Node: Constant Size259660
+Node: Fixed width data260404
+Node: Skipping intervening263923
+Node: Allowing trailing data264725
+Node: Fields with fixed data265790
+Node: Splitting By Content267416
+Ref: Splitting By Content-Footnote-1271685
+Node: More CSV271848
+Node: FS versus FPAT273501
+Node: Testing field creation274710
+Node: Multiple Line276488
+Node: Getline282970
+Node: Plain Getline285556
+Node: Getline/Variable288206
+Node: Getline/File289403
+Node: Getline/Variable/File290851
+Ref: Getline/Variable/File-Footnote-1292496
+Node: Getline/Pipe292592
+Node: Getline/Variable/Pipe295405
+Node: Getline/Coprocess296588
+Node: Getline/Variable/Coprocess297911
+Node: Getline Notes298677
+Node: Getline Summary301638
+Ref: table-getline-variants302082
+Node: Read Timeout302987
+Ref: Read Timeout-Footnote-1306951
+Node: Retrying Input307009
+Node: Command-line directories308276
+Node: Input Summary309214
+Node: Input Exercises312594
+Node: Printing313034
+Node: Print314977
+Node: Print Examples316483
+Node: Output Separators319336
+Node: OFMT321447
+Node: Printf322870
+Node: Basic Printf323675
+Node: Control Letters325311
+Node: Format Modifiers330780
+Node: Printf Examples337066
+Node: Redirection339611
+Node: Special FD346685
+Ref: Special FD-Footnote-1349975
+Node: Special Files350061
+Node: Other Inherited Files350690
+Node: Special Network351755
+Node: Special Caveats352643
+Node: Close Files And Pipes353626
+Ref: Close Files And Pipes-Footnote-1359762
+Node: Close Return Value359918
+Ref: table-close-pipe-return-values361193
+Ref: Close Return Value-Footnote-1362027
+Node: Noflush362183
+Node: Nonfatal363695
+Node: Output Summary366112
+Node: Output Exercises367398
+Node: Expressions368089
+Node: Values369291
+Node: Constants369969
+Node: Scalar Constants370666
+Ref: Scalar Constants-Footnote-1373244
+Ref: Scalar Constants-Footnote-2373494
+Node: Nondecimal-numbers373574
+Node: Regexp Constants376695
+Node: Using Constant Regexps377241
+Node: Standard Regexp Constants377887
+Node: Strong Regexp Constants381187
+Node: Variables385038
+Node: Using Variables385703
+Node: Assignment Options387683
+Node: Conversion390245
+Node: Strings And Numbers390777
+Ref: Strings And Numbers-Footnote-1393996
+Node: Locale influences conversions394105
+Ref: table-locale-affects396955
+Node: All Operators397598
+Node: Arithmetic Ops398239
+Node: Concatenation401069
+Ref: Concatenation-Footnote-1404019
+Node: Assignment Ops404142
+Ref: table-assign-ops409281
+Node: Increment Ops410663
+Node: Truth Values and Conditions414262
+Node: Truth Values415388
+Node: Typing and Comparison416479
+Node: Variable Typing417315
+Ref: Variable Typing-Footnote-1423977
+Ref: Variable Typing-Footnote-2424057
+Node: Comparison Operators424140
+Ref: table-relational-ops424567
+Node: POSIX String Comparison428253
+Ref: POSIX String Comparison-Footnote-1430012
+Ref: POSIX String Comparison-Footnote-2430155
+Node: Boolean Ops430239
+Ref: Boolean Ops-Footnote-1434932
+Node: Conditional Exp435028
+Node: Function Calls436814
+Node: Precedence440764
+Node: Locales444641
+Node: Expressions Summary446323
+Node: Patterns and Actions448986
+Node: Pattern Overview450128
+Node: Regexp Patterns451854
+Node: Expression Patterns452400
+Node: Ranges456309
+Node: BEGIN/END459487
+Node: Using BEGIN/END460300
+Ref: Using BEGIN/END-Footnote-1463210
+Node: I/O And BEGIN/END463320
+Node: BEGINFILE/ENDFILE465801
+Node: Empty469242
+Node: Using Shell Variables469559
+Node: Action Overview471897
+Node: Statements474332
+Node: If Statement476230
+Node: While Statement477799
+Node: Do Statement479887
+Node: For Statement481073
+Node: Switch Statement484430
+Node: Break Statement486981
+Node: Continue Statement489173
+Node: Next Statement491105
+Node: Nextfile Statement493602
+Node: Exit Statement496463
+Node: Built-in Variables498996
+Node: User-modified500175
+Node: Auto-set508386
+Ref: Auto-set-Footnote-1526485
+Ref: Auto-set-Footnote-2526703
+Node: ARGC and ARGV526759
+Node: Pattern Action Summary531198
+Node: Arrays533814
+Node: Array Basics535191
+Node: Array Intro536041
+Ref: figure-array-elements538057
+Ref: Array Intro-Footnote-1540926
+Node: Reference to Elements541058
+Node: Assigning Elements543580
+Node: Array Example544075
+Node: Scanning an Array546044
+Node: Controlling Scanning549141
+Ref: Controlling Scanning-Footnote-1555787
+Node: Numeric Array Subscripts556111
+Node: Uninitialized Subscripts558385
+Node: Delete560064
+Ref: Delete-Footnote-1562878
+Node: Multidimensional562935
+Node: Multiscanning566140
+Node: Arrays of Arrays567812
+Node: Arrays Summary572712
+Node: Functions574901
+Node: Built-in575961
+Node: Calling Built-in577150
+Node: Boolean Functions579197
+Node: Numeric Functions579767
+Ref: Numeric Functions-Footnote-1583960
+Ref: Numeric Functions-Footnote-2584644
+Ref: Numeric Functions-Footnote-3584696
+Node: String Functions584972
+Ref: String Functions-Footnote-1611203
+Ref: String Functions-Footnote-2611337
+Ref: String Functions-Footnote-3611597
+Node: Gory Details611684
+Ref: table-sub-escapes613591
+Ref: table-sub-proposed615237
+Ref: table-posix-sub616747
+Ref: table-gensub-escapes618435
+Ref: Gory Details-Footnote-1619369
+Node: I/O Functions619523
+Ref: table-system-return-values626210
+Ref: I/O Functions-Footnote-1628381
+Ref: I/O Functions-Footnote-2628529
+Node: Time Functions628649
+Ref: Time Functions-Footnote-1639805
+Ref: Time Functions-Footnote-2639881
+Ref: Time Functions-Footnote-3640043
+Ref: Time Functions-Footnote-4640154
+Ref: Time Functions-Footnote-5640272
+Ref: Time Functions-Footnote-6640507
+Node: Bitwise Functions640789
+Ref: table-bitwise-ops641391
+Ref: Bitwise Functions-Footnote-1647645
+Ref: Bitwise Functions-Footnote-2647824
+Node: Type Functions648021
+Node: I18N Functions651614
+Node: User-defined653357
+Node: Definition Syntax654177
+Ref: Definition Syntax-Footnote-1660005
+Node: Function Example660082
+Ref: Function Example-Footnote-1663061
+Node: Function Calling663083
+Node: Calling A Function663677
+Node: Variable Scope664647
+Node: Pass By Value/Reference667701
+Node: Function Caveats670433
+Ref: Function Caveats-Footnote-1672528
+Node: Return Statement672652
+Node: Dynamic Typing675707
+Node: Indirect Calls678099
+Node: Functions Summary689258
+Node: Library Functions692035
+Ref: Library Functions-Footnote-1695583
+Ref: Library Functions-Footnote-2695726
+Node: Library Names695901
+Ref: Library Names-Footnote-1699695
+Ref: Library Names-Footnote-2699922
+Node: General Functions700018
+Node: Strtonum Function701288
+Node: Assert Function704370
+Node: Round Function707822
+Node: Cliff Random Function709400
+Node: Ordinal Functions710433
+Ref: Ordinal Functions-Footnote-1713542
+Ref: Ordinal Functions-Footnote-2713794
+Node: Join Function714008
+Ref: Join Function-Footnote-1715811
+Node: Getlocaltime Function716015
+Node: Readfile Function719789
+Node: Shell Quoting721818
+Node: Isnumeric Function723274
+Node: To CSV Function724710
+Node: Data File Management726786
+Node: Filetrans Function727418
+Node: Rewind Function731712
+Node: File Checking733691
+Ref: File Checking-Footnote-1735063
+Node: Empty Files735270
+Node: Ignoring Assigns737337
+Node: Getopt Function738911
+Ref: Getopt Function-Footnote-1754745
+Node: Passwd Functions754957
+Ref: Passwd Functions-Footnote-1764139
+Node: Group Functions764227
+Ref: Group Functions-Footnote-1772365
+Node: Walking Arrays772578
+Node: Library Functions Summary775626
+Node: Library Exercises777050
+Node: Sample Programs777537
+Node: Running Examples778319
+Node: Clones779071
+Node: Cut Program780343
+Node: Egrep Program790784
+Node: Id Program800101
+Node: Split Program810215
+Ref: Split Program-Footnote-1820450
+Node: Tee Program820637
+Node: Uniq Program823546
+Node: Wc Program831411
+Node: Bytes vs. Characters831806
+Node: Using extensions833408
+Node: wc program834188
+Node: Miscellaneous Programs839194
+Node: Dupword Program840423
+Node: Alarm Program842486
+Node: Translate Program847399
+Ref: Translate Program-Footnote-1852140
+Node: Labels Program852418
+Ref: Labels Program-Footnote-1855859
+Node: Word Sorting855951
+Node: History Sorting860145
+Node: Extract Program862420
+Node: Simple Sed870689
+Node: Igawk Program873905
+Ref: Igawk Program-Footnote-1889152
+Ref: Igawk Program-Footnote-2889358
+Ref: Igawk Program-Footnote-3889488
+Node: Anagram Program889615
+Node: Signature Program892711
+Node: Programs Summary893963
+Node: Programs Exercises895221
+Ref: Programs Exercises-Footnote-1899537
+Node: Advanced Features899623
+Node: Nondecimal Data902117
+Node: Boolean Typed Values903747
+Node: Array Sorting905722
+Node: Controlling Array Traversal906451
+Ref: Controlling Array Traversal-Footnote-1914958
+Node: Array Sorting Functions915080
+Ref: Array Sorting Functions-Footnote-1921199
+Node: Two-way I/O921407
+Ref: Two-way I/O-Footnote-1929402
+Ref: Two-way I/O-Footnote-2929593
+Node: TCP/IP Networking929675
+Node: Profiling932855
+Node: Persistent Memory942565
+Ref: Persistent Memory-Footnote-1951523
+Node: Extension Philosophy951654
+Node: Advanced Features Summary953189
+Node: Internationalization955459
+Node: I18N and L10N957165
+Node: Explaining gettext957860
+Ref: Explaining gettext-Footnote-1964013
+Ref: Explaining gettext-Footnote-2964208
+Node: Programmer i18n964373
+Ref: Programmer i18n-Footnote-1969486
+Node: Translator i18n969535
+Node: String Extraction970371
+Ref: String Extraction-Footnote-1971549
+Node: Printf Ordering971647
+Ref: Printf Ordering-Footnote-1974509
+Node: I18N Portability974577
+Ref: I18N Portability-Footnote-1977151
+Node: I18N Example977222
+Ref: I18N Example-Footnote-1980622
+Ref: I18N Example-Footnote-2980698
+Node: Gawk I18N980815
+Node: I18N Summary981471
+Node: Debugger982872
+Node: Debugging983896
+Node: Debugging Concepts984345
+Node: Debugging Terms986171
+Node: Awk Debugging988784
+Ref: Awk Debugging-Footnote-1989761
+Node: Sample Debugging Session989901
+Node: Debugger Invocation990453
+Node: Finding The Bug992082
+Node: List of Debugger Commands998768
+Node: Breakpoint Control1000145
+Node: Debugger Execution Control1003977
+Node: Viewing And Changing Data1007457
+Node: Execution Stack1011195
+Node: Debugger Info1012876
+Node: Miscellaneous Debugger Commands1017175
+Node: Readline Support1022428
+Node: Limitations1023374
+Node: Debugging Summary1026018
+Node: Namespaces1027321
+Node: Global Namespace1028448
+Node: Qualified Names1029893
+Node: Default Namespace1030928
+Node: Changing The Namespace1031703
+Node: Naming Rules1033397
+Node: Internal Name Management1035312
+Node: Namespace Example1036382
+Node: Namespace And Features1038965
+Node: Namespace Summary1040422
+Node: Arbitrary Precision Arithmetic1041935
+Node: Computer Arithmetic1043454
+Ref: table-numeric-ranges1047271
+Ref: table-floating-point-ranges1047769
+Ref: Computer Arithmetic-Footnote-11048428
+Node: Math Definitions1048487
+Ref: table-ieee-formats1051532
+Node: MPFR features1052106
+Node: MPFR On Parole1052559
+Ref: MPFR On Parole-Footnote-11053403
+Node: MPFR Intro1053562
+Node: FP Math Caution1055252
+Ref: FP Math Caution-Footnote-11056326
+Node: Inexactness of computations1056703
+Node: Inexact representation1057734
+Node: Comparing FP Values1059117
+Node: Errors accumulate1060375
+Node: Strange values1061842
+Ref: Strange values-Footnote-11064508
+Node: Getting Accuracy1064613
+Node: Try To Round1067350
+Node: Setting precision1068257
+Ref: table-predefined-precision-strings1068962
+Node: Setting the rounding mode1070847
+Ref: table-gawk-rounding-modes1071229
+Ref: Setting the rounding mode-Footnote-11075287
+Node: Arbitrary Precision Integers1075470
+Ref: Arbitrary Precision Integers-Footnote-11078682
+Node: Checking for MPFR1078838
+Node: POSIX Floating Point Problems1080328
+Ref: POSIX Floating Point Problems-Footnote-11085192
+Node: Floating point summary1085230
+Node: Dynamic Extensions1087494
+Node: Extension Intro1089093
+Node: Plugin License1090401
+Node: Extension Mechanism Outline1091214
+Ref: figure-load-extension1091665
+Ref: figure-register-new-function1093250
+Ref: figure-call-new-function1094360
+Node: Extension API Description1096484
+Node: Extension API Functions Introduction1098213
+Ref: table-api-std-headers1100111
+Node: General Data Types1104575
+Ref: General Data Types-Footnote-11113743
+Node: Memory Allocation Functions1114058
+Ref: Memory Allocation Functions-Footnote-11118783
+Node: Constructor Functions1118882
+Node: API Ownership of MPFR and GMP Values1122787
+Node: Registration Functions1124348
+Node: Extension Functions1125052
+Node: Exit Callback Functions1130628
+Node: Extension Version String1131947
+Node: Input Parsers1132642
+Node: Output Wrappers1147286
+Node: Two-way processors1152134
+Node: Printing Messages1154495
+Ref: Printing Messages-Footnote-11155709
+Node: Updating ERRNO1155864
+Node: Requesting Values1156663
+Ref: table-value-types-returned1157416
+Node: Accessing Parameters1158525
+Node: Symbol Table Access1159809
+Node: Symbol table by name1160325
+Ref: Symbol table by name-Footnote-11163536
+Node: Symbol table by cookie1163668
+Ref: Symbol table by cookie-Footnote-11167949
+Node: Cached values1168013
+Ref: Cached values-Footnote-11171657
+Node: Array Manipulation1171814
+Ref: Array Manipulation-Footnote-11172917
+Node: Array Data Types1172954
+Ref: Array Data Types-Footnote-11175776
+Node: Array Functions1175876
+Node: Flattening Arrays1180905
+Node: Creating Arrays1187957
+Node: Redirection API1192807
+Node: Extension API Variables1195828
+Node: Extension Versioning1196553
+Ref: gawk-api-version1196990
+Node: Extension GMP/MPFR Versioning1198778
+Node: Extension API Informational Variables1200484
+Node: Extension API Boilerplate1201645
+Node: Changes from API V11205781
+Node: Finding Extensions1207415
+Node: Extension Example1207990
+Node: Internal File Description1208814
+Node: Internal File Ops1213138
+Ref: Internal File Ops-Footnote-11224696
+Node: Using Internal File Ops1224844
+Ref: Using Internal File Ops-Footnote-11227275
+Node: Extension Samples1227553
+Node: Extension Sample File Functions1229122
+Node: Extension Sample Fnmatch1237260
+Node: Extension Sample Fork1238855
+Node: Extension Sample Inplace1240131
+Node: Extension Sample Ord1243803
+Node: Extension Sample Readdir1244679
+Ref: table-readdir-file-types1245576
+Node: Extension Sample Revout1246714
+Node: Extension Sample Rev2way1247311
+Node: Extension Sample Read write array1248063
+Node: Extension Sample Readfile1251337
+Node: Extension Sample Time1252468
+Node: Extension Sample API Tests1254758
+Node: gawkextlib1255266
+Node: Extension summary1258302
+Node: Extension Exercises1262160
+Node: Language History1263438
+Node: V7/SVR3.11265152
+Node: SVR41267502
+Node: POSIX1269034
+Node: BTL1270459
+Node: POSIX/GNU1271228
+Node: Feature History1277759
+Node: Common Extensions1297326
+Node: Ranges and Locales1298803
+Ref: Ranges and Locales-Footnote-11303604
+Ref: Ranges and Locales-Footnote-21303631
+Ref: Ranges and Locales-Footnote-31303870
+Node: Contributors1304093
+Node: History summary1310298
+Node: Installation1311744
+Node: Gawk Distribution1312708
+Node: Getting1313200
+Node: Extracting1314199
+Node: Distribution contents1315911
+Node: Unix Installation1323991
+Node: Quick Installation1324813
+Node: Compiling with MPFR1327359
+Node: Shell Startup Files1328065
+Node: Additional Configuration Options1329222
+Node: Configuration Philosophy1331609
+Node: Compiling from Git1334111
+Node: Building the Documentation1334670
+Node: Non-Unix Installation1336082
+Node: PC Installation1336558
+Node: PC Binary Installation1337431
+Node: PC Compiling1338336
+Node: PC Using1339514
+Node: Cygwin1343242
+Node: MSYS1344498
+Node: OpenVMS Installation1345130
+Node: OpenVMS Compilation1345811
+Ref: OpenVMS Compilation-Footnote-11347294
+Node: OpenVMS Dynamic Extensions1347356
+Node: OpenVMS Installation Details1348992
+Node: OpenVMS Running1351427
+Node: OpenVMS GNV1355564
+Node: Bugs1356319
+Node: Bug definition1357243
+Node: Bug address1360894
+Node: Usenet1364485
+Node: Performance bugs1365716
+Node: Asking for help1368734
+Node: Maintainers1370725
+Node: Other Versions1371752
+Node: Installation summary1380684
+Node: Notes1382068
+Node: Compatibility Mode1382878
+Node: Additions1383700
+Node: Accessing The Source1384645
+Node: Adding Code1386180
+Node: New Ports1393316
+Node: Derived Files1397826
+Ref: Derived Files-Footnote-11403673
+Ref: Derived Files-Footnote-21403708
+Ref: Derived Files-Footnote-31404325
+Node: Future Extensions1404439
+Node: Implementation Limitations1405111
+Node: Extension Design1406353
+Node: Old Extension Problems1407517
+Ref: Old Extension Problems-Footnote-11409093
+Node: Extension New Mechanism Goals1409154
+Ref: Extension New Mechanism Goals-Footnote-11412650
+Node: Extension Other Design Decisions1412851
+Node: Extension Future Growth1415050
+Node: Notes summary1415674
+Node: Basic Concepts1416887
+Node: Basic High Level1417572
+Ref: figure-general-flow1417854
+Ref: figure-process-flow1418561
+Ref: Basic High Level-Footnote-11421962
+Node: Basic Data Typing1422151
+Node: Glossary1425569
+Node: Copying1458691
+Node: GNU Free Documentation License1496452
+Node: Index1521775

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 8f8a0540..13ba6159 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -59,9 +59,9 @@
@c applies to and all the info about who's publishing this edition
@c These apply across the board.
-@set UPDATE-MONTH December, 2022
-@set VERSION 5.2
-@set PATCHLEVEL 2
+@set UPDATE-MONTH February, 2023
+@set VERSION 5.3
+@set PATCHLEVEL 0
@set GAWKINETTITLE TCP/IP Internetworking with @command{gawk}
@set GAWKWORKFLOWTITLE Participating in @command{gawk} Development
@@ -73,7 +73,7 @@
@set TITLE GAWK: Effective AWK Programming
@end ifclear
@set SUBTITLE A User's Guide for GNU Awk
-@set EDITION 5.2
+@set EDITION 5.3
@iftex
@set DOCUMENT book
@@ -589,6 +589,7 @@ particular records in a file and perform operations upon them.
* Regexp Field Splitting:: Using regexps as the field separator.
* Single Character Fields:: Making each character a separate
field.
+* Comma Separated Fields:: Working with CSV files.
* Command Line Field Separator:: Setting @code{FS} from the command
line.
* Full Line Fields:: Making the full line be a single
@@ -656,6 +657,7 @@ particular records in a file and perform operations upon them.
Pipes.
* Close Return Value:: Using the return value from
@code{close()}.
+* Noflush:: Speeding Up Pipe Output.
* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
@@ -838,6 +840,8 @@ particular records in a file and perform operations upon them.
shell.
* Isnumeric Function:: A function to test whether a value is
numeric.
+* To CSV Function:: A function to convert output to CSV
+ format.
* Data File Management:: Functions for managing command-line
data files.
* Filetrans Function:: A function for handling data file
@@ -1501,6 +1505,10 @@ Document minimally and release.
After eight years, add another part @code{egrep} and two
more parts C. Document very well and release.
+After 35 more years, add Unicode and CSV support, sprinkle lightly with
+a few choice features from @command{gawk}, document very well again,
+and release.
+
@docbook
</sidebar>
@end docbook
@@ -1522,6 +1530,10 @@ Document minimally and release.
After eight years, add another part @code{egrep} and two
more parts C. Document very well and release.
+
+After 35 more years, add Unicode and CSV support, sprinkle lightly with
+a few choice features from @command{gawk}, document very well again,
+and release.
@end cartouche
@end ifnotdocbook
@@ -4173,6 +4185,19 @@ the program. The trace is printed to standard error. Each ``op code''
is preceded by a @code{+}
sign in the output.
+@item @option{-k}
+@itemx @option{--csv}
+@cindex @option{-k} option
+@cindex @option{--csv} option
+@cindex comma separated values (CSV) data @subentry @option{-k} option
+@cindex comma separated values (CSV) data @subentry @option{--csv} option
+@cindex CSV (comma separated values) data @subentry @option{-k} option
+@cindex CSV (comma separated values) data @subentry @option{--csv} option
+Enable special processing for files with comma separated values
+(CSV). @xref{Comma Separated Fields}.
+This option cannot be used with @option{--posix}. Attempting to do
+causes a fatal error.
+
@item @option{-l} @var{ext}
@itemx @option{--load} @var{ext}
@cindex @option{-l} option
@@ -5689,6 +5714,25 @@ As of @value{PVERSION} 4.2, only two digits
are processed.
@end quotation
+@cindex @code{\} (backslash) @subentry @code{\u} escape sequence
+@cindex backslash (@code{\}) @subentry @code{\u} escape sequence
+@cindex common extensions @subentry @code{\u} escape sequence
+@cindex extensions @subentry common @subentry @code{\u} escape sequence
+@item \u@var{hh}@dots{}
+The hexadecimal value @var{hh}, where @var{hh} stands for a sequence
+of hexadecimal digits (@samp{0}--@samp{9}, and either @samp{A}--@samp{F}
+or @samp{a}--@samp{f}). A maximum of eight digits are allowed after
+the @samp{\u}. Any further hexadecimal digits are treated as simple
+letters or numbers. @value{COMMONEXT}
+(The @samp{\u} escape sequence is not allowed in POSIX awk.)
+
+This escape sequence is intended for designating a character in the
+Unicode character set. @command{gawk} first converts the given digits
+into an integer and then translates the given ``wide character''
+value into the current locale's multibyte encoding (even if that
+is a not a Unicode locale). If the given bytes do not represent
+a valid character, the value becomes @code{"?"}.
+
@cindex @code{\} (backslash) @subentry @code{\/} escape sequence
@cindex backslash (@code{\}) @subentry @code{\/} escape sequence
@item \/
@@ -7029,6 +7073,12 @@ If @code{RS} is any single character, that character separates records.
Otherwise (in @command{gawk}), @code{RS} is treated as a regular expression.
This mechanism is explained in greater detail shortly.
+@quotation NOTE
+When @command{gawk} is invoked with the @option{--csv} option, nothing
+in this @value{SECTION} applies. @xref{Comma Separated Fields}, for the
+details.
+@end quotation
+
@menu
* awk split records:: How standard @command{awk} splits records.
* gawk split records:: How @command{gawk} splits records.
@@ -7794,6 +7844,7 @@ with a statement such as @samp{$1 = $1}, as described earlier.
* Default Field Splitting:: How fields are normally separated.
* Regexp Field Splitting:: Using regexps as the field separator.
* Single Character Fields:: Making each character a separate field.
+* Comma Separated Fields:: Working with CSV files.
* Command Line Field Separator:: Setting @code{FS} from the command line.
* Full Line Fields:: Making the full line be a single field.
* Field Splitting Summary:: Some final points and a summary table.
@@ -7836,10 +7887,10 @@ is read with the proper separator. To do this, use the special
@code{BEGIN} pattern
(@pxref{BEGIN/END}).
For example, here we set the value of @code{FS} to the string
-@code{","}:
+@code{":"}:
@example
-awk 'BEGIN @{ FS = "," @} ; @{ print $2 @}'
+awk 'BEGIN @{ FS = ":" @} ; @{ print $2 @}'
@end example
@cindex @code{BEGIN} pattern
@@ -7847,7 +7898,7 @@ awk 'BEGIN @{ FS = "," @} ; @{ print $2 @}'
Given the input line:
@example
-John Q. Smith, 29 Oak St., Walamazoo, MI 42139
+John Q. Smith: 29 Oak St.: Walamazoo: MI 42139
@end example
@noindent
@@ -7863,7 +7914,7 @@ person's name in the example we just used might have a title or
suffix attached, such as:
@example
-John Q. Smith, LXIX, 29 Oak St., Walamazoo, MI 42139
+John Q. Smith: LXIX: 29 Oak St.: Walamazoo: MI 42139
@end example
@noindent
@@ -8050,6 +8101,125 @@ In compatibility mode
if @code{FS} is the null string, then @command{gawk} also
behaves this way.
+@node Comma Separated Fields
+@subsection Working With Comma Separated Value Files
+
+@cindex comma separated values (CSV) data @subentry records and fields
+@cindex CSV (comma separated values) data @subentry records and fields
+Many commonly-used tools use a comma to separate fields, instead of whitespace.
+This is particularly true of popular spreadsheet programs. There is no
+universally accepted standard for the format of these files, although
+@uref{http://www.ietf.org/rfc/rfc4180, RFC 4180} lists the common
+practices.
+
+For decades, anyone wishing to work with CSV files and @command{awk}
+had to ``roll their own'' solution.
+(For an example, @pxref{Splitting By Content}).
+In 2023, Brian Kernighan decided to add CSV support to his version of
+@command{awk}. In order to keep up, @command{gawk} too provides the same
+support as his version.
+To use CSV data, invoke @command{gawk} with either of the
+@option{-k} or @option{--csv} options.
+
+Fields in CSV files are separated by commas. In order to allow a comma
+to appear inside a field (i.e., as data), the field may be quoted
+by beginning and ending it with double quotes. In order to allow a double
+quote inside a field, the field @emph{must} be quoted, and two double quotes
+represent an actual double quote.
+The double quote that starts a quoted field must be the first
+character after the comma.
+@ref{table-csv-examples} shows some examples.
+
+@float Table,table-csv-examples
+@caption{Examples of CSV data}
+@multitable @columnfractions .3 .3
+@headitem Input @tab Field Contents
+@item @code{abc def} @tab @code{abc def}
+@item @code{"quoted data"} @tab @code{quoted data}
+@item @code{"quoted, data"} @tab @code{quoted, data}
+@item @code{"She said ""Stop!""."} @tab @code{She said "Stop!".}
+@end multitable
+@end float
+
+Additionally, and here's where it gets messy, newlines are also
+allowed inside double-quoted fields!
+In order to deal with such things, when processing CSV files,
+@command{gawk} scans the input data looking for newlines that
+are not enclosed in double quotes. Thus, use of the @option{--csv} option
+totally overrides normal record processing with @code{RS} (@pxref{Records}),
+as well as field splitting with any of @code{FS}, @code{FIELDWIDTHS},
+or @code{FPAT}.
+
+@cindex Kernighan, Brian @subentry quotes
+@cindex sidebar @subentry Carriage-Return--Line-Feed Line Endings In CSV Files
+@ifdocbook
+@docbook
+<sidebar><title>Carriage-Return--Line-Feed Line Endings In CSV Files</title>
+@end docbook
+
+@quotation
+@code{\r\n} @i{is the invention of the devil.}
+@author Brian Kernighan
+@end quotation
+
+Many CSV files are imported from systems where the line terminator
+for text files is a carriage-return--line-feed pair
+(CR-LF, @samp{\r} followed by @samp{\n}).
+For ease of use, when processing CSV files, @command{gawk} converts
+CR-LF pairs into a single newline. That is, the @samp{\r} is removed.
+
+This occurs only when a CR is paired with an LF; a standalone CR
+is left alone. This behavior is consistent with with Windows systems
+which automatically convert CR-LF in files into a plain LF in memory,
+and also with the commonly available @command{unix2dos} utility program.
+
+@docbook
+</sidebar>
+@end docbook
+@end ifdocbook
+
+@ifnotdocbook
+@cartouche
+@center @b{Carriage-Return--Line-Feed Line Endings In CSV Files}
+
+
+@quotation
+@code{\r\n} @i{is the invention of the devil.}
+@author Brian Kernighan
+@end quotation
+
+Many CSV files are imported from systems where the line terminator
+for text files is a carriage-return--line-feed pair
+(CR-LF, @samp{\r} followed by @samp{\n}).
+For ease of use, when processing CSV files, @command{gawk} converts
+CR-LF pairs into a single newline. That is, the @samp{\r} is removed.
+
+This occurs only when a CR is paired with an LF; a standalone CR
+is left alone. This behavior is consistent with with Windows systems
+which automatically convert CR-LF in files into a plain LF in memory,
+and also with the commonly available @command{unix2dos} utility program.
+@end cartouche
+@end ifnotdocbook
+
+The behavior of the @code{split()} function (not formally discussed
+yet, see @ref{String Functions}) differs slightly when processing CSV
+files. When called with two arguments
+(@samp{split(@var{string}, @var{array})}), @code{split()}
+does CSV-based splitting. Otherwise, it behaves normally.
+
+If @option{--csv} has been used, @code{PROCINFO["CSV"]} will
+exist. Otherwise, it will not. @xref{Auto-set}.
+
+Finally, if @option{--csv} has been used, assigning a value
+to any of @code{FS}, @code{FIELDWIDTHS}, @code{FPAT}, or
+@code{RS} generates a warning message.
+
+To be clear, @command{gawk} takes
+@uref{http://www.ietf.org/rfc/rfc4180, RFC 4180} as its
+specification for CSV input data. There are no mechanisms
+for accepting nonstandard CSV data, such as files that use
+a semicolon instead of a comma as the separator.
+
@node Command Line Field Separator
@subsection Setting @code{FS} from the Command Line
@cindex @option{-F} option @subentry command-line
@@ -8292,10 +8462,18 @@ The following list summarizes how fields are split, based on the value
of @code{FS} (@samp{==} means ``is equal to''):
@table @code
+@item @asis{@command{gawk} was invoked with @option{--csv}}
+Field splitting follows the rules given in @ref{Comma Separated Fields}.
+The value of @code{FS} is ignored.
+
@item FS == " "
Fields are separated by runs of whitespace. Leading and trailing
whitespace are ignored. This is the default.
+@item FS == ","
+Fields are separated by commas, with quoting of fields
+and special rules involved.
+
@item FS == @var{any other single character}
Fields are separated by each occurrence of the character. Multiple
successive occurrences delimit empty fields, as do leading and
@@ -8577,6 +8755,9 @@ four, and @code{$4} has the value @code{"ddd"}.
@node Splitting By Content
@section Defining Fields by Content
+@strong{FIXME}: This whole section needs rewriting now
+that @command{gawk} has built-in CSV parsing. Sigh.
+
@menu
* More CSV:: More on CSV files.
* FS versus FPAT:: A subtle difference.
@@ -8598,7 +8779,7 @@ what they are, and not by what they are not.
@cindex CSV (comma separated values) data @subentry parsing with @code{FPAT}
@cindex Comma separated values (CSV) data @subentry parsing with @code{FPAT}
The most notorious such case
-is so-called @dfn{comma-separated values} (CSV) data. Many spreadsheet programs,
+is comma-separated values (CSV) data. Many spreadsheet programs,
for example, can export their data into text files, where each record is
terminated with a newline, and fields are separated by commas. If
commas only separated the data, there wouldn't be an issue. The problem comes when
@@ -8716,6 +8897,13 @@ with @code{FS} and with @code{FIELDWIDTHS}.
Finally, the @code{patsplit()} function makes the same functionality
available for splitting regular strings (@pxref{String Functions}).
+@quotation NOTE
+Given that @command{gawk} now has built-in CSV parsing
+(@pxref{Comma Separated Fields}), the examples presented here are obsolete.
+Nonetheless, it remains useful as an example of what @code{FPAT}-based
+field parsing can do.
+@end quotation
+
@node More CSV
@subsection More on CSV Files
@@ -8834,7 +9022,9 @@ The value is @code{"FS"} if regular field splitting is being used,
or @code{"FPAT"} if content-based field splitting is being used:
@example
-if (PROCINFO["FS"] == "FS")
+if ("CSV" in PROCINFO)
+ @var{CSV-based field splitting} @dots{}
+else if (PROCINFO["FS"] == "FS")
@var{regular field splitting} @dots{}
else if (PROCINFO["FS"] == "FIELDWIDTHS")
@var{fixed-width field splitting} @dots{}
@@ -8845,7 +9035,7 @@ else
@end example
This information is useful when writing a function that needs to
-temporarily change @code{FS} or @code{FIELDWIDTHS}, read some records,
+temporarily change @code{FS}, @code{FIELDWIDTHS}, or @code{FPAT}, read some records,
and then restore the original settings (@pxref{Passwd Functions} for an
example of such a function).
@@ -9945,6 +10135,7 @@ and discusses the @code{close()} built-in function.
@command{gawk} allows access to inherited file
descriptors.
* Close Files And Pipes:: Closing Input and Output Files and Pipes.
+* Noflush:: Speeding Up Pipe Output.
* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
@@ -11446,8 +11637,53 @@ pipes; thus, the return value cannot be used portably.
In POSIX mode (@pxref{Options}), @command{gawk} just returns zero
when closing a pipe.
+@node Noflush
+@section Speeding Up Pipe Output
+@c FIXME: Add indexing
+
+This @value{SECTION} describes a @command{gawk}-specific feature.
+
+Normally, when you send data down a pipeline to a command with
+@code{print} or @code{printf}, @command{gawk} @dfn{flushes} the
+output down the pipe. That is, output is not buffered, but
+written directly. This assures, that pipeline output
+intermixed with @command{gawk}'s output comes out in the
+expected order:
+
+@example
+print "something" # goes to standard output
+print "something else" | "some-command" # also to standard output
+print "more stuff" # and this too
+@end example
+
+There can be a price to pay for this; flushing data down
+the pipeline uses more CPU time, and in certain environments
+this can become expensive.
+
+You can tell @command{gawk} not to flush buffered data in
+one of two ways:
+
+@itemize @bullet
+@item
+Set @code{PROCINFO["BUFFERPIPE"]} to any value. When this is done,
+@command{gawk} will buffer data for all pipelines.
+
+@item
+Set @code{PROCINFO["@var{command}", "BUFFERPIPE"]} to any value.
+In this case, only @var{command}'s data will be fully buffered.
+@end itemize
+
+You @emph{must} create one or the other of these elements
+in @code{PROCINFO} before the first @code{print} or
+@code{printf} to the pipeline. Doing so after output has
+already been sent is too late.
+
+Be aware that using this feature may change the output behavior of
+your programs, so exercise caution.
+
@node Nonfatal
@section Enabling Nonfatal Output
+@c FIXME: Add indexing
This @value{SECTION} describes a @command{gawk}-specific feature.
@@ -11734,7 +11970,8 @@ $ @kbd{gawk 'BEGIN @{ print "hello, \}
In POSIX mode (@pxref{Options}), @command{gawk} does not
allow escaped newlines. Otherwise, it behaves as just described.
-BWK @command{awk} and BusyBox @command{awk}
+BWK @command{awk}@footnote{In all examples throughout this @value{DOCUMENT},
+@command{nawk} is BWK @command{awk}.} and BusyBox @command{awk}
remove the backslash but leave the newline
intact, as part of the string:
@@ -16555,6 +16792,14 @@ to test for these elements
The following elements allow you to change @command{gawk}'s behavior:
@table @code
+@item PROCINFO["BUFFERPIPE"]
+If this element exists, all output to pipelines becomes buffered.
+@xref{Noflush}.
+
+@item PROCINFO["@var{command}", "BUFFERPIPE"]
+Make output to @var{command} buffered.
+@xref{Noflush}.
+
@item PROCINFO["NONFATAL"]
If this element exists, then I/O errors for all redirections become nonfatal.
@xref{Nonfatal}.
@@ -19233,6 +19478,13 @@ seps[2] = "-"
@noindent
The value returned by this call to @code{split()} is three.
+If @command{gawk} is invoked with @option{--csv}, then a two-argument
+call to @code{split()} splits the string using the CSV parsing rules as
+described in @ref{Comma Separated Fields}. With three and four arguments,
+@code{split()} works as just described. The four-argument call makes
+no sense, since each element of @var{seps} would simply consist of a
+string containing a comma.
+
@cindex differences in @command{awk} and @command{gawk} @subentry @code{split()} function
As with input field-splitting, when the value of @var{fieldsep} is
@w{@code{" "}}, leading and trailing whitespace is ignored in values assigned to
@@ -22033,7 +22285,7 @@ $ @kbd{nawk -v A=1 -f funky.awk}
@end example
Or @command{awk} could wait until runtime to set the type of @code{a}.
-In this case, since @code{a} was never assigned used before being
+In this case, since @code{a} was never used before being
passed to the function, how the function uses it forces the type to
be resolved to either scalar or array. @command{gawk}
and the MKS @command{awk} do this:
@@ -22754,6 +23006,7 @@ programming use.
* Readfile Function:: A function to read an entire file at once.
* Shell Quoting:: A function to quote strings for the shell.
* Isnumeric Function:: A function to test whether a value is numeric.
+* To CSV Function:: A function to convert output to CSV format.
@end menu
@node Strtonum Function
@@ -23585,6 +23838,88 @@ the original string.
On the other hand, it uses the @code{typeof()} function
(@pxref{Type Functions}), which is specific to @command{gawk}.
+@node To CSV Function
+@subsection Producing CSV Data
+
+@cindex comma separated values (CSV) data @subentry generating CSV data
+@cindex CSV (comma separated values) data @subentry generating CSV data
+@command{gawk}'s @option{--csv} option causes @command{gawk}
+to process CSV data (@pxref{Comma Separated Fields}).
+
+But what if you have regular data that you want to output
+in CSV format? This @value{SECTION} provides functions for
+doing that.
+
+The first function, @code{tocsv()}, takes an array of data
+fields as input. The array should be indexed starting from one.
+The optional second parameter is the separator to use. If none
+is supplied, the default is a comma.
+
+The function takes care to quote fields that contain double
+quotes, newlines, or the separator character. It then builds
+up the final CSV record and returns it.
+
+@cindex @code{tocsv()} user-defined function
+@example
+@c file eg/lib/tocsv.awk
+# tocsv.awk --- convert data to CSV format
+@c endfile
+@ignore
+@c file eg/lib/tocsv.awk
+#
+# Arnold Robbins, arnold@@skeeve.com, Public Domain
+# April 2023
+@c endfile
+@end ignore
+@c file eg/lib/tocsv.awk
+
+function tocsv(fields, sep, i, j, nfields, result)
+@{
+ if (length(fields) == 0)
+ return ""
+
+ if (sep == "")
+ sep = ","
+ delete nfields
+ for (i = 1; i in fields; i++) @{
+ nfields[i] = fields[i]
+ if (nfields[i] ~ /["\n]/ || index(nfields[i], sep) != 0) @{
+ gsub(/"/, "\"\"", nfields[i]) # double up quotes
+ nfields[i] = "\"" nfields[i] "\"" # wrap in quotes
+ @}
+ @}
+
+ result = nfields[1]
+ j = length(nfields)
+ for (i = 2; i <= j; i++)
+ result = result sep nfields[i]
+
+ return result
+@}
+@c endfile
+@end example
+
+The next function, @code{tocsv_rec()} is a wrapper around
+@code{tocsv()}. Its intended use is for when you want to convert the
+current input record to CSV format. The function itself simply copies
+the fields into an array to pass to @code{tocsv()} which does the work.
+It accepts an optional separator character as its first parameter,
+which it simply passes on to @code{tocsv()}.
+
+@cindex @code{tocsv_rec()} user-defined function
+@example
+@c file eg/lib/tocsv.awk
+function tocsv_rec(sep, i, fields)
+@{
+ delete fields
+ for (i = 1; i <= NF; i++)
+ fields[i] = $i
+
+ return tocsv(fields, sep)
+@}
+@c endfile
+@end example
+
@node Data File Management
@section @value{DDF} Management
@@ -42166,6 +42501,28 @@ in (@pxref{Auto-set}).
@end itemize
+Version 5.3 added the following features:
+
+@itemize
+@item
+Comma separated value (CSV) field splitting
+(@pxref{Comma Separated Fields}).
+
+@item
+The ability to make @command{gawk} buffer output to pipes
+(@pxref{Noflush}).
+
+@item
+The @samp{\u} escape sequence
+(@pxref{Escape Sequences}).
+
+@item
+The need for GNU @code{libsigsegv} was removed from @command{gawk}.
+The value-add was never very much and it caused problems in some
+environments.
+
+@end itemize
+
@c XXX ADD MORE STUFF HERE
@end ifclear
@@ -42183,10 +42540,12 @@ the three most widely used freely available versions of @command{awk}
@headitem Feature @tab BWK @command{awk} @tab @command{mawk} @tab @command{gawk} @tab Now standard
@item @code{**} and @code{**=} operators @tab X @tab @tab X @tab
@item @samp{\x} escape sequence @tab X @tab X @tab X @tab
+@item @samp{\u} escape sequence @tab X @tab @tab X @tab
@item @file{/dev/stdin} special file @tab X @tab X @tab X @tab
@item @file{/dev/stdout} special file @tab X @tab X @tab X @tab
@item @file{/dev/stderr} special file @tab X @tab X @tab X @tab
@item @code{BINMODE} variable @tab @tab X @tab X @tab
+@item CSV support @tab X @tab @tab X @tab
@item @code{FS} as null string @tab X @tab X @tab X @tab
@item @code{delete} without subscript @tab X @tab X @tab X @tab X
@item @code{fflush()} function @tab X @tab X @tab X @tab X
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 23e8c956..58861621 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -54,9 +54,9 @@
@c applies to and all the info about who's publishing this edition
@c These apply across the board.
-@set UPDATE-MONTH December, 2022
-@set VERSION 5.2
-@set PATCHLEVEL 2
+@set UPDATE-MONTH February, 2023
+@set VERSION 5.3
+@set PATCHLEVEL 0
@set GAWKINETTITLE TCP/IP Internetworking with @command{gawk}
@set GAWKWORKFLOWTITLE Participating in @command{gawk} Development
@@ -68,7 +68,7 @@
@set TITLE GAWK: Effective AWK Programming
@end ifclear
@set SUBTITLE A User's Guide for GNU Awk
-@set EDITION 5.2
+@set EDITION 5.3
@iftex
@set DOCUMENT book
@@ -584,6 +584,7 @@ particular records in a file and perform operations upon them.
* Regexp Field Splitting:: Using regexps as the field separator.
* Single Character Fields:: Making each character a separate
field.
+* Comma Separated Fields:: Working with CSV files.
* Command Line Field Separator:: Setting @code{FS} from the command
line.
* Full Line Fields:: Making the full line be a single
@@ -651,6 +652,7 @@ particular records in a file and perform operations upon them.
Pipes.
* Close Return Value:: Using the return value from
@code{close()}.
+* Noflush:: Speeding Up Pipe Output.
* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
@@ -833,6 +835,8 @@ particular records in a file and perform operations upon them.
shell.
* Isnumeric Function:: A function to test whether a value is
numeric.
+* To CSV Function:: A function to convert output to CSV
+ format.
* Data File Management:: Functions for managing command-line
data files.
* Filetrans Function:: A function for handling data file
@@ -1490,6 +1494,10 @@ Document minimally and release.
After eight years, add another part @code{egrep} and two
more parts C. Document very well and release.
+
+After 35 more years, add Unicode and CSV support, sprinkle lightly with
+a few choice features from @command{gawk}, document very well again,
+and release.
@end sidebar
@cindex Aho, Alfred
@@ -4083,6 +4091,19 @@ the program. The trace is printed to standard error. Each ``op code''
is preceded by a @code{+}
sign in the output.
+@item @option{-k}
+@itemx @option{--csv}
+@cindex @option{-k} option
+@cindex @option{--csv} option
+@cindex comma separated values (CSV) data @subentry @option{-k} option
+@cindex comma separated values (CSV) data @subentry @option{--csv} option
+@cindex CSV (comma separated values) data @subentry @option{-k} option
+@cindex CSV (comma separated values) data @subentry @option{--csv} option
+Enable special processing for files with comma separated values
+(CSV). @xref{Comma Separated Fields}.
+This option cannot be used with @option{--posix}. Attempting to do
+causes a fatal error.
+
@item @option{-l} @var{ext}
@itemx @option{--load} @var{ext}
@cindex @option{-l} option
@@ -5555,6 +5576,25 @@ As of @value{PVERSION} 4.2, only two digits
are processed.
@end quotation
+@cindex @code{\} (backslash) @subentry @code{\u} escape sequence
+@cindex backslash (@code{\}) @subentry @code{\u} escape sequence
+@cindex common extensions @subentry @code{\u} escape sequence
+@cindex extensions @subentry common @subentry @code{\u} escape sequence
+@item \u@var{hh}@dots{}
+The hexadecimal value @var{hh}, where @var{hh} stands for a sequence
+of hexadecimal digits (@samp{0}--@samp{9}, and either @samp{A}--@samp{F}
+or @samp{a}--@samp{f}). A maximum of eight digits are allowed after
+the @samp{\u}. Any further hexadecimal digits are treated as simple
+letters or numbers. @value{COMMONEXT}
+(The @samp{\u} escape sequence is not allowed in POSIX awk.)
+
+This escape sequence is intended for designating a character in the
+Unicode character set. @command{gawk} first converts the given digits
+into an integer and then translates the given ``wide character''
+value into the current locale's multibyte encoding (even if that
+is a not a Unicode locale). If the given bytes do not represent
+a valid character, the value becomes @code{"?"}.
+
@cindex @code{\} (backslash) @subentry @code{\/} escape sequence
@cindex backslash (@code{\}) @subentry @code{\/} escape sequence
@item \/
@@ -6713,6 +6753,12 @@ If @code{RS} is any single character, that character separates records.
Otherwise (in @command{gawk}), @code{RS} is treated as a regular expression.
This mechanism is explained in greater detail shortly.
+@quotation NOTE
+When @command{gawk} is invoked with the @option{--csv} option, nothing
+in this @value{SECTION} applies. @xref{Comma Separated Fields}, for the
+details.
+@end quotation
+
@menu
* awk split records:: How standard @command{awk} splits records.
* gawk split records:: How @command{gawk} splits records.
@@ -7359,6 +7405,7 @@ with a statement such as @samp{$1 = $1}, as described earlier.
* Default Field Splitting:: How fields are normally separated.
* Regexp Field Splitting:: Using regexps as the field separator.
* Single Character Fields:: Making each character a separate field.
+* Comma Separated Fields:: Working with CSV files.
* Command Line Field Separator:: Setting @code{FS} from the command line.
* Full Line Fields:: Making the full line be a single field.
* Field Splitting Summary:: Some final points and a summary table.
@@ -7401,10 +7448,10 @@ is read with the proper separator. To do this, use the special
@code{BEGIN} pattern
(@pxref{BEGIN/END}).
For example, here we set the value of @code{FS} to the string
-@code{","}:
+@code{":"}:
@example
-awk 'BEGIN @{ FS = "," @} ; @{ print $2 @}'
+awk 'BEGIN @{ FS = ":" @} ; @{ print $2 @}'
@end example
@cindex @code{BEGIN} pattern
@@ -7412,7 +7459,7 @@ awk 'BEGIN @{ FS = "," @} ; @{ print $2 @}'
Given the input line:
@example
-John Q. Smith, 29 Oak St., Walamazoo, MI 42139
+John Q. Smith: 29 Oak St.: Walamazoo: MI 42139
@end example
@noindent
@@ -7428,7 +7475,7 @@ person's name in the example we just used might have a title or
suffix attached, such as:
@example
-John Q. Smith, LXIX, 29 Oak St., Walamazoo, MI 42139
+John Q. Smith: LXIX: 29 Oak St.: Walamazoo: MI 42139
@end example
@noindent
@@ -7615,6 +7662,93 @@ In compatibility mode
if @code{FS} is the null string, then @command{gawk} also
behaves this way.
+@node Comma Separated Fields
+@subsection Working With Comma Separated Value Files
+
+@cindex comma separated values (CSV) data @subentry records and fields
+@cindex CSV (comma separated values) data @subentry records and fields
+Many commonly-used tools use a comma to separate fields, instead of whitespace.
+This is particularly true of popular spreadsheet programs. There is no
+universally accepted standard for the format of these files, although
+@uref{http://www.ietf.org/rfc/rfc4180, RFC 4180} lists the common
+practices.
+
+For decades, anyone wishing to work with CSV files and @command{awk}
+had to ``roll their own'' solution.
+(For an example, @pxref{Splitting By Content}).
+In 2023, Brian Kernighan decided to add CSV support to his version of
+@command{awk}. In order to keep up, @command{gawk} too provides the same
+support as his version.
+To use CSV data, invoke @command{gawk} with either of the
+@option{-k} or @option{--csv} options.
+
+Fields in CSV files are separated by commas. In order to allow a comma
+to appear inside a field (i.e., as data), the field may be quoted
+by beginning and ending it with double quotes. In order to allow a double
+quote inside a field, the field @emph{must} be quoted, and two double quotes
+represent an actual double quote.
+The double quote that starts a quoted field must be the first
+character after the comma.
+@ref{table-csv-examples} shows some examples.
+
+@float Table,table-csv-examples
+@caption{Examples of CSV data}
+@multitable @columnfractions .3 .3
+@headitem Input @tab Field Contents
+@item @code{abc def} @tab @code{abc def}
+@item @code{"quoted data"} @tab @code{quoted data}
+@item @code{"quoted, data"} @tab @code{quoted, data}
+@item @code{"She said ""Stop!""."} @tab @code{She said "Stop!".}
+@end multitable
+@end float
+
+Additionally, and here's where it gets messy, newlines are also
+allowed inside double-quoted fields!
+In order to deal with such things, when processing CSV files,
+@command{gawk} scans the input data looking for newlines that
+are not enclosed in double quotes. Thus, use of the @option{--csv} option
+totally overrides normal record processing with @code{RS} (@pxref{Records}),
+as well as field splitting with any of @code{FS}, @code{FIELDWIDTHS},
+or @code{FPAT}.
+
+@cindex Kernighan, Brian @subentry quotes
+@sidebar Carriage-Return--Line-Feed Line Endings In CSV Files
+@quotation
+@code{\r\n} @i{is the invention of the devil.}
+@author Brian Kernighan
+@end quotation
+
+Many CSV files are imported from systems where the line terminator
+for text files is a carriage-return--line-feed pair
+(CR-LF, @samp{\r} followed by @samp{\n}).
+For ease of use, when processing CSV files, @command{gawk} converts
+CR-LF pairs into a single newline. That is, the @samp{\r} is removed.
+
+This occurs only when a CR is paired with an LF; a standalone CR
+is left alone. This behavior is consistent with with Windows systems
+which automatically convert CR-LF in files into a plain LF in memory,
+and also with the commonly available @command{unix2dos} utility program.
+@end sidebar
+
+The behavior of the @code{split()} function (not formally discussed
+yet, see @ref{String Functions}) differs slightly when processing CSV
+files. When called with two arguments
+(@samp{split(@var{string}, @var{array})}), @code{split()}
+does CSV-based splitting. Otherwise, it behaves normally.
+
+If @option{--csv} has been used, @code{PROCINFO["CSV"]} will
+exist. Otherwise, it will not. @xref{Auto-set}.
+
+Finally, if @option{--csv} has been used, assigning a value
+to any of @code{FS}, @code{FIELDWIDTHS}, @code{FPAT}, or
+@code{RS} generates a warning message.
+
+To be clear, @command{gawk} takes
+@uref{http://www.ietf.org/rfc/rfc4180, RFC 4180} as its
+specification for CSV input data. There are no mechanisms
+for accepting nonstandard CSV data, such as files that use
+a semicolon instead of a comma as the separator.
+
@node Command Line Field Separator
@subsection Setting @code{FS} from the Command Line
@cindex @option{-F} option @subentry command-line
@@ -7797,10 +7931,18 @@ The following list summarizes how fields are split, based on the value
of @code{FS} (@samp{==} means ``is equal to''):
@table @code
+@item @asis{@command{gawk} was invoked with @option{--csv}}
+Field splitting follows the rules given in @ref{Comma Separated Fields}.
+The value of @code{FS} is ignored.
+
@item FS == " "
Fields are separated by runs of whitespace. Leading and trailing
whitespace are ignored. This is the default.
+@item FS == ","
+Fields are separated by commas, with quoting of fields
+and special rules involved.
+
@item FS == @var{any other single character}
Fields are separated by each occurrence of the character. Multiple
successive occurrences delimit empty fields, as do leading and
@@ -8046,6 +8188,9 @@ four, and @code{$4} has the value @code{"ddd"}.
@node Splitting By Content
@section Defining Fields by Content
+@strong{FIXME}: This whole section needs rewriting now
+that @command{gawk} has built-in CSV parsing. Sigh.
+
@menu
* More CSV:: More on CSV files.
* FS versus FPAT:: A subtle difference.
@@ -8067,7 +8212,7 @@ what they are, and not by what they are not.
@cindex CSV (comma separated values) data @subentry parsing with @code{FPAT}
@cindex Comma separated values (CSV) data @subentry parsing with @code{FPAT}
The most notorious such case
-is so-called @dfn{comma-separated values} (CSV) data. Many spreadsheet programs,
+is comma-separated values (CSV) data. Many spreadsheet programs,
for example, can export their data into text files, where each record is
terminated with a newline, and fields are separated by commas. If
commas only separated the data, there wouldn't be an issue. The problem comes when
@@ -8185,6 +8330,13 @@ with @code{FS} and with @code{FIELDWIDTHS}.
Finally, the @code{patsplit()} function makes the same functionality
available for splitting regular strings (@pxref{String Functions}).
+@quotation NOTE
+Given that @command{gawk} now has built-in CSV parsing
+(@pxref{Comma Separated Fields}), the examples presented here are obsolete.
+Nonetheless, it remains useful as an example of what @code{FPAT}-based
+field parsing can do.
+@end quotation
+
@node More CSV
@subsection More on CSV Files
@@ -8303,7 +8455,9 @@ The value is @code{"FS"} if regular field splitting is being used,
or @code{"FPAT"} if content-based field splitting is being used:
@example
-if (PROCINFO["FS"] == "FS")
+if ("CSV" in PROCINFO)
+ @var{CSV-based field splitting} @dots{}
+else if (PROCINFO["FS"] == "FS")
@var{regular field splitting} @dots{}
else if (PROCINFO["FS"] == "FIELDWIDTHS")
@var{fixed-width field splitting} @dots{}
@@ -8314,7 +8468,7 @@ else
@end example
This information is useful when writing a function that needs to
-temporarily change @code{FS} or @code{FIELDWIDTHS}, read some records,
+temporarily change @code{FS}, @code{FIELDWIDTHS}, or @code{FPAT}, read some records,
and then restore the original settings (@pxref{Passwd Functions} for an
example of such a function).
@@ -9414,6 +9568,7 @@ and discusses the @code{close()} built-in function.
@command{gawk} allows access to inherited file
descriptors.
* Close Files And Pipes:: Closing Input and Output Files and Pipes.
+* Noflush:: Speeding Up Pipe Output.
* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
@@ -10874,8 +11029,53 @@ pipes; thus, the return value cannot be used portably.
In POSIX mode (@pxref{Options}), @command{gawk} just returns zero
when closing a pipe.
+@node Noflush
+@section Speeding Up Pipe Output
+@c FIXME: Add indexing
+
+This @value{SECTION} describes a @command{gawk}-specific feature.
+
+Normally, when you send data down a pipeline to a command with
+@code{print} or @code{printf}, @command{gawk} @dfn{flushes} the
+output down the pipe. That is, output is not buffered, but
+written directly. This assures, that pipeline output
+intermixed with @command{gawk}'s output comes out in the
+expected order:
+
+@example
+print "something" # goes to standard output
+print "something else" | "some-command" # also to standard output
+print "more stuff" # and this too
+@end example
+
+There can be a price to pay for this; flushing data down
+the pipeline uses more CPU time, and in certain environments
+this can become expensive.
+
+You can tell @command{gawk} not to flush buffered data in
+one of two ways:
+
+@itemize @bullet
+@item
+Set @code{PROCINFO["BUFFERPIPE"]} to any value. When this is done,
+@command{gawk} will buffer data for all pipelines.
+
+@item
+Set @code{PROCINFO["@var{command}", "BUFFERPIPE"]} to any value.
+In this case, only @var{command}'s data will be fully buffered.
+@end itemize
+
+You @emph{must} create one or the other of these elements
+in @code{PROCINFO} before the first @code{print} or
+@code{printf} to the pipeline. Doing so after output has
+already been sent is too late.
+
+Be aware that using this feature may change the output behavior of
+your programs, so exercise caution.
+
@node Nonfatal
@section Enabling Nonfatal Output
+@c FIXME: Add indexing
This @value{SECTION} describes a @command{gawk}-specific feature.
@@ -11162,7 +11362,8 @@ $ @kbd{gawk 'BEGIN @{ print "hello, \}
In POSIX mode (@pxref{Options}), @command{gawk} does not
allow escaped newlines. Otherwise, it behaves as just described.
-BWK @command{awk} and BusyBox @command{awk}
+BWK @command{awk}@footnote{In all examples throughout this @value{DOCUMENT},
+@command{nawk} is BWK @command{awk}.} and BusyBox @command{awk}
remove the backslash but leave the newline
intact, as part of the string:
@@ -15815,6 +16016,14 @@ to test for these elements
The following elements allow you to change @command{gawk}'s behavior:
@table @code
+@item PROCINFO["BUFFERPIPE"]
+If this element exists, all output to pipelines becomes buffered.
+@xref{Noflush}.
+
+@item PROCINFO["@var{command}", "BUFFERPIPE"]
+Make output to @var{command} buffered.
+@xref{Noflush}.
+
@item PROCINFO["NONFATAL"]
If this element exists, then I/O errors for all redirections become nonfatal.
@xref{Nonfatal}.
@@ -18447,6 +18656,13 @@ seps[2] = "-"
@noindent
The value returned by this call to @code{split()} is three.
+If @command{gawk} is invoked with @option{--csv}, then a two-argument
+call to @code{split()} splits the string using the CSV parsing rules as
+described in @ref{Comma Separated Fields}. With three and four arguments,
+@code{split()} works as just described. The four-argument call makes
+no sense, since each element of @var{seps} would simply consist of a
+string containing a comma.
+
@cindex differences in @command{awk} and @command{gawk} @subentry @code{split()} function
As with input field-splitting, when the value of @var{fieldsep} is
@w{@code{" "}}, leading and trailing whitespace is ignored in values assigned to
@@ -21018,7 +21234,7 @@ $ @kbd{nawk -v A=1 -f funky.awk}
@end example
Or @command{awk} could wait until runtime to set the type of @code{a}.
-In this case, since @code{a} was never assigned used before being
+In this case, since @code{a} was never used before being
passed to the function, how the function uses it forces the type to
be resolved to either scalar or array. @command{gawk}
and the MKS @command{awk} do this:
@@ -21739,6 +21955,7 @@ programming use.
* Readfile Function:: A function to read an entire file at once.
* Shell Quoting:: A function to quote strings for the shell.
* Isnumeric Function:: A function to test whether a value is numeric.
+* To CSV Function:: A function to convert output to CSV format.
@end menu
@node Strtonum Function
@@ -22570,6 +22787,88 @@ the original string.
On the other hand, it uses the @code{typeof()} function
(@pxref{Type Functions}), which is specific to @command{gawk}.
+@node To CSV Function
+@subsection Producing CSV Data
+
+@cindex comma separated values (CSV) data @subentry generating CSV data
+@cindex CSV (comma separated values) data @subentry generating CSV data
+@command{gawk}'s @option{--csv} option causes @command{gawk}
+to process CSV data (@pxref{Comma Separated Fields}).
+
+But what if you have regular data that you want to output
+in CSV format? This @value{SECTION} provides functions for
+doing that.
+
+The first function, @code{tocsv()}, takes an array of data
+fields as input. The array should be indexed starting from one.
+The optional second parameter is the separator to use. If none
+is supplied, the default is a comma.
+
+The function takes care to quote fields that contain double
+quotes, newlines, or the separator character. It then builds
+up the final CSV record and returns it.
+
+@cindex @code{tocsv()} user-defined function
+@example
+@c file eg/lib/tocsv.awk
+# tocsv.awk --- convert data to CSV format
+@c endfile
+@ignore
+@c file eg/lib/tocsv.awk
+#
+# Arnold Robbins, arnold@@skeeve.com, Public Domain
+# April 2023
+@c endfile
+@end ignore
+@c file eg/lib/tocsv.awk
+
+function tocsv(fields, sep, i, j, nfields, result)
+@{
+ if (length(fields) == 0)
+ return ""
+
+ if (sep == "")
+ sep = ","
+ delete nfields
+ for (i = 1; i in fields; i++) @{
+ nfields[i] = fields[i]
+ if (nfields[i] ~ /["\n]/ || index(nfields[i], sep) != 0) @{
+ gsub(/"/, "\"\"", nfields[i]) # double up quotes
+ nfields[i] = "\"" nfields[i] "\"" # wrap in quotes
+ @}
+ @}
+
+ result = nfields[1]
+ j = length(nfields)
+ for (i = 2; i <= j; i++)
+ result = result sep nfields[i]
+
+ return result
+@}
+@c endfile
+@end example
+
+The next function, @code{tocsv_rec()} is a wrapper around
+@code{tocsv()}. Its intended use is for when you want to convert the
+current input record to CSV format. The function itself simply copies
+the fields into an array to pass to @code{tocsv()} which does the work.
+It accepts an optional separator character as its first parameter,
+which it simply passes on to @code{tocsv()}.
+
+@cindex @code{tocsv_rec()} user-defined function
+@example
+@c file eg/lib/tocsv.awk
+function tocsv_rec(sep, i, fields)
+@{
+ delete fields
+ for (i = 1; i <= NF; i++)
+ fields[i] = $i
+
+ return tocsv(fields, sep)
+@}
+@c endfile
+@end example
+
@node Data File Management
@section @value{DDF} Management
@@ -41082,6 +41381,28 @@ in (@pxref{Auto-set}).
@end itemize
+Version 5.3 added the following features:
+
+@itemize
+@item
+Comma separated value (CSV) field splitting
+(@pxref{Comma Separated Fields}).
+
+@item
+The ability to make @command{gawk} buffer output to pipes
+(@pxref{Noflush}).
+
+@item
+The @samp{\u} escape sequence
+(@pxref{Escape Sequences}).
+
+@item
+The need for GNU @code{libsigsegv} was removed from @command{gawk}.
+The value-add was never very much and it caused problems in some
+environments.
+
+@end itemize
+
@c XXX ADD MORE STUFF HERE
@end ifclear
@@ -41099,10 +41420,12 @@ the three most widely used freely available versions of @command{awk}
@headitem Feature @tab BWK @command{awk} @tab @command{mawk} @tab @command{gawk} @tab Now standard
@item @code{**} and @code{**=} operators @tab X @tab @tab X @tab
@item @samp{\x} escape sequence @tab X @tab X @tab X @tab
+@item @samp{\u} escape sequence @tab X @tab @tab X @tab
@item @file{/dev/stdin} special file @tab X @tab X @tab X @tab
@item @file{/dev/stdout} special file @tab X @tab X @tab X @tab
@item @file{/dev/stderr} special file @tab X @tab X @tab X @tab
@item @code{BINMODE} variable @tab @tab X @tab X @tab
+@item CSV support @tab X @tab @tab X @tab
@item @code{FS} as null string @tab X @tab X @tab X @tab
@item @code{delete} without subscript @tab X @tab X @tab X @tab X
@item @code{fflush()} function @tab X @tab X @tab X @tab X
diff --git a/doc/it/ChangeLog b/doc/it/ChangeLog
index 426b9f56..39fa3e5c 100644..100755
--- a/doc/it/ChangeLog
+++ b/doc/it/ChangeLog
@@ -1,7 +1,136 @@
+2023-04-12 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2023-03-30 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2023-03-28 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2023-03-28 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawk.1: Updated.
+ * gawktexi.in: Updated.
+ * texinfo.tex: Updated.
+
+2023-03-07 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2023-02-26 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2023-02-24 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2023-02-15 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (EDITION): Bump to 5.3. Thanks to Antonio
+ Columbo for the suggestion.
+
+2023-02-13 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2023-02-10 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2023-02-07 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * texinfo.tex: Updated.
+
+2023-01-23 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2023-01-04 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * texinfo.tex: Updated.
+
+2022-12-24 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * texinfo.tex: Updated.
+
+2022-12-22 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * gendocs.sh: Updated.
+ * texinfo.tex: Updated.
+
+2022-12-02 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-12-01 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-11-23 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * texinfo.tex: Updated.
+
+2022-11-18 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * pm-gawk.1: Updated.
+
2022-11-17 Arnold D. Robbins <arnold@skeeve.com>
* 5.2.1: Release tar ball made.
+2022-11-13 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-11-13 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-11-12 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-11-08 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-10-24 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-10-18 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * texinfo.tex: Updated.
+
+2022-10-04 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-09-26 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-09-22 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-09-18 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-09-08 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * texinfo.tex: Updated.
+
2022-09-04 Arnold D. Robbins <arnold@skeeve.com>
* 5.2.0: Release tar ball made.
diff --git a/doc/it/api-figura1.eps b/doc/it/gawk-api-figura1.eps
index 93560797..93560797 100644
--- a/doc/it/api-figura1.eps
+++ b/doc/it/gawk-api-figura1.eps
diff --git a/doc/it/api-figura1.fig b/doc/it/gawk-api-figura1.fig
index c2718c71..c2718c71 100644
--- a/doc/it/api-figura1.fig
+++ b/doc/it/gawk-api-figura1.fig
diff --git a/doc/it/api-figura1.pdf b/doc/it/gawk-api-figura1.pdf
index f31e25a8..f31e25a8 100644
--- a/doc/it/api-figura1.pdf
+++ b/doc/it/gawk-api-figura1.pdf
Binary files differ
diff --git a/doc/it/api-figura1.png b/doc/it/gawk-api-figura1.png
index 444c2976..444c2976 100644
--- a/doc/it/api-figura1.png
+++ b/doc/it/gawk-api-figura1.png
Binary files differ
diff --git a/doc/it/api-figura1.txt b/doc/it/gawk-api-figura1.txt
index 630e18f0..630e18f0 100644
--- a/doc/it/api-figura1.txt
+++ b/doc/it/gawk-api-figura1.txt
diff --git a/doc/it/api-figura2.eps b/doc/it/gawk-api-figura2.eps
index 9920d3b9..9920d3b9 100644
--- a/doc/it/api-figura2.eps
+++ b/doc/it/gawk-api-figura2.eps
diff --git a/doc/it/api-figura2.fig b/doc/it/gawk-api-figura2.fig
index a8b5c47d..a8b5c47d 100644
--- a/doc/it/api-figura2.fig
+++ b/doc/it/gawk-api-figura2.fig
diff --git a/doc/it/api-figura2.pdf b/doc/it/gawk-api-figura2.pdf
index cadd4267..cadd4267 100644
--- a/doc/it/api-figura2.pdf
+++ b/doc/it/gawk-api-figura2.pdf
Binary files differ
diff --git a/doc/it/api-figura2.png b/doc/it/gawk-api-figura2.png
index dbc46910..dbc46910 100644
--- a/doc/it/api-figura2.png
+++ b/doc/it/gawk-api-figura2.png
Binary files differ
diff --git a/doc/it/api-figura2.txt b/doc/it/gawk-api-figura2.txt
index a030fb5a..a030fb5a 100644
--- a/doc/it/api-figura2.txt
+++ b/doc/it/gawk-api-figura2.txt
diff --git a/doc/it/api-figura3.eps b/doc/it/gawk-api-figura3.eps
index daa3ba76..daa3ba76 100644
--- a/doc/it/api-figura3.eps
+++ b/doc/it/gawk-api-figura3.eps
diff --git a/doc/it/api-figura3.fig b/doc/it/gawk-api-figura3.fig
index fae92940..fae92940 100644
--- a/doc/it/api-figura3.fig
+++ b/doc/it/gawk-api-figura3.fig
diff --git a/doc/it/api-figura3.pdf b/doc/it/gawk-api-figura3.pdf
index 07f406bd..07f406bd 100644
--- a/doc/it/api-figura3.pdf
+++ b/doc/it/gawk-api-figura3.pdf
Binary files differ
diff --git a/doc/it/api-figura3.png b/doc/it/gawk-api-figura3.png
index 26ca6cd6..26ca6cd6 100644
--- a/doc/it/api-figura3.png
+++ b/doc/it/gawk-api-figura3.png
Binary files differ
diff --git a/doc/it/api-figura3.txt b/doc/it/gawk-api-figura3.txt
index 02791df5..02791df5 100644
--- a/doc/it/api-figura3.txt
+++ b/doc/it/gawk-api-figura3.txt
diff --git a/doc/it/flusso-elaborazione.eps b/doc/it/gawk-flusso-elaborazione.eps
index c9e4c938..c9e4c938 100644
--- a/doc/it/flusso-elaborazione.eps
+++ b/doc/it/gawk-flusso-elaborazione.eps
diff --git a/doc/it/flusso-elaborazione.fig b/doc/it/gawk-flusso-elaborazione.fig
index 50c9a209..50c9a209 100644
--- a/doc/it/flusso-elaborazione.fig
+++ b/doc/it/gawk-flusso-elaborazione.fig
diff --git a/doc/it/flusso-elaborazione.pdf b/doc/it/gawk-flusso-elaborazione.pdf
index e7fb8555..e7fb8555 100644
--- a/doc/it/flusso-elaborazione.pdf
+++ b/doc/it/gawk-flusso-elaborazione.pdf
Binary files differ
diff --git a/doc/it/flusso-elaborazione.png b/doc/it/gawk-flusso-elaborazione.png
index 4dc95902..4dc95902 100644
--- a/doc/it/flusso-elaborazione.png
+++ b/doc/it/gawk-flusso-elaborazione.png
Binary files differ
diff --git a/doc/it/flusso-elaborazione.txt b/doc/it/gawk-flusso-elaborazione.txt
index 87a5b439..87a5b439 100644
--- a/doc/it/flusso-elaborazione.txt
+++ b/doc/it/gawk-flusso-elaborazione.txt
diff --git a/doc/it/programma-generico.eps b/doc/it/gawk-programma-generico.eps
index db87944d..db87944d 100644
--- a/doc/it/programma-generico.eps
+++ b/doc/it/gawk-programma-generico.eps
diff --git a/doc/it/programma-generico.fig b/doc/it/gawk-programma-generico.fig
index e87f6e3b..e87f6e3b 100644
--- a/doc/it/programma-generico.fig
+++ b/doc/it/gawk-programma-generico.fig
diff --git a/doc/it/programma-generico.pdf b/doc/it/gawk-programma-generico.pdf
index d5c751af..d5c751af 100644
--- a/doc/it/programma-generico.pdf
+++ b/doc/it/gawk-programma-generico.pdf
Binary files differ
diff --git a/doc/it/programma-generico.png b/doc/it/gawk-programma-generico.png
index 1a877907..1a877907 100644
--- a/doc/it/programma-generico.png
+++ b/doc/it/gawk-programma-generico.png
Binary files differ
diff --git a/doc/it/programma-generico.txt b/doc/it/gawk-programma-generico.txt
index 1f6e5124..1f6e5124 100644
--- a/doc/it/programma-generico.txt
+++ b/doc/it/gawk-programma-generico.txt
diff --git a/doc/it/vettore-elementi.eps b/doc/it/gawk-vettore-elementi.eps
index 87979fb8..87979fb8 100644
--- a/doc/it/vettore-elementi.eps
+++ b/doc/it/gawk-vettore-elementi.eps
diff --git a/doc/it/vettore-elementi.fig b/doc/it/gawk-vettore-elementi.fig
index 37f3449c..37f3449c 100644
--- a/doc/it/vettore-elementi.fig
+++ b/doc/it/gawk-vettore-elementi.fig
diff --git a/doc/it/vettore-elementi.pdf b/doc/it/gawk-vettore-elementi.pdf
index cfec8760..cfec8760 100644
--- a/doc/it/vettore-elementi.pdf
+++ b/doc/it/gawk-vettore-elementi.pdf
Binary files differ
diff --git a/doc/it/vettore-elementi.png b/doc/it/gawk-vettore-elementi.png
index 87ef434d..87ef434d 100644
--- a/doc/it/vettore-elementi.png
+++ b/doc/it/gawk-vettore-elementi.png
Binary files differ
diff --git a/doc/it/vettore-elementi.txt b/doc/it/gawk-vettore-elementi.txt
index 5d7efb83..5d7efb83 100644
--- a/doc/it/vettore-elementi.txt
+++ b/doc/it/gawk-vettore-elementi.txt
diff --git a/doc/it/gawk.1 b/doc/it/gawk.1
index 2260da18..ab2c2d97 100644..100755
--- a/doc/it/gawk.1
+++ b/doc/it/gawk.1
@@ -20,6 +20,7 @@
.\"Aggiornam. a gawk-5.1.1 di A.G. Colombo - Maggio 2022
.\"Aggiornam. a gawk-5.1.1 di A.G. Colombo - Giugno 2022
.\"Aggiornam. a gawk-5.2.0 di A.G. Colombo - Luglio 2022
+.\"Aggiornam. a gawk-5.3.0 di A.G. Colombo - Marzo 2023
.ds PX \s-1POSIX\s+1
.ds UX \s-1UNIX\s+1
@@ -257,6 +258,14 @@ Questa trace è stampata sullo standard error.
Ogni ``codice operativo'' è preceduto da un segno
.B +
nell'output.
+.TP
+\fB\-k\fR, \fB\-\^\-csv\fR
+Abilita gestione speciale file CSV
+[Comma Separated Values - Valori Separati da Virgola].
+Vedere il manuale per i dettagli.
+.BR FIXME :
+Eventualmente, fornire un link (URL) qui.
+.TP
.BI \-l " lib\fR, "\c
.BI \-\^\-load " lib"
Carica un'estensione
@@ -656,6 +665,23 @@ Analogamente, assegnare un valore a
.B $0
provoca una nuova divisione del record, creando nuovi
valori per i suoi campi.
+.SS Comma Separated Values [Valori Separati da Virgola]
+Quando è chiamato specificando l'opzione
+.B \-\^\-csv,
+.I gawk
+non usa le regole spiegate sopra per determinare cosa costituisce
+un record e per dividerlo in campi.
+Invece, i record sono delimitati dai caratteri "ritorno a capo",
+che non siano all'interno di un campo CSV [per esempio, un
+campo che contenga un indirizzo completo è normalmente su più
+righe, che però formano un unico campo]. I campi sono separati
+fra loro da una virgola.
+I caratteri "doppio apice" possono essere usati per indicare
+campi che contengono virgole, ritorni a capo, o doppi apici
+[che vanno raddoppiati].
+Vedere il manuale per i dettagli.
+.B FIXME
+Eventualmente, fornire un link (URL) qui.
.SS Variabili predefinite
Le variabili predefinite di
.IR gawk "
diff --git a/doc/it/gawkbug.1 b/doc/it/gawkbug.1
new file mode 100755
index 00000000..484777a8
--- /dev/null
+++ b/doc/it/gawkbug.1
@@ -0,0 +1,84 @@
+.\"
+.\" MAN PAGE COMMENTS to
+.\"
+.\" Arnold Robbins
+.\" bug-gawk@gnu.org
+.\"
+.\" Last Change: Mon Apr 18 16:21:25 IDT 2022
+.\"
+.\" Traduzione di Antonio Giovanni Colombo <azc100@gmail.com>
+.\" per la versione gawk-5.2
+.TH GAWKBUG 1 "2022 Apr 18" "GNU Awk 5.2"
+.SH NOME
+gawkbug \- segnala un bug di gawk
+.SH SINTASSI
+\fBgawkbug\fP [\fI--version\fP] [\fI--help\fP] [\fIindirizzo-email\fP]
+.SH DESCRIZIONE
+.B gawkbug
+è una script di shell che aiuta un utente a comporre e spedire delle
+segnalazioni di bug riguardo a
+.B gawk
+in un formato standard.
+.B gawkbug
+chiama il programma di edit specificato nella variabile
+.SM
+.B EDITOR
+per modificare una copia temporanea di un modulo standard per
+la segnalazione di errori. L'utente deve riempire i campi appropriati
+e quindi uscire dalla sessione di edit.
+In seguito,
+.B gawkbug
+spedisce la segnalazione così preparata a \fIbug-gawk@gnu.org\fP, o
+all'\fIindirizzo-email\fP specificato. Se l'invio non riesce, il
+modulo compilato viene salvato, con il nome \fIdead.gawkbug\fP,
+nella home directory dell'utente che sta facendo la segnalazione.
+.PP
+Il modulo di segnalazione bug è composto da più sezioni.
+La prima sezione fornisce informazioni riguarda al computer, al
+sistema operativo, alla versione di
+.B gawk
+e all'ambiente di compilazione.
+La seconda sezione va riempita con la descrizione del bug.
+La terza sezione dovrebbe contenere una descrizione di come è
+possibile riprodurre il bug.
+La quarta sezione (opzionale) permette di segnalare una possibile
+correzione. La segnalazione di correzioni è molto gradita.
+.SH VARIABILI D'AMBIENTE
+.B gawkbug
+utilizzerà le seguenti variabili d'ambiente, se definite:
+.TP
+.B EDITOR
+Specifica il programma di edit preferito. Se
+.SM
+.B EDITOR
+non è impostato,
+.B gawkbug
+tenta di trovare alcuni programma di edit alternativi, compreso
+.BR vim
+e, se necessario,
+.BR emacs .
+Se
+.B gawkbug
+non riesce a trovare alcun programma di edit alternativo, tenta di eseguire \fBvi\fP.
+.TP
+.B HOME
+Nome della directory in cui viene salvata una segnalazione di bug, se non
+è stato possibile inviarla con la posta elettronica.
+.TP
+.B TMPDIR
+Nome della directory in cui creare file e directory temporanei.
+.SH VEDERE ANCHE
+.TP
+\fIgawk\fP(1)
+.SH AUTORI
+Brian Fox, Free Software Foundation
+.br
+bfox@gnu.org
+.PP
+Chet Ramey, Case Western Reserve University
+.br
+chet@po.cwru.edu
+.PP
+Arnold Robbins
+.br
+bug-gawk@gnu.org
diff --git a/doc/it/gawktexi.in b/doc/it/gawktexi.in
index 26e35e2c..8faac5de 100644..100755
--- a/doc/it/gawktexi.in
+++ b/doc/it/gawktexi.in
@@ -56,8 +56,8 @@
@c applies to and all the info about who's publishing this edition
@c These apply across the board.
-@set UPDATE-MONTH Agosto 2022
-@set VERSION 5.2
+@set UPDATE-MONTH Febbraio 2023
+@set VERSION 5.3
@set PATCHLEVEL 0
@c added Italian hyphenation stuff
@@ -73,7 +73,7 @@
@set TITLE GAWK: Programmare efficacemente in AWK
@end ifclear
@set SUBTITLE Una Guida Utente per GNU Awk
-@set EDITION 5.2
+@set EDITION 5.3
@iftex
@set DOCUMENT libro
@@ -93,6 +93,16 @@
@set COMMONEXT (e.c.)
@set PAGE pagina
@end iftex
+@iflatex
+@set DOCUMENT libro
+@set CHAPTER capitolo
+@set APPENDIX appendice
+@set SECTION sezione
+@set SUBSECTION sottosezione
+@set DARKCORNER (a.b.)
+@set COMMONEXT (e.c.)
+@set PAGE pagina
+@end iflatex
@ifinfo
@set DOCUMENT File Info
@set CHAPTER nodo principale
@@ -179,6 +189,10 @@
@set LEQ @math{@leq}
@set PI @math{@pi}
@end iftex
+@iflatex
+@set LEQ <=
+@set PI @i{pi}
+@end iflatex
@ifdocbook
@set LEQ @inlineraw{docbook, &le;}
@set PI @inlineraw{docbook, &pgr;}
@@ -276,6 +290,10 @@ Some comments on the layout for TeX.
@syncodeindex fn cp
@syncodeindex vr cp
@end iftex
+@iflatex
+@syncodeindex fn cp
+@syncodeindex vr cp
+@end iflatex
@ifxml
@syncodeindex fn cp
@syncodeindex vr cp
@@ -293,6 +311,9 @@ Some comments on the layout for TeX.
@iftex
@finalout
@end iftex
+@iflatex
+@finalout
+@end iflatex
@c Enabled '-quotes in PDF files so that cut/paste works in
@c more places.
@@ -318,7 +339,7 @@ Email: <email>gnu@@gnu.org</email>
URL: <ulink url="https://www.gnu.org">https://www.gnu.org/</ulink>
</literallayout>
-<literallayout class="normal">Copyright &copy; 1989, 1991, 1992, 1993, 1996&ndash;2005, 2007, 2009&ndash;2022
+<literallayout class="normal">Copyright &copy; 1989, 1991, 1992, 1993, 1996&ndash;2005, 2007, 2009&ndash;2023
Free Software Foundation, Inc.
All Rights Reserved.
</literallayout>
@@ -341,7 +362,7 @@ Italian Linux Documentation Project (ILDP)
Email: <emailildp@@pluto.it
URL: <ulink url="http://www.pluto.it/ildp">http://www.pluto.it/ildp/</ulink></literallayout>
-<literallayout class="normal">Copyright &copy; 2016&ndash;2022
+<literallayout class="normal">Copyright &copy; 2016&ndash;2023
Free Software Foundation, Inc.
All Rights Reserved.
</literallayout>
@@ -349,7 +370,7 @@ All Rights Reserved.
@ifnotdocbook
@iftex
-Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2022 @*
+Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2023 @*
Free Software Foundation, Inc.
@end iftex
@end ifnotdocbook
@@ -436,7 +457,7 @@ URL: @uref{https://www.gnu.org/}@*
@c This one is correct for gawk 3.1.0 from the FSF
@c ISBN 1-882114-28-0
@sp 0
-Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2022@*
+Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2023@*
Free Software Foundation, Inc.
@sp 1
Traduzione e revisione:@*
@@ -679,6 +700,7 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Separare campi con @dfn{regexp}:: Usare @dfn{regexp} come separatori.
* Campi di un solo carattere:: Fare di ogni carattere un campo
separato.
+* Campi separati da virgola:: Lavorare con file CSV.
* Separatori campo da riga di comando:: Impostare @code{FS} dalla riga di
comando.
* Campo intera riga:: Fare di una riga intera un campo
@@ -692,7 +714,7 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Campi con dati a larghezza fissa:: Valore di campi con dati a larghezza
fissa.
* Separazione in base al contenuto:: Definire campi dal loro contenuto.
-* File CSV:: Ancora sui file CSV.
+* Ancora CSV:: Ancora sui file CSV.
* FS rispetto a FPAT:: Una differenza sottile.
* Controllare la creazione di campi:: Controllare come @command{gawk} sta
suddividendo i record.
@@ -746,6 +768,9 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Avvertimenti speciali:: Cose a cui prestare attenzione.
* Chiusura file e @dfn{pipe}:: Chiudere file in input e di output e
@dfn{pipe}.
+* Valore restituito da @code{close}:: Usare il valore di ritorno restituito da
+ @code{close()}.
+* Noflush:: Velocizzare output da @dfn{pipe}.
* Continuazione dopo errori:: Abilitare continuazione dopo errori
in output.
* Sommario di Output:: Sommario di Output.
@@ -944,7 +969,9 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Funzione getlocaltime:: Una funzione per ottenere data e
ora nel formato desiderato.
* Funzione isnumeric:: Una funzione per controllare se un
- valore @`e numerico.
+ valore @`e numerico.
+* Funzione tocsv:: Una funzione per convertire l'output
+ al formato CSV.
* Funzione readfile:: Una funzione per leggere un file
intero in un colpo solo.
* Apici alla shell:: Una funzione per passare stringhe
@@ -1215,15 +1242,16 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
per Cygwin.
* MSYS:: Usare @command{gawk} nell'ambiente
MSYS.
-* Installazione su VMS:: Installare @command{gawk} su VMS.
-* Compilazione su VMS:: Come compilare @command{gawk} su
- VMS.
-* Estensioni dinamiche su VMS:: Compilare estensioni dinamiche
- di @command{gawk} su VMS.
-* Dettagli installazione su VMS:: Come installare @command{gawk} su
- VMS.
-* Esecuzione su VMS:: Come eseguire @command{gawk} su VMS.
-* GNV su VMS:: Il progetto GNV di VMS.
+* Installazione su OpenVMS:: Installare @command{gawk} su OpenVMS.
+* Compilazione su OpenVMS:: Come compilare @command{gawk} su
+ OpenVMS.
+* Estensioni dinamiche su OpenVMS:: Compilare estensioni dinamiche
+ di @command{gawk} su OpenVMS.
+* Dettagli installazione su OpenVMS:: Come installare @command{gawk} su
+ OpenVMS.
+* Esecuzione su OpenVMS:: Come eseguire @command{gawk} su
+ OpenVMS.
+* GNV su OpenVMS:: Il progetto GNV su OpenVMS.
* Bug:: Notificare problemi e bug.
* Definizione di bug:: Definire cos'@`e e cosa non @`e un bug.
* Indirizzo bug:: Dove notificare problemi.
@@ -1622,7 +1650,7 @@ implementazione di @command{awk} chiamata @command{gawk} (che sta per
``GNU @command{awk}''). @command{gawk} funziona su una vasta gamma di sistemi
Unix, dai PC basati su architettura Intel fino
a sistemi di potenza molto maggiore.
-@command{gawk} @`e stato portato anche su Mac OS X,
+@command{gawk} @`e stato portato anche su macOS, z/OS,
Microsoft Windows
(tutte le versioni),
e OpenVMS.@footnote{Qualche altro sistema operativo obsoleto su cui
@@ -3622,7 +3650,7 @@ Questo esempio @`e leggermente diverso da quello precedente:
l'input @`e l'output del comando @command{expand}, che cambia i TAB
in spazi, in modo che le larghezze confrontate siano quelle che sarebbero
qualora le si stampasse, e non il numero dei caratteri di input su ogni
-riga. [il carattere TAB occupa un byte nel file, ma pu@`o generare fino a
+riga. [Il carattere TAB occupa un byte nel file, ma pu@`o generare fino a
otto spazi bianchi in fase di stampa.]
@item
@@ -3897,7 +3925,7 @@ per programmi sulla riga di comando, @emph{ammesso} che si stia usando una
shell conforme a POSIX, come la Unix Bourne shell o Bash. Ma la C shell si
comporta in maniera diversa! In quel caso, occorre usare due barre inverse
consecutive, in fondo alla riga. Si noti anche che quando si usa la C shell
-@emph{ogni} andata a capo nel vostro programma @command{awk} deve essere
+@emph{ogni} andata a capo nel vostro programma @command{awk} dev'essere
indicata con una barra inversa. Per esempio:
@example
@@ -3954,6 +3982,13 @@ successiva. Invece, la combinazione barra inversa-ritorno a capo non viene
per nulla notata, in quanto ``nascosta'' all'interno del commento. Quindi,
il @code{BEGIN} @`e marcato come errore di sintassi.
+Chi @`e interessato pu@`o vedere
+@uref{https://lists.gnu.org/archive/html/bug-gawk/2022-10/msg00025.html}
+per una modifica al codice sorgente che consente la continuazione di
+righe se sono racchiuse fra parentesi. Questa @dfn{patch} non @`e stata
+inclusa nella distribuzione di @command{gawk} perch@'e implicitamente
+diminuisce la portabilit@`a dei programmi @command{awk}.
+
@cindex istruzioni @subentry multiple
@cindex @code{;} (punto e virgola) @subentry separare istruzioni nelle azioni
@cindex punto e virgola (@code{;}) @subentry separare istruzioni nelle azioni
@@ -4449,7 +4484,7 @@ Le variabili da riga di comando della forma
@end itemize
Quest'opzione @`e particolarmente necessaria per le applicazioni World Wide Web
-CGI che passano argomenti attraverso le URL; l'uso di quest'opzione impedisce
+CGI che passano argomenti attraverso gli URL; l'uso di quest'opzione impedisce
a un utente malintenzionato (o ad altri) di passare opzioni, assegnamenti o
codice sorgente @command{awk} (con @option{-e}) all'applicazione
CGI.@footnote{Per maggiori dettagli,
@@ -4538,6 +4573,23 @@ Questa tracciatura @`e stampata sullo standard error.
Ogni ``codice operativo'' @`e preceduto da un segno @code{+}
nell'output.
+@item @option{-k}
+@itemx @option{--csv}
+@cindex @option{-k} (opzione)
+@cindex opzione @subentry @option{-k}
+@cindex @option{--csv} (opzione)
+@cindex opzione @subentry @option{--csv}
+@cindex campi separati da virgola (CSV) come dati @subentry opzione @option{-k}
+@cindex campi separati da virgola (CSV) come dati @subentry opzione @option{--csv}
+@cindex CSV (dati con valori separati da virgola) @subentry opzione @option{-k}
+@cindex CSV (dati con valori separati da virgola) @subentry opzione @option{--csv}
+@cindex dati CSV (campi separati da virgola) @subentry @option{-k}
+@cindex dati CSV (campi separati da virgola) @subentry @option{--csv}
+Richiede un trattamento speciale per file CSV [valori separati da virgola].
+@xref{Campi separati da virgola}.
+Quest'opzione non pu@`o essere usata insieme all'opzione @option{--posix}.
+Se lo si fa, viene generato un errore fatale.
+
@item @option{-l} @var{ext}
@itemx @option{--load} @var{ext}
@cindex @option{-l} (opzione)
@@ -5593,11 +5645,16 @@ directory possono essere necessarie per organizzare i file da includere.
Vista la possibilit@`a di specificare opzioni @option{-f} multiple, il
meccanismo @code{@@include} non @`e strettamente necessario.
Comunque, la direttiva @code{@@include} pu@`o essere d'aiuto nel costruire
-programmi @command{gawk} autosufficienti, riducendo cos@`{@dotless{i}} la necessit@`a
-di scrivere righe di comando complesse e tediose.
+programmi @command{gawk} autosufficienti, riducendo cos@`{@dotless{i}} la
+necessit@`a di scrivere righe di comando complesse e tediose.
In particolare, @code{@@include} @`e molto utile per scrivere @dfn{script} CGI
eseguibili da pagine web.
+La direttiva @code{@@include} e l'opzione @option{-i}/@option{--include}
+sulla riga di comando sono completamente equivalenti. Un programma sorgente
+incluso non viene caricato di nuovo se @`e stato gi@`a caricato
+in precedenza.
+
Le regole usate per trovare un file sorgente, descritte
@iftex
nella
@@ -5682,7 +5739,7 @@ Questa
@ifinfo
Questo
@end ifinfo
-@value{SECTION} descrive funzionalit@`a o opzioni da riga di comando
+@value{SECTION} descrive una funzionalit@`a o opzione da riga di comando
provenienti da precedenti versioni di @command{gawk} che non sono pi@`u
disponibili nella versione corrente, o che sono ancora utilizzabili ma sono
deprecate (ci@`o significa che @emph{non} saranno presenti in una futura
@@ -6116,7 +6173,7 @@ $ @kbd{awk 'BEGIN @{ print "Egli le disse \"ciao!\"." @}'}
Lo stesso carattere di barra inversa @`e un altro carattere che non pu@`o essere
incluso normalmente; occorre scrivere @samp{\\} per inserire una barra
inversa nella stringa o @dfn{regexp}. Quindi, la stringa costituita dai due
-caratteri @samp{"} e @samp{\} deve essere scritta come @code{"\"\\"}.
+caratteri @samp{"} e @samp{\} dev'essere scritta come @code{"\"\\"}.
Altre sequenze di protezione rappresentano caratteri non stampabili
come TAB o il ritorno a capo. Anche se @`e possibile immettere la maggior parte dei
@@ -6189,7 +6246,7 @@ Il valore esadecimale @var{hh}, dove @var{hh} indica una sequenza di cifre
esadecimali (@samp{0}--@samp{9}, e @samp{A}--@samp{F}
o @samp{a}--@samp{f}). Dopo @samp{\x} @`e consentito un massimo di due cifre.
Ogni ulteriore cifra esadecimale @`e considerata come una semplice
-lettera o numero. @value{COMMONEXT}
+lettera o numero. @value{COMMONEXT}
(La sequenza di protezione @samp{\x} non @`e permessa in POSIX awk.)
@quotation ATTENZIONE
@@ -6203,6 +6260,27 @@ Dalla @value{PVERSION} 4.2,
vengono elaborate solo due cifre.
@end quotation
+@cindex @code{\} (barra inversa) @subentry @code{\u} (sequenza di protezione)
+@cindex backslash (@code{\}) @subentry @code{\u} (sequenza di protezione)
+@cindex barra inversa (@code{\}) @subentry @code{\/} (sequenza di protezione)
+@cindex estensioni comuni @subentry @code{\u} (sequenza di protezione)
+@cindex comuni @subentry estensioni @subentry @code{\u} (sequenza di protezione)
+@item \u@var{hh}@dots{}
+Il valore esadecimale @var{hh}, dove @var{hh} indica una sequenza di cifre
+esadecimli (@samp{0}--@samp{9}, e @samp{A}--@samp{F} o
+@samp{a}--@samp{f}). Un massimo di otto cifre @`e consentito dopo
+la @samp{\u}. Ogni successiva cifra esadecimale eventualmente immessa
+@`e trattata come una semplice lettera o numero. @value{COMMONEXT}
+(La sequenza di protezione @samp{\u} non @`e ammessa in modalit@`a POSIX.)
+
+Questa sequenza di protezione serve per indicare una lettera o un
+simbolo come specificato nella codifica Unicode.
+@command{gawk} dapprima converte le cifre cos@`{@dotless{i}} specificate in
+un numero intero, e poi traduce il ``carattere largo''
+cos@`{@dotless{i}} specificato nella codifica multibyte locale (anche se la
+codifica locale non @`e Unicode). Se i byte specificati non
+rappresentano un carattere valido, il valore diviene @code{"?"}.
+
@cindex @code{\} (barra inversa) @subentry @code{\/} (sequenza di protezione)
@cindex barra inversa (@code{\}) @subentry @code{\/} (sequenza di protezione)
@item \/
@@ -6361,7 +6439,6 @@ Le sequenze di protezione descritte
@ifnotinfo
prima
@end ifnotinfo
-
@iftex
nella
@end iftex
@@ -6530,7 +6607,7 @@ da ricercare @`e @samp{phhhhhhhhhhhhhhooey}, @samp{ph*} individua tutte le
@cindex pi@`u (@code{+}) @subentry operatore @dfn{regexp}
@item @code{+}
Questo simbolo @`e simile a @samp{*}, tranne per il fatto che l'espressione
-precedente deve essere trovata almeno una volta. Questo significa che
+precedente dev'essere trovata almeno una volta. Questo significa che
@samp{wh+y} individuerebbe @samp{why} e @samp{whhy}, ma non @samp{wy}, mentre
@samp{wh*y} li troverebbe tutti e tre.
@@ -7152,6 +7229,8 @@ Individua la stringa nulla che ricorre all'interno di una parola.
Per esempio,
@code{/\Bora\B/} individua @samp{Colorado}, ma non individua @samp{che ora @`e}.
@samp{\B} @`e essenzialmente l'opposto di @samp{\y}.
+Un altro modo di intenderlo @`e che @samp{\B} corrisponde alla stringa vuota,
+nel caso questa non si trovi al bordo di una parola.
@end table
@cindex buffer @subentry operatori per
@@ -7482,6 +7561,20 @@ il carattere che fa da separatore fra i record.
Altrimenti (in @command{gawk}), @code{RS} @`e valutata come espressione
regolare. Questo meccanismo @`e spiegato pi@`u in dettaglio qui sotto.
+@quotation NOTA
+Quando @command{gawk} @`e chiamato con l'opzione @option{--csv}, nulla
+di quanto descritto in
+@ifnotinfo
+questa
+@end ifnotinfo
+@ifinfo
+questo
+@end ifinfo
+@value{SECTION} @`e applicabile.
+@xref{Campi separati da virgola},
+per i dettagli.
+@end quotation
+
@menu
* awk divisione record:: Come @command{awk} standard divide i record.
* gawk divisione record:: Come @command{gawk} divide i record.
@@ -8160,6 +8253,7 @@ in precedenza.
* Separare campi con @dfn{regexp}:: Usare @dfn{regexp} come separatori.
* Campi di un solo carattere:: Fare di ogni carattere un campo
separato.
+* Campi separati da virgola:: Lavorare con file CSV.
* Separatori campo da riga di comando:: Assegnare @code{FS} dalla riga di
comando.
* Campo intera riga:: Far s@`{@dotless{i}} che la riga intera sia un
@@ -8208,10 +8302,10 @@ ricerca speciale
@code{BEGIN}
(@pxref{BEGIN/END}).
Per esempio, qui impostiamo il valore di @code{FS} alla stringa
-@code{","}:
+@code{":"}:
@example
-awk 'BEGIN @{ FS = "," @} ; @{ print $2 @}'
+awk 'BEGIN @{ FS = ":" @} ; @{ print $2 @}'
@end example
@cindex @code{BEGIN} (regola)
@@ -8219,7 +8313,7 @@ awk 'BEGIN @{ FS = "," @} ; @{ print $2 @}'
Data la riga in input:
@example
-John Q. Smith, 29 Oak St., Walamazoo, MI 42139
+John Q. Smith: 29 Oak St.: Walamazoo: MI 42139
@end example
@noindent
@@ -8235,7 +8329,7 @@ nome della persona dell'esempio che abbiamo appena usato potrebbe avere un
titolo o un suffisso annesso, come:
@example
-John Q. Smith, LXIX, 29 Oak St., Walamazoo, MI 42139
+John Q. Smith: LXIX: 29 Oak St.: Walamazoo: MI 42139
@end example
@noindent
@@ -8253,8 +8347,6 @@ si possano manipolare con un programma @command{awk} separato.)
@cindex separatore di campo @subentry spazi vuoti come
@cindex spazi vuoti @subentry come separatore di campo
-@cindex separatore di campo @subentry @code{FS} (variabile) come
-@cindex @code{FS} (variabile) @subentry come separatore di campo
I campi sono separati normalmente da spazi vuoti
(spazi, tabulazioni e ritorni a capo), non solo da spazi singoli. Due spazi
in una riga non delimitano un campo vuoto. Il valore di default del separatore
@@ -8437,6 +8529,111 @@ In modalit@`a di compatibilit@`a
se @code{FS} @`e la stringa nulla, anche @command{gawk}
si comporta in questo modo.
+@node Campi separati da virgola
+@subsection Lavorare con file CSV
+
+@cindex CSV (dati con valori separati da virgola) @subentry record e campi
+@cindex dati CSV (dati con valori separati da virgola) @subentry record e campi
+@cindex campi separati da virgola (CSV) come dati @subentry record e campi
+Molti programmi di uso frequente si servono della virgola come separatore
+di campo, invece di usare lo spazio. [Normalmente i file in input
+a @command{gawk} hanno in questo caso come suffisso "csv",
+Comma Separated Value, ovvero Campi separati da virgola.]
+Questo @`e il caso in particolare per popolari fogli di calcolo.
+Non c'@`e uno standard accettato da tutti che regoli il formato di tali
+file, sebbene il documento
+@uref{http://www.ietf.org/rfc/rfc4180, RFC 4180}
+elenchi le pratiche normalmente seguite.
+
+Per decenni, chi voleva lavorare con file CSV in @command{awk}
+ha dovuto ``trovare da solo'' una soluzione. (Per esempio,
+@pxref{Separazione in base al contenuto}).
+Nel 2023, Brian Kernighan ha deciso di aggiungere un supporto
+per i file CSV alla sua versione di @command{awk}.
+Per restare allo stesso livello, anche @command{gawk} rende
+disponibile lo stesso supporto presente nella versione di Brian.
+Per usare dei file contenenti campi in formato CSV, basta
+chiamare @command{gawk} specificando come opzione
+@option{-k} oppure @option{--csv}.
+
+I campi nei file CSV sono separati da virgola. Per consentire la
+presenza di una virgola all'interno di un campo (p.es. come parte
+di un dato), il campo pu@`o essere racchiuso fra doppi apici.
+Per consentire un doppio apice all'interno di un campo racchiuso fra
+doppi apici, il campo stesso @empf{deve} essere racchiuso fra doppi apici
+e due doppi apici vanno specificati per ogni singolo doppio apice
+all'interno del campo.
+Il doppio apice che segnala l'inizio del campo dev'essere
+il primo carattere dopo la virgola [che segna l'inizio del campo].
+La tabella
+@ref{table-csv-examples} mostra alcuni esempi.
+
+@float Table,table-csv-examples
+@caption{Esempi di dati in file CSV}
+@multitable @columnfractions .3 .3
+@headitem Input @tab Contenuto del campo
+@item @code{abc def} @tab @code{abc def}
+@item @code{"dati tra doppi apici"} @tab @code{dati tra doppi apici}
+@item @code{"dati tra, doppi apici"} @tab @code{dati tra, doppi apici}
+@item @code{"Lei disse ""Basta!""."} @tab @code{Lei disse "Basta!".}
+@item @code{Lei disse "Basta!".} @tab @code{Lei disse "Basta!".}
+@end multitable
+@end float
+
+Inoltre, ed @`e qui che la situazione si ingarbuglia, all'interno
+di un campo fra doppi apici @`e consentito anche inserire
+il carattere a-capo!
+Per gestire una tale situazione, quando sta trattando un file CSV
+@command{gawk} analizza il file in input alla ricerca di
+caratteri a-capo che non siano racchiusi fra doppi apici.
+Quindi, se si utilizza l'opzione @option{--csv}, il modo
+di gestire i record utilizzando la variabile @code{RS}
+(@pxref{Record}) non viene utilizzato per nulla.
+
+@cindex Kernighan, Brian @subentry citazioni di
+@sidebar Carriage-Return--Line-Feed Line Endings In CSV Files
+@sidebar Fine riga dei file CSV con ritorno-carrello--a-capo
+@quotation
+@code{\r\n} @i{@`e un'invenzione del diavolo.}
+@author Brian Kernighan
+@end quotation
+
+Molti file CSV provengono da sistemi in cui il carattere di
+fine riga per file di testo @`e costituito dalla coppia di
+caratteri ritorno-carrello--a-capo
+(CR-LF, @samp{\r} seguito da @samp{\n}).
+Per semplificare la vita @command{gawk}, quando tratta
+dei file CSV, include il carattere a-capo a fine record solo
+quando precede immediatamente un carattere ritorno-carrello
+nell'input.
+@end sidebar
+
+Il comportamento della funzione @code{split()} (ancora non
+formalmente trattato, vedere @ref{Funzioni per stringhe})
+@`e leggermento differente quando si abbia a che fare con file CSV.
+Se @`e chiamato con due argomenti
+(@samp{split(@var{stringa}, @var{vettore})}), @code{split()}
+separa i campi con la logica CSV.
+In tutti gli altri casi, il comportamento @`e quello normale.
+
+Se si @`e specificato l'opzione @option{--csv}, l'elemento
+@code{PROCINFO["CSV"]} esister@`a, altrimenti non sar@`a disponibile.
+@xref{Variabili auto-assegnate}.
+
+Infine, se si @`e specificato @option{--csv}, l'assegnazione di
+un valore a una delle variabili
+@code{FS}, @code{FIELDWIDTHS}, @code{FPAT}, o @code{RS}
+genera un messaggio di avvertimento.
+
+Per amor di chiarezza, @command{gawk} considera come
+autoritativo per il file in input di tipo CSV
+il documento
+@uref{http://www.ietf.org/rfc/rfc4180, RFC 4180}.
+Non ci sono meccanismi che consentono di accettare file CSV
+in input che non rispettino tali specifiche, p.es. dei
+file che usino come carattere che separa i campi un
+punto-e-virgola al posto della virgola.
+
@node Separatori campo da riga di comando
@subsection Impostare @code{FS} dalla riga di comando
@cindex @option{-F} (opzione) sulla riga di comando
@@ -8628,9 +8825,17 @@ Il seguente elenco riassume come i campi vengono divisi, in base al valore
di @code{FS} (@samp{==} significa ``@`e uguale a''):
@table @code
+@item @asis{@command{gawk} @`e stato chiamato specificando l'opzione @option{--csv}}
+La divisione in campi segue le regole esposte in @ref{Campi separati da virgola}.
+Il valore di @code{FS} @`e ignorato.
+
@item FS == " "
-I campi sono separati da serie di spazi vuoti. Gli spazi vuoti iniziale e
-finale sono ignorati. Questo @`e il comportamento di default.
+I campi sono separati da uno o pi@`u spazi vuoti. Gli spazi vuoti iniziali
+e finali sono ignorati. Questo @`e il comportamento di default.
+
+@item FS == ","
+I campi sono separati da virgola, con regole speciali per inserire in un
+campo virgole e/o doppi apici.
@item FS == @var{qualsiasi altro carattere singolo}
I campi sono separati da ogni ricorrenza del carattere. Ricorrenze
@@ -8933,8 +9138,12 @@ per un esempio di tale funzione).
@node Separazione in base al contenuto
@section Definire i campi in base al contenuto
+@strong{FIXME}: Quest'intera sezione dev'essere riscritta
+dopo che in @command{gawk} @`e stata introdotta la capacit@`a di analizzare
+file di tipo CSV. Ahim@`e.
+
@menu
-* File CSV:: Ancora sui file CSV.
+* Ancora CSV:: Ancora sui file CSV.
* FS rispetto a FPAT:: Una differenza sottile.
@end menu
@@ -8958,12 +9167,12 @@ parole, @code{FS} definisce cosa un campo @emph{non @`e}, invece di cosa
Tuttavia, ci sono casi in cui effettivamente si ha bisogno di definire i campi
in base a cosa essi sono, e non in base a cosa non sono.
-@cindex dati CSV (valori separati da virgole) @subentry analizzare con @code{FPAT}
-@cindex CSV (valori separati da virgole) come dati @subentry analizzare con @code{FPAT}
-@cindex Comma Separated Values (CSV) come dati @subentry analizzare con @code{FPAT}
-@cindex valori separati da virgole (CSV) come dati @subentry analizzare con @code{FPAT}
-Il caso pi@`u emblematico @`e quello dei dati cosiddetti @dfn{comma-separated
-value} (CSV). Molti fogli elettronici, per esempio, possono esportare i dati
+@cindex CSV (campi separati da virgola) come dati @subentry analizzare con @code{FPAT}
+@cindex dati CSV (campi separati da virgola) @subentry analizzare con @code{FPAT}
+@cindex campi separati da virgola (CSV) come dati @subentry analizzare con @code{FPAT}
+Il caso pi@`u emblematico
+@`e quello dei dati di tipo CSV (campi separati da virgola).
+Molti fogli elettronici, per esempio, possono esportare i dati
in file di testo, dove ogni record termina con un ritorno a capo e i campi
sono separati tra loro da virgole. Se le virgole facessero solo da separatore
fra i dati non ci sarebbero problemi. Il problema sorge se uno dei campi
@@ -9093,7 +9302,16 @@ effettuata utilizzando @code{FS} o @code{FIELDWIDTHS}.
Infine, la funzione @code{patsplit()} rende la stessa funzionalit@`a disponibile
per suddividere normali stringhe (@pxref{Funzioni per stringhe}).
-@node File CSV
+@quotation NOTA
+Poich@'e @command{gawk} consente ora un trattamento diretto dei
+file di tipo CSV (@pxref{Campi separati da virgola}), gli esempi
+presentati qui sono obsoleti.
+Nonostante ci@`o, rimangono utili come esempio di ci@`o che
+un'analisi dei campi utilizzando la variabile @code{FPAT}
+permette di fare.
+@end quotation
+
+@node Ancora CSV
@subsection Ancora sui file CSV
@cindex Collado, Manuel
@@ -9162,9 +9380,9 @@ $ @kbd{gawk -v fpat=2 -f test-csv.awk sample.csv}
@cindex Collado, Manuel
@cindex @code{CSVMODE}, libreria per @command{gawk}
@cindex libreria @subentry @code{CSVMODE} per @command{gawk}
-@cindex dati CSV (valori separati da virgole) @subentry analizzare con libreria @code{CSVMODE}
-@cindex CSV (valori separati da virgole) come dati @subentry analizzare con libreria @code{CSVMODE}
-@cindex valori separati da virgole (CSV) come dati @subentry analizzare con libreria @code{CSVMODE}
+@cindex dati CSV (campi separati da virgola) @subentry analizzare con libreria @code{CSVMODE}
+@cindex CSV (campi separati da virgola) come dati @subentry analizzare con libreria @code{CSVMODE}
+@cindex campi separati da virgola (CSV) come dati @subentry analizzare con libreria @code{CSVMODE}
In generale, usare @code{FPAT} per effettuare l'analisi di dati in formato CSV
@`e come utilizzare un lenzuolo troppo corto. Rimane sempre un angolo che non
@`e coperto. Si raccomanda, in alternativa, di usare la libreria @code{CSVMODE}
@@ -9222,7 +9440,9 @@ Il valore @`e @code{"FS"} se si usa la maniera normale di divisione dei campi,
oppure @code{"FPAT"} se si una la divisione in campi in base al contenuto:
@example
-if (PROCINFO["FS"] == "FS")
+if ("CSV" in PROCINFO)
+ @var{divisione in campi secondo le regole CSV} @dots{}
+else if (PROCINFO["FS"] == "FS")
@var{divisione normale in campi} @dots{}
else if (PROCINFO["FS"] == "FIELDWIDTHS")
@var{divisione in campi a lunghezza fissa} @dots{}
@@ -9234,8 +9454,9 @@ else
@end example
Quest'informazione @`e utile se si sta scrivendo una funzione che
-deve cambiare provvisoriamente @code{FS} o @code{FIELDWIDTHS}, leggere alcuni
-record e poi ripristinare le inpostazioni originali. Si veda
+deve cambiare provvisoriamente @code{FS}, @code{FIELDWIDTHS}, o
+@code{FPAT}, leggere alcuni
+record e poi tornale alle impostazioni originali. Si veda
(@pxref{Funzioni Passwd} per un esempio di una funzione di questo tipo.
@node Righe multiple
@@ -10084,7 +10305,7 @@ Questo
@value{SECTION} descrive una funzionalit@`a disponibile solo in
@command{gawk}.
-Si pu@`o specificare un tempo limite in millisecondi per leggere l'input dalla
+Si pu@`o specificare un tempo limite in millisecondi per leggere l'input dalla
tastiera, da una @dfn{pipe} o da una comunicazione bidirezionale, compresi i
@dfn{socket} TCP/IP. Questo pu@`o essere fatto per input, per comando o per
connessione, impostando un elemento speciale nel vettore @code{PROCINFO}
@@ -10405,6 +10626,7 @@ e parla della funzione predefinita @code{close()}.
file gi@`a aperti a inizio esecuzione
* Chiusura file e @dfn{pipe}:: Chiudere file in input e di output e
@dfn{pipe}.
+* Noflush:: Velocizzare output da @dfn{pipe}.
* Continuazione dopo errori:: Abilitare continuazione dopo errori
in output.
* Sommario di Output:: Sommario di Output.
@@ -11376,7 +11598,7 @@ invece di inviarlo a un file. Questa ridirezione apre una @dfn{pipe} verso
L'argomento @var{comando}, verso cui @`e rivolta la ridirezione, @`e in realt@`a
un'espressione
@command{awk}. Il suo valore @`e convertito in una stringa il cui contenuto
-costituisce un comando della shell che deve essere eseguito. Per esempio,
+costituisce un comando della shell che dev'essere eseguito. Per esempio,
il seguente programma produce due file, una lista non ordinata di nomi di
persone e una lista ordinata in ordine alfabetico inverso:
@@ -11674,8 +11896,8 @@ per accedere a ogni altro file aperto ereditato:
@table @file
@item /dev/fd/@var{N}
-Il file associato al descrittore di file @var{N}. Il file indicato deve
-essere aperto dal programma che inizia l'esecuzione di @command{awk}
+Il file associato al descrittore di file @var{N}. Il file indicato
+dev'essere aperto dal programma che inizia l'esecuzione di @command{awk}
(tipicamente la shell). Se non sono state poste in essere iniziative
speciali nella shell da cui @command{gawk} @`e stato invocato, solo i
descrittori 0, 1, e 2 sono disponibili.
@@ -11761,6 +11983,11 @@ Se lo si fa, il comportamente risultante @`e imprevedibile.
@cindex coprocessi @subentry chiusura
@cindex @code{getline} (comando) @subentry coprocessi, usare da
+@menu
+* Valore restituito da @code{close}:: Usare il valore di ritorno restituito da
+ @code{close()}.
+@end menu
+
Se lo stesso @value{FN} o lo stesso comando di shell @`e usato con @code{getline}
pi@`u di una volta durante l'esecuzione di un programma @command{awk}
(@pxref{Getline}),
@@ -11813,9 +12040,10 @@ close("sort -r nomi")
Una volta eseguita questa chiamata di funzione, la successiva @code{getline}
da quel file o comando, o la successiva @code{print} o @code{printf} verso quel
file o comando, riaprono il file o eseguono nuovamente il comando.
-Poich@'e l'espressione da usare per chiudere un file o una @dfn{pipeline} deve
-essere uguale all'espressione usata per aprire il file o eseguire il comando,
-@`e buona norma usare una variabile che contenga il @value{FN} o il comando.
+Poich@'e l'espressione da usare per chiudere un file o una @dfn{pipeline}
+dev'essere uguale all'espressione usata per aprire il file o eseguire il
+comando, @`e buona norma usare una variabile che contenga il valore
+@value{FN} o il comando.
Il precedente esempio cambia come segue:
@example
@@ -11940,7 +12168,9 @@ rinviata alla
@ref{I/O bidirezionale},
che ne parla pi@`u dettagliatamente e fornisce un esempio.
-@sidebar Usare il codice di ritorno di @code{close()}
+@node Valore restituito da @code{close}
+@subsection Usare il valore di ritorno restituito da @code{close()}
+@node Usare il valore di ritorno di @code{close()}
@cindex angolo buio @subentry funzione @subentry @code{close()}
@cindex funzione @subentry @code{close()} @subentry codice di ritorno
@cindex @code{close()} (funzione) @subentry codice di ritorno
@@ -11972,7 +12202,7 @@ In tal caso, @command{gawk} imposta la variabile predefinita
In @command{gawk}, a partire dalla @value{PVERSION} 4.2,
quando si chiude una @dfn{pipe} o un coprocesso (in input o in output),
-il codice di ritorno @`e quello restituito dal comando,
+il valore di ritorno @`e quello restituito dal comando,
come descritto
@iftex
nella
@@ -11988,6 +12218,8 @@ Altrimenti, @`e il codice di ritorno dalla chiamata alle funzione
di sistema @code{close()} o alla funzione C @code{fclose()}
se si sta chiudendo un file in input o in output, rispettivamente.
Questo valore @`e zero se la chiusura riesce, o @minus{}1 se non riesce.
+Anche le versioni pi@`u recenti di BWK @command{awk} restituiscono gli stessi
+valori per la funzione @command{close()}.
@float Tabella,table-close-pipe-return-values
@caption{Codici di ritorno dalla @code{close()} di una @dfn{pipe}}
@@ -12011,10 +12243,64 @@ portabile.
@value{DARKCORNER}
In modalit@`a POSIX (@pxref{Opzioni}), @command{gawk} restituisce solo zero
quando chiude una @dfn{pipe}.
-@end sidebar
+
+@node Noflush
+@section Velocizzare output da @dfn{pipe}
+@c FIXME: Add indexing
+
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION} descrive una funzionalit@`a propria di @command{gawk}.
+
+Normalmente, quando si spediscono data tramite una @dfn{pipe} a
+un comando, usando le istruzioni @code{print} o @code{printf},
+@command{gawk} scarica l'output verso la @dfn{pipe}.
+Ovvero, l'output non @`e bufferizzato, ma scritto direttamente.
+Ci@`o garantisce che l'output della @dfn{pipe}, insieme a quello
+generato da @command{gawk} viene scritto enll'ordine che ci si
+aspetta:
+
+@example
+print "qualcosa" # va allo standard output
+print "qualcos'altro" | "un-comando" # anche allo standard output
+print "ulteriori cose" # come pure questo
+@end example
+
+Fare ci@`o ha un prezzo; scaricare dati nella @dfn{pipe} usa
+pi@`u tempo CPU, e in alcuni ambienti tale consumo pu@`o
+essere eccessivo.
+
+Si pu@`o chiedere a @command{gawk} di non scaricare direttamente dati
+ma di bufferizzarli, in uno dei seguenti due modi:
+
+@itemize @bullet
+@item
+Impostare @code{PROCINFO["BUFFERPIPE"]} a un valore qualsiasi.
+Dopo aver fatto questo, @command{gawk} bufferizzer@`a i dati per tutte
+le @dfn{pipe}.
+
+@item
+Impostare @code{PROCINFO["@var{un-comando}", "BUFFERPIPE"]} a un
+valore qualsiasi. In tal caso, solo i dati relativi al comando
+@var{un-comando} saranno bufferizzati.
+@end itemize
+
+Uno degli elementi visti sopra @emph{deve} essere impostato nel
+vettore @code{PROCINFO} @emph{prima} di eseguire la prima istruzione
+@code{print} o @code{printf} diretta alla @dfn{pipe}.
+Se lo si fa dopo che dell'output @`e gi@`a stato inviato alla @dfn{pipe},
+@`e troppo tardi.
+
+Utilizzare questa funzionalit@`a pu@`o modificare il comportamento
+dell'output [cambiando l'ordine di quel che viene stampato],
+quindi occorre stare attenti a quello che si fa.
@node Continuazione dopo errori
@section Abilitare continuazione dopo errori in output
+@c FIXME: Add indexing
@ifnotinfo
Questa
@@ -12366,7 +12652,10 @@ In modalit@`a POSIX (@pxref{Opzioni}), @command{gawk} non consente
caratteri protetti di avanzamento riga. Altrimenti, il
comportamento @`e quello descritto sopra.
-BKW @command{awk} e BusyBox @command{awk}
+BKW @command{awk}@footnote{In tutti gli esempi contenuti in
+questo @value{DOCUMENT}, il comando @command{nawk}
+richiama BWK @command{awk}.}
+e BusyBox @command{awk}
tolgono la barra inversa, ma lasciano indisturbato il carattere
di avanzamento riga, che fa quindi parte della stringa:
@@ -15677,12 +15966,17 @@ specificati sulla riga di comando di @command{gawk}.
Come con le regole @code{BEGIN} ed @code{END}
@ifnottex
@ifnotdocbook
+@ifnotlatex
(@pxref{BEGIN/END}),
+@end ifnotlatex
@end ifnotdocbook
@end ifnottex
@iftex
(si veda la @value{SECTION} precedente),
@end iftex
+@iflatex
+(si veda la @value{SECTION} precedente),
+@end iflatex
@ifdocbook
(si veda la @value{SECTION} precedente),
@end ifdocbook
@@ -17438,13 +17732,13 @@ uno dei seguenti:
Microsoft Windows, utilizzando MinGW.
@item "os390"
-OS/390.
+OS/390 (noto anche come z/OS).
@item "posix"
-GNU/Linux, Cygwin, Mac OS X, e sistemi Unix tradizionali.
+GNU/Linux, Cygwin, macOS, e sistemi Unix tradizionali.
@item "vms"
-OpenVMS o Vax/VMS.
+OpenVMS.
@end table
@item PROCINFO["pgrpid"]
@@ -17455,6 +17749,17 @@ Il @dfn{ID di gruppo del processo} del programma corrente.
@cindex @dfn{process ID} del programma @command{gawk}
Il @dfn{process ID} del programma corrente.
+@item PROCINFO["pma"]
+@cindex memoria persistente @subentry disponibile in @command{gawk}
+@cindex PMA (allocatore di memoria persistente) @subentry disponibile in @command{gawk}
+@cindex allocatore di memoria persistente (PMA) @subentry disponibile in @command{gawk}
+@cindex memoria persistente (PMA) @subentry disponibile in @command{gawk}
+La versione dell'allocatore di memoria persistente (PMA)
+disponibile in @command{gawk}.
+Questo elemento non sar@`a presente se l'allocatore di memoria
+persistente non @`e disponibile.
+@xref{Memoria persistente}.
+
@item PROCINFO["ppid"]
@cindex @dfn{parent process ID} del programma @command{gawk}
Il @dfn{ID di processo del padre} del programma corrente.
@@ -17534,6 +17839,14 @@ I seguenti elementi consentono di modificare il comportamento di
@command{gawk}:
@table @code
+@item PROCINFO["BUFFERPIPE"]
+Se questo elemento esiste, tutto l'output alla @dfn{pipe} viene
+bufferizzato.
+
+@item PROCINFO["@var{un-comando}", "BUFFERPIPE"]
+Rende bufferizzato l'output del comnado @var{un-comando}.
+@xref{Noflush}.
+
@item PROCINFO["NONFATAL"]
Se questo elemento esiste, gli errori di I/O per tutte le ridirezioni
consentono la prosecuzione del programma.
@@ -18070,10 +18383,10 @@ concettualmente, se i valori degli elementi sono 8, @code{"pippo"},
@float Figura,vettore-elementi
@caption{Un vettore contiguo}
@ifset SMALLPRINT
-@center @image{vettore-elementi, 11cm, , Un vettore contiguo}
+@center @image{gawk-vettore-elementi, 11cm, , Un vettore contiguo}
@end ifset
@ifclear SMALLPRINT
-@center @image{vettore-elementi, , , Un vettore contiguo}
+@center @image{gawk-vettore-elementi, , , Un vettore contiguo}
@end ifclear
@end float
@end ifnotdocbook
@@ -18082,7 +18395,7 @@ concettualmente, se i valori degli elementi sono 8, @code{"pippo"},
<figure id="vettore-elementi" float="0">
<title>Un vettore contiguo</title>
<mediaobject>
-<imageobject role="web"><imagedata fileref="vettore-elementi.png" format="PNG"/></imageobject>
+<imageobject role="web"><imagedata fileref="gawk-vettore-elementi.png" format="PNG"/></imageobject>
</mediaobject>
</figure>
@end docbook
@@ -18823,9 +19136,10 @@ successivamente:
@example
@dots{}
-if ("sorted_in" in PROCINFO) @{
+if ("sorted_in" in PROCINFO)
ordine_salvato = PROCINFO["sorted_in"]
- PROCINFO["sorted_in"] = "@@val_str_desc" # o qualcos'altro
+
+PROCINFO["sorted_in"] = "@@val_str_desc" # o qualcos'altro
@}
@dots{}
if (ordine_salvato)
@@ -20394,7 +20708,7 @@ Se @var{separacampo} @`e omesso, si usa il valore di @code{FS}.
@code{@var{vettore}[@var{i}+1]}.
Se @var{separacampo} @`e uno spazio bianco, ogni eventuale spazio bianco
a inizio stringa viene messo in @code{@var{separatori}[0]} e ogni
-eventuale spazio bianco a fine stringa viene messo in
+eventuale spazio bianco a fine stringa viene messo in
@code{@var{separatori}[@var{n}]}, dove @var{n} @`e il valore restituito da
@code{split()} (cio@`e il numero di elementi in @var{vettore}).
@@ -20419,13 +20733,22 @@ a[3] = "sac"
e imposta il contenuto del vettore @code{separatori} come segue:
@example
-seps[1] = "-"
-seps[2] = "-"
+separatori[1] = "-"
+separatori[2] = "-"
@end example
@noindent
Il valore restituito da questa chiamata a @code{split()} @`e tre.
+Se @command{gawk} @`e chiamato con l'opzione @option{--csv}, una chiamata
+a @code{split()} con due soli argomenti, divide la stringa usando le
+regole di analisi dei file di dati CSV, come esposto in
+@ref{Campi separati da virgola}. Con tre o quattro argomenti,
+@code{split()} funzione come visto sopra. La chiamata con quattro
+argomenti non avrebbe senso per i file CSV, poich@'e ogni elemento
+del vettore @var{separatori} consisterebbe semplicemente in una
+stringa che contiene una virgola.
+
@cindex differenze tra @command{awk} e @command{gawk} @subentry funzione @code{split()}
Come nella divisione in campi dei record in input, quando il valore di
@var{separacampo} @`e @w{@code{" "}}, gli spazi bianchi a inizio e fine stringa
@@ -21800,7 +22123,7 @@ L'ora espressa in numero di secondi a partire dall'Epoca.
@ignore
@item %v
-La data in formato VMS (p.es., @samp{20-JUN-1991}).
+La data in formato OpenVMS (p.es., @samp{20-JUN-1991}).
@end ignore
@end table
@@ -23248,6 +23571,13 @@ valore pi@`u alto contenuto nel vettore.
@node Variabili di tipo dinamico
@subsection Funzioni e loro effetti sul tipo di una variabile
+@quotation
+@i{@`E una farcitura per il deserto! @*@footnote{Si tratta di un
+gioco di parole fra "desert" (deserto) e "dessert" (dolce).}
+@`E una cera per pavimenti!}
+@author Saturday Night Live (quando era ancora divertente)
+@end quotation
+
@command{awk} @`e un linguaggio molto fluido.
@`E possible che @command{awk} non sia in grado di stabilire se un
identificativo rappresenta una variabile scalare o un vettore,
@@ -23274,8 +23604,65 @@ un errore fatale, quindi @command{awk} non arriver@`a a segnalare il secondo
errore. Se si commenta la prima chiamata e si riesegue il
programma, a quel punto @command{awk} terminer@`a con un messaggio
relativo al secondo errore.
-Solitamente queste cose non causano grossi problemi, ma @`e bene
-esserne a conoscenza.
+
+Ecco un esempio pi@`u complesso:
+
+@example
+BEGIN @{
+ funky(a)
+ if (A == 0)
+ print "<" a ">"
+ else
+ print a[1]
+@}
+
+function funky(arr)
+@{
+ if (A == 0)
+ arr = 1
+ else
+ arr[1] = 1
+@}
+@end example
+
+In questo esempio, la funzione usa il parametro che le viene
+passato in modo differente a seconda del valore della variabile
+globale @code{A}.
+Se @code{A} vale zero, il parametro @code{arr} @`e trattato come una
+variabile scalare. Altrimenti @`e trattato come un vettore.
+
+Ci sono due modi in cui questo programma potrebbe comportarsi.
+@command{awk} potrebbe determinare che, nel programma principale
+@code{a} ha un indice (ossia @`e un elemento di un vettore), e quindi
+considerarlo un vettore (nella fase di analisi del programma, ossia
+prima ancora che il programma inizi la sua esecuzione.
+BWK @code{awk}, @code{mawk}, e forse altri fanno questo:
+
+@example
+$ @kbd{nawk -v A=0 -f funky.awk}
+@error{} nawk: can't assign to a; it's an array name.
+@error{} source line number 11
+$ @kbd{nawk -v A=1 -f funky.awk}
+@print{} 1
+@end example
+
+Oppure @command{awk} potrebbe attendere il momento in cui l'istruzione
+viene eseguita, per determinare il tipo della variabile @code{a}.
+In tal caso, poich@'e @code{a} non @`e ancora stato usato prima di essere
+passato alla funzione, l'uso che ne fa la funzione determina il tipo
+della variabile, che quindi pu@`o diventare scalare o vettoriale.
+@command{gawk} e MKS @command{awk} si comportano cos@`{@dotless{i}}:
+
+@example
+$ @kbd{gawk -v A=0 -f funky.awk}
+@print{} <>
+$ @kbd{gawk -v A=1 -f funky.awk }
+@print{} 1
+@end example
+
+POSIX non specifica quale dei due comportamenti sia quello corretto,
+quindi occorre essere consapevoli che differenti implementazioni di
+@command{awk} si comportano in modi diversi.
@node Chiamate indirette
@section Chiamate indirette di funzione
@@ -24116,6 +24503,8 @@ programmazione.
con apici alla shell.
* Funzione isnumeric:: Una funzione per controllare se un valore
@`e numerico.
+* Funzione tocsv:: Una funzione per convertire l'output
+ al formato CSV.
@end menu
@node Funzione strtonum
@@ -25011,6 +25400,102 @@ uguale a quella originale.
Tuttavia, per farlo, utilizza la funzione @code{typeof()}
(@pxref{Funzioni per i tipi}), che @`e disponibile solo in @command{gawk}.
+@node Funzione tocsv
+@subsection Produrre output in formato CSV
+
+@cindex campi separati da virgola (CSV) come dati @subentry generare output in formato CSV
+@cindex CSV (dati con valori separati da virgola) @subentry generare output in formato CSV
+@cindex dati CSV (campi separati da virgola) @subentry generati da @command{gawk}
+L'opzione @option{--csv} di @command{gawk} permette di gestire dati di input in formato
+CSV (@pxref{Campi separati da virgola}).
+
+Se si volesse invece, a partire da dati normali, generare in output
+dati in formato CSV?
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION} fornisce delle funzioni che consentono di farlo.
+
+La prima funzione, @code{tocsv()}, ha come input un vettore
+formato da campi di dati. Il vettore dovrebbe avere come indice
+i numeri, a partire dall'uno. Il secondo parametro, opzionale,
+specifica quale sia il separatore dei campi. Se non se ne
+specifica uno, quello di default @`e la virgola.
+
+La funzione @`e in grado di mettere correttamente in formato
+CSV campi che contengono al loro interno doppi apici, caratteri
+a-capo, o il carattere stesso usato come separatore.
+Il record finale in formato CSV viene preparato e restituito
+dalla funzione.
+
+@cindex @code{tocsv()} @subentry funzione definita dall'utente
+@cindex funzione definita dall'utente @subentry @code{tocsv()}
+@example
+@c file eg/lib/tocsv.awk
+# tocsv.awk --- convertire dati al formato CSV
+@c endfile
+@ignore
+@c file eg/lib/tocsv.awk
+#
+# Arnold Robbins, arnold@@skeeve.com, Public Domain
+# April 2023
+@c endfile
+@end ignore
+@c file eg/lib/tocsv.awk
+
+function tocsv(campi, sep, i, j, n_campi, risultato)
+@{
+ if (length(campi) == 0)
+ return ""
+
+ if (sep == "")
+ sep = ","
+ delete n_campi
+ for (i = 1; i in campi; i++) @{
+ n_campi[i] = campi[i]
+ if (n_campi[i] ~ /["\n]/ || index(n_campi[i], sep) != 0) @{
+ gsub(/"/, "\"\"", n_campi[i]) # raddoppia doppi apici
+ n_campi[i] = "\"" n_campi[i] "\"" # fra doppi apici
+ @}
+ @}
+
+ risultato = n_campi[1]
+ j = length(n_campi)
+ for (i = 2; i <= j; i++)
+ risultato = risultato sep n_campi[i]
+
+ return risultato
+@}
+@c endfile
+@end example
+
+La funzione che segue, @code{tocsv_rec()} serve per utilizzare
+@code{tocsv()}. Si pu@`o usare se si vuol convertire un record in
+input al formato CSV. La funzione stessa si limita a copiare i
+campi del record in un vettore, che viene poi passato alla funzione
+@code{tocsv()} che effettua la conversione.
+La funzione accetta come suo primo parametro un carattere di
+separazione opzionale, che viene semplicemente passato alla funzione
+@code{tocsv()}.
+
+@cindex @code{tocsv_rec()} @subentry funzione definita dall'utente
+@cindex funzione definita dall'utente @subentry @code{tocsv_rec()}
+@example
+@c file eg/lib/tocsv.awk
+function tocsv_rec(sep, i, campi)
+@{
+ delete campi
+ for (i = 1; i <= NF; i++)
+ campi[i] = $i
+
+ return tocsv(campi, sep)
+@}
+@c endfile
+@end example
+
@node Gestione File Dati
@section Gestione di @value{DF}
@@ -25044,7 +25529,7 @@ presenta funzioni utili per gestire @value{DF} da riga di comando.
@cindex file @subentry gestione di @subentry limiti dei file-dati
@cindex file @subentry inizializzazione e pulizia
Ognuna delle regole @code{BEGIN} ed @code{END} viene eseguita esattamente
-solo una volta, rispettivamente all'inizio e alla fine del programma
+una volta sola, rispettivamente all'inizio e alla fine del programma
@command{awk} (@pxref{BEGIN/END}).
Una volta noi (gli autori di @command{gawk}) siamo venuti in contatto
con un utente che
@@ -25851,7 +26336,7 @@ Si continua poi:
@example
@c file eg/lib/getopt.awk
- if (substr(opzioni_lunghe, i+1+length(unaopz), 1) == ":") @{
+ if (substr(opzioni_lunghe, i+1+RLENGTH, 1) == ":") @{
if (j > 0)
Optarg = substr(argv[Optind], j + 1)
else
@@ -28416,7 +28901,7 @@ Ci sono due aspetti importanti da considerare qui:
@itemize @bullet
@item
-Si deve essere in grado di generare facilmente tali suffissi e in
+Si dev'essere in grado di generare facilmente tali suffissi e in
particolare di gestire facilmente lo ``scorrimento''; per esempio,
passare da @samp{abz} ad @samp{aca}.
@@ -29362,8 +29847,11 @@ Si spera che siano interessanti e divertenti.
Un errore comune quando si scrive un testo lungo @`e quello di ripetere
accidentalmente delle parole. Tipicamente lo si pu@`o vedere in testi del tipo
``questo programma fa quanto segue segue@dots{}'' Quando il testo @`e pubblicato in rete, spesso
-le parole duplicate sono poste tra il termine di
-una riga e l'inizio di un'altra, il che rende difficile scoprirle.
+le parole duplicate sono poste tra il termine di una
+@iftex
+una
+@end iftex
+riga e l'inizio di un'altra, il che rende difficile scoprirle.
@c as here!
Questo programma, @file{dupword.awk}, legge un file una riga alla volta
@@ -29720,7 +30208,7 @@ per ogni record:
@c endfile
@end ignore
@c file eg/prog/translate.awk
-# Bug: non gestisce cose del tipo tr A-Z a-z; deve essere
+# Bug: non gestisce cose del tipo tr A-Z a-z; dev'essere
# descritto carattere per carattere.
# Tuttavia, se `a' @`e pi@`u corto di `da',
# l'ultimo carattere in `a' @`e usato per il resto di `da'.
@@ -33117,6 +33605,10 @@ formato con cui sono stati inseriti.
@node Memoria persistente
@section Preservare dati fra successive esecuzioni di @command{gawk}
+@cindex PMA (allocatore di memoria persistente)
+@cindex allocatore di memoria persistente (PMA)
+@cindex memoria persistente (PMA)
+
A partire dalle versione @value{PVERSION} 5.2, @command{gawk} supporta
la @dfn{memoria persistente} [@dfn{persistent memory}].
@@ -33144,8 +33636,8 @@ in @command{gawk} in questo modo:
@example
$ @kbd{gawk --version}
-@print{} GNU Awk 5.2.0, API 3.2, PMA Avon 7, (GNU MPFR 4.0.1, GNU MP 6.1.2)
-@print{} Copyright (C) 1989, 1991-2022 Free Software Foundation.
+@print{} GNU Awk 5.2.1, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.1.0, GNU MP 6.2.1)
+@print{} Copyright (C) 1989, 1991-2023 Free Software Foundation.
@dots{}
@end example
@@ -33153,11 +33645,19 @@ $ @kbd{gawk --version}
Se @`e presente la stringa @samp{PMA} con un indicatore di versione, allora
la memoria persistente @`e supportata.
+@cindex @env{REALLY_USE_PERSIST_MALLOC} (variabile d'ambiente)
+@cindex variabili d'ambiente @subentry @env{REALLY_USE_PERSIST_MALLOC}
Finora la memoria persistente @`e stata testata solo nei sistemi operativi
-GNU/Linux, Cygwin, Solaris 2.11 e in Mac OS.
-In altri sistemi operativi, la situazione pu@`o essere diversa, e potrebbero
-essere necessarie ulteriori indagini prima di utilizzare questa
-funzionalit@`a.
+GNU/Linux, Cygwin, Solaris 2.11, sistemi macOS su hardware Intel,
+FreeBSD 13.1 e OpenBSD 7.1.
+Su tutti gli altri sistemi, la memoria persistente @`e disabilitata
+per default. Si pu@`o chiedere di abilitarla esportando la
+variabile d'ambiente @env{REALLY_USE_PERSIST_MALLOC} con un
+valore diverso dalla stringa nulla, prima di eseguire
+@command{configure}
+(@pxref{Installazione veloce}).
+Se lo fate, e tutti i test passano senza errori, siete pregati
+di informare il manutentore di @command{gawk}.
Per usare la memoria persistente, seguire questa procedura:
@@ -33171,6 +33671,14 @@ di utilit@`a @command{truncate}:
$ @kbd{truncate -s 4G dati.pma}
@end example
+@item
+Si raccomanda (ma non @`e obbligatorio farlo) di modificare i permessi
+di accesso al file in modo che solo il proprietario possa leggere e
+aggiornare il file:
+
+@example
+$ @kbd{chmod 0600 dati.pma}
+@end example
@cindex @env{GAWK_PERSIST_FILE} (variabile d'ambiente)
@cindex variabili d'ambiente @subentry @env{GAWK_PERSIST_FILE}
@@ -33264,19 +33772,34 @@ di memoria persistente.
codice sorgente @file{support/pma.c} per comprendere il comportamento
dei vari livelli di verbosit@`a.
-@quotation NOTA
+Ci sono alcune limitazioni all'uso della memoria persistente:
+
+@itemize @bullet
+@item
Se si usa la libreria MPFR (opzione @option{-M}) nella prima esecuzione
di un programma che fa uso della memoria persistente si @emph{deve}
usarla in tutte le esecuzioni successive.
Analogamente, se non si usa l'opzione @option{-M} nella prima esecuzione
non va usata in alcuna esecuzione successiva.
-Mischiare esecuzioni che usano la libreria MPFR con esecuzioni che non
-la usano, utilizzando lo stesso file di memoria persistente produrr@`a
-risultati inattesi e/o errori fatali.
-@command{gawk} non rileva una tale situazione, e non @`e detto che lo
-far@`a in qualche versione futura.
-@end quotation
+Non @`e consentito alternare esecuzioni che usano la libreria MPFR con
+esecuzioni che non la usano. Se @command{gawk} rileva questa
+situazione, termina l'esecuzione con un errore fatale.
+
+@item
+Il filesystem CIFS in ambiente GNU/Linux risulta non
+funzionare bene con l'allocatore PMA.
+Quindi, non va usato un file di appoggio per la memoria persistente
+residente su un filesystem CIFS.
+
+@item
+Se @command{gawk} @`e eseguito dall'utente @command{root}, l'uso
+della memoria persistente non @`e consentito.
+Ci@`o al fine di evitare la possibilit@`a che dati "privati"
+siano salvati nel file di appoggio e vengano successivamente
+acceduti da un altro utente o hacker (che a sua volta sia divenuto
+@command{root}.
+@end itemize
Terence Kelly ha preparato un documento a parte, dedicato alla
memoria persistente @cite{@value{PMGAWKTITLE}},
@@ -34732,7 +35255,7 @@ quello di programmi che risiedono su file.)
Nel nostro caso, il debugger verr@`a invocato in questo modo:
@example
-$ @kbd{gawk -D -f getopt.awk -f join.awk -f uniq.awk -1 file_di_input}
+$ @kbd{gawk -D -f getopt.awk -f join.awk -f uniq.awk -- -1 file_di_input}
@end example
@cindex @env{AWKPATH} (variabile d'ambiente)
@@ -34744,6 +35267,10 @@ questa sintassi @`e leggermente differente da quello che sono abituati a usare.
Col debugger di @command{gawk}, si danno gli argomenti per eseguire il
programma nella riga di comando al debugger piuttosto che come parte del
comando @code{run} al prompt del debugger.)
+Il doppio trattino @option{--} termina le opzioni specificate a @command{gawk}
+sulla riga di comando. Non @`e strettamente necessaria in questo caso,
+ma lo diviente se un'opzione destinata al programma @command{awk}
+@`e in conflitto con qualche opzione di @command{gawk}.
L'opzione @option{-1} @`e un'opzione per @file{uniq.awk}.
@cindex debugger @subentry prompt
@@ -37067,8 +37594,8 @@ Si pu@`o verificare se il supporto a MPFR @`e disponibile in questo modo:
@example
$ @kbd{gawk --version}
-@print{} GNU Awk 5.2.0, API 3.2, PMA Avon 7, (GNU MPFR 4.0.1, GNU MP 6.1.2)
-@print{} Copyright (C) 1989, 1991-2022 Free Software Foundation.
+@print{} GNU Awk 5.2.1, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.1.0, GNU MP 6.2.1)
+@print{} Copyright (C) 1989, 1991-2023 Free Software Foundation.
@dots{}
@end example
@@ -38475,10 +39002,10 @@ Questo si pu@`o vedere in @inlineraw{docbook, <xref linkend="figura-carica-esten
@float Figura,figura-carica-estensione
@caption{Caricamento dell'estensione}
@ifclear SMALLPRINT
-@center @image{api-figura1, , , Caricamento dell'estensione}
+@center @image{gawk-api-figura1, , , Caricamento dell'estensione}
@end ifclear
@ifset SMALLPRINT
-@center @image{api-figura1, 11cm, , Caricamento dell'estensione}
+@center @image{gawk-api-figura1, 11cm, , Caricamento dell'estensione}
@end ifset
@end float
@@ -38488,7 +39015,7 @@ Questo si pu@`o vedere in @inlineraw{docbook, <xref linkend="figura-carica-esten
<figure id="figura-carica-estensione" float="0">
<title>Caricamento dell'estensione</title>
<mediaobject>
-<imageobject role="web"><imagedata fileref="api-figura1.png" format="PNG"/></imageobject>
+<imageobject role="web"><imagedata fileref="gawk-api-figura1.png" format="PNG"/></imageobject>
</mediaobject>
</figure>
@end docbook
@@ -38516,10 +39043,10 @@ Questo @`e shown in @inlineraw{docbook, <xref linkend="figura-registrare-una-nuo
@float Figura,figura-registrare-una-nuova-funzione
@caption{Registrare una nuova funzione}
@ifclear SMALLPRINT
-@center @image{api-figura2, , , Registrare una nuova funzione}
+@center @image{gawk-api-figura2, , , Registrare una nuova funzione}
@end ifclear
@ifset SMALLPRINT
-@center @image{api-figura2, 11cm , , Registrare una nuova funzione}
+@center @image{gawk-api-figura2, 11cm , , Registrare una nuova funzione}
@end ifset
@end float
@end ifnotdocbook
@@ -38528,7 +39055,7 @@ Questo @`e shown in @inlineraw{docbook, <xref linkend="figura-registrare-una-nuo
<figure id="figura-registrare-una-nuova-funzione" float="0">
<title>Registering a new function</title>
<mediaobject>
-<imageobject role="web"><imagedata fileref="api-figura2.png" format="PNG"/></imageobject>
+<imageobject role="web"><imagedata fileref="gawk-api-figura2.png" format="PNG"/></imageobject>
</mediaobject>
</figure>
@end docbook
@@ -38556,10 +39083,10 @@ Questo @`e mostrato in @inlineraw{docbook, <xref linkend="figura-chiamata-nuova-
@float Figura,figura-chiamata-nuova-funzione
@caption{Chiamata della nuova funzione}
@ifclear SMALLPRINT
-@center @image{api-figura3, , , Chiamata della nuova funzione}
+@center @image{gawk-api-figura3, , , Chiamata della nuova funzione}
@end ifclear
@ifset SMALLPRINT
-@center @image{api-figura3,11cm , , Chiamata della nuova funzione}
+@center @image{gawk-api-figura3,11cm , , Chiamata della nuova funzione}
@end ifset
@end float
@end ifnotdocbook
@@ -38568,7 +39095,7 @@ Questo @`e mostrato in @inlineraw{docbook, <xref linkend="figura-chiamata-nuova-
<figure id="figura-chiamata-nuova-funzione" float="0">
<title>Chiamata della nuova funzione</title>
<mediaobject>
-<imageobject role="web"><imagedata fileref="api-figura3.png" format="PNG"/></imageobject>
+<imageobject role="web"><imagedata fileref="gawk-api-figura3.png" format="PNG"/></imageobject>
</mediaobject>
</figure>
@end docbook
@@ -39658,9 +40185,9 @@ registrate, quando viene invocato specificando l'opzione @option{--version}.
@cindex input @subentry analizzatore di @subentry personalizzato
Per default, @command{gawk} legge file di testo come input. Il valore della
-variabile @code{RS} @`e usato per determinare la fine di un record, e subito
-dopo la variabile @code{FS} (o @code{FIELDWIDTHS} o @code{FPAT}) viene usata
-per suddividerlo in campi
+variabile @code{RS} @`e usato per determinare la fine di un record in input,
+e subito dopo la variabile @code{FS} (o @code{FIELDWIDTHS} o @code{FPAT})
+viene usata per suddividerlo in campi
@iftex
(@pxrefil{Leggere file}).
@end iftex
@@ -39776,14 +40303,41 @@ inizialmente) da @code{@var{XXX}_can_take_file()}, e quelli che sono usati da
Il nome del file.
@item int fd;
-Un descrittore di file per il file. Se @command{gawk} riesce ad aprire
-il file, il valore di @code{fd} @emph{non} sar@`a uguale a
-@code{INVALID_HANDLE} [descrittore non valido]. In caso contrario,
-quello sar@`a il valore.
+Un descrittore di file per il file. @command{gawk} tenta di aprire
+il file in lettura usando la chiamata di sistema @code{open()}.
+Se il file viene effettivamente aperto, il valore di @code{fd}
+@emph{non} sar@`a uguale a @code{INVALID_HANDLE}
+[descrittore non valido].
+In caso contrario, il valore sar@`a quello.
+
+Un'estensione pu@`o decidere che non desidera usare il descrittore
+di file aperto che le viene passato da @command{gawk}.
+In tal caso pu@`o chiudere il file e impostare il relativo
+descrittore di file @code{fd} al valore @code{INVALID_HANDLE},
+oppure ignorarlo e mantenere un suo proprio descrittore di file
+nei suoi dati privati, raggiungibili usando il puntatore
+@code{opaque} (vedere pi@`u sotto in questa lista).
+In ogni caso, se il descrittore di file @`e valido, @emph{non}
+dovrebbe essere sovrascritto con un altro valore; se lo si fa,
+si causa una perdita di dati.
@item struct stat sbuf;
Se il descrittore di file @`e valido, @command{gawk} avr@`a riempito i campi di
questa struttura invocando la chiamata di sistema @code{fstat()}.
+Altrimenti, se la chiamata di sistema @code{lstat()} @`e disponibile,
+essa verr@`a usata. Se neppure @code{lstat()} @`e disponibile, allora
+verr@`a usata la chiamata di sistema @code{stat()}.
+
+L'ottenere informazioni relative al file consente alle estensioni di
+controllare il tipo di file, anche se non sar@`a poi possibile aprirlo.
+Ci@`o capita, per esempio, nei sistemi Windows, quando si tenta di
+usare @code{open()} su una directory.
+
+Se @command{gawk} non sar@`a riuscito a ottenere le informazioni
+relative al file, allora @code{sbuf} conterr@`a zeri binari.
+In particolare, il codice dell'estensione pu@`o testare se il campo
+@samp{sbuf.st_mode == 0}. Se @`e questo il caso, allora in
+@code{sbuf} non @`e contenuta alcuna informazione.
@end table
La funzione @code{@var{XXX}_can_take_file()} dovrebbe esaminare i campi di
@@ -39821,7 +40375,7 @@ Questo puntatore a funzione dovrebbe puntare a una funzione che crea i record
in input. Tale funzione @`e il nucleo centrale dell'analizzatore di input.
Il suo modo di operare @`e descritto nel testo che segue questo elenco.
-@item ssize_t (*read_func)();
+@item ssize_t (*read_func)(int, void *, size_t);
Questo puntatore a funzione dovrebbe puntare a una funzione che ha lo
stesso comportamento della chiamata di sistema standard POSIX @code{read()}.
@`E in alternativa al puntatore a @code{get_record}. Il relativo comportamento
@@ -39848,14 +40402,16 @@ record in input. I parametri sono i seguenti:
@table @code
@item char **out
-Questo @`e un puntatore a una variabile @code{char *} che @`e impostatata in modo
-da puntare al record. @command{gawk} usa una sua copia locale dei dati,
-quindi l'estensione deve gestire la relativa area di memoria.
+Questo @`e un puntatore a una variabile @code{char *} che @`e impostatata
+in modo da puntare al record. @command{gawk} usa una sua copia locale dei
+dati, quindi l'estensione dell'utente deve gestire la relativa area di
+memoria.
@item struct awk_input *iobuf
-Questa @`e la struttura @code{awk_input_buf_t} per il file. I campi dovrebbero
-essere usati per leggere i dati (@code{fd}) e per gestire lo stato privato
-(@code{opaque}), se necessario.
+Questa @`e la struttura @code{awk_input_buf_t} per il file.
+Due dei suoi campi dovrebbero essere usati dall'estensione utente:
+@code{fd} per leggere i dati, e @code{opaque} per gestire lo stato privato
+se necessario.
@item int *errcode
Se si verifica un errore, @code{*errcode} dovrebbe essere impostato a un
@@ -39867,8 +40423,8 @@ Se il concetto ``fine record'' @`e applicabile,
@code{*rt_start} dovrebbe essere impostato per puntare ai dati da usare come
@code{RT}, e @code{*rt_len} dovrebbe essere impostata alla lunghezza di quel
campo. In caso contrario, @code{*rt_len} dovrebbe essere impostata a zero.
-@command{gawk} usa una sua copia di questi dati, quindi l'estensione deve
-gestire tale memoria.
+Anche qui @command{gawk} usa una sua copia di questi dati, quindi
+l'estensione utente deve gestire tale memoria.
@item const awk_fieldwidth_info_t **field_width
Se @code{field_width} non @`e @code{NULL}, @code{*field_width} sar@`a
@@ -39880,6 +40436,7 @@ inoltre essa deve rimanere disponibile almeno fino alla successiva chiamata a
@code{get_record} o a @code{close_func}. Si noti inoltre che
@code{field_width} vale @code{NULL} quando @code{getline} sta assegnando
i risultati a una variabile, e quindi un'analisi del campo non @`e necessaria.
+
Se l'analizzatore imposta @code{*field_width},
allora @command{gawk} usa questa descrizione per analizzare il record in
input, e il valore di @code{PROCINFO["FS"]} sar@`a @code{"API"} finch@'e questo
@@ -39938,15 +40495,8 @@ valore preso da una variabile @command{awk}, come fa l'estensione XML
inclusa nel progetto @code{gawkextlib} (@pxref{gawkextlib}).
In quest'ultimo caso, il codice in una regola @code{BEGINFILE}
pu@`o controllare @code{FILENAME} ed @code{ERRNO} per decidere se
-attivare un analizzatore di input (@pxref{BEGINFILE/ENDFILE}) oppure no.
-
-Un analizzatore di input va registrato usando la seguente funzione:
-
-@table @code
-@item void register_input_parser(awk_input_parser_t *input_parser);
-Registra l'analizzatore di input puntato da @code{input_parser} con
-@command{gawk}.
-@end table
+attivare un analizzatore di input utente oppure no
+(@pxref{BEGINFILE/ENDFILE}).
Se si vuole ignorare il meccanismo di default per l'analisi dei campi
per un determinato record, si deve riempire una struttura
@@ -39993,6 +40543,14 @@ dimensione pu@`o essere usata come argomento per @code{malloc()} o in una
struttura @dfn{union} per allocare spazio staticamente.
Per un esempio si pu@`o vedere l'estensione di esempio @code{readdir_test}.
+Un analizzatore di input va registrato usando la seguente funzione:
+
+@table @code
+@item void register_input_parser(awk_input_parser_t *input_parser);
+Registra l'analizzatore di input puntato da @code{input_parser} con
+@command{gawk}.
+@end table
+
@node Processori di output
@subsubsection Registrare un processore di output
@cindex personalizzato @subentry processore di output
@@ -40108,11 +40666,14 @@ appropriate per fare il lavoro richiesto.
La funzione @code{@var{XXX}_can_take_file()} dovrebbe decidere in base ai
campi @code{nome} e @code{modo}, e a ogni altro ulteriore indicatore di stato
(p.es., valori di variabili @command{awk}) adatto allo scopo.
+@command{gawk} tenta di aprire in scrittura il file indicato.
+L'elemento @code{fp} varr@`a @code{NULL} solo se non si riesci ad aprire
+il file.
Quando @command{gawk} chiama @code{@var{XXX}_take_control_of()}, la funzione
dovrebbe riempire i rimanenti campi
in modo opportuno, tranne che per @code{fp}, che dovrebbe essere usato
-normalmente.
+normalmente se il suo valore non @`e @code{NULL}.
Il processore di output va registrato usando la seguente funzione:
@@ -40987,7 +41548,7 @@ richiede di comprendere il modo con cui tali valori sono convertiti in stringhe
Come per @emph{tutte} le stringhe passate a @command{gawk} da
un'estensione, la memoria che contiene il valore della stringa con chiave
-@code{index} deve essere stata acquisita utilizzando le funzioni
+@code{index} dev'essere stata acquisita utilizzando le funzioni
@code{gawk_malloc()}, @code{gawk_calloc()} o @code{gawk_realloc()}, e
@command{gawk} rilascer@`a (al momento opportuno) la relativa memoria.
@@ -41285,7 +41846,7 @@ codice di un'estensione:
@itemize @value{BULLET}
@item
-Il vettore appena creato deve essere subito messo nella Tabella dei simboli di
+Il vettore appena creato dev'essere subito messo nella Tabella dei simboli di
@command{gawk}. Solo dopo aver fatto questo @`e possibile aggiungere elementi
al vettore.
@@ -43348,8 +43909,9 @@ valore uno se completa il lavoro o zero se non va a buon fine.
Questa funzione ha come argomento una stringa, che @`e il nome del file
dal quale leggere i valori di molteplici variabili globali.
Per ogni variabile contenuta nel file, il relativo valore viene
-caricato, a meno che la variabile sia gi@`a esistente.
-Se la variabile esiste gi@`a, il valore della variabile specificato
+caricato, a meno che alla variabile sia gi@`a stato assegnato un
+valore, o sia stata usata come un vettore.
+In tal caso, il valore della variabile specificato
nel file viene ignorato. Restituisce il
valore uno se completa il lavoro o zero se non va a buon fine.
@end table
@@ -43439,18 +44001,6 @@ if (contents == "" && ERRNO != "") @{
@node Esempio di estensione Time
@subsection Funzioni dell'estensione time
-@quotation ATTENZIONE
-A partire da @command{gawk} @value{PVERSION} 5.1.0, quest'estensione @`e
-da considerarsi obsoleta. @`E sostituita dall'estensione
-@code{timex} in @code{gawkextlib} (@pxref{gawkextlib}).
-
-Nella @value{PVERSION} 5.1, non viene emesso alcun messaggio di avviso
-se si usa quest'estensione.
-A partire dalla prossima versione principale, verr@`a emesso un messaggio
-di avviso. Nella versione successiva a quella, quest'estensione sar@`a
-rimossa dalla distribuzione.
-@end quotation
-
L'estensione @code{time} aggiunge due funzioni, di nome
@code{gettimeofday()} e @code{sleep()}, come segue:
@@ -43486,6 +44036,34 @@ numero intero).
Dettagli di implementazione: a seconda della disponibilit@`a nel sistema in uso,
questa funzione tenta di usare @code{nanosleep()} o @code{select()} per
ottenere il tempo di attesa richiesto.
+
+@cindex @code{strptime()} (funzione estesa)
+@cindex funzione estesa @subentry @code{strptime()}
+@item timeval = strptime(@var{string}, @var{format})
+Questa funzione accetta due argomenti, una stringa che rappresenta
+una data e un'ora e una stringa di formato che descrive i dati
+contenuti nella prima stringa.
+Viene richiamata la funzione di libreria C @code{strptime()},
+con i valori passati alla funzione.
+Se la scansione dei parametri risulta essere corretta, i risultati
+sono quindi passati alla funzione di libreria C @code{mktime()},
+i cui risultati vengono poi restituiti, e contengono il numero di
+secondi passato dall'inizio del tempo in Unix (01 gennaio 1970),
+nel fuso orario del computer, a prescindere da qualsiasi specificazione
+di fuso orario contenuta negli argomenti passati alla funzione.
+(Ci@`o equivale alla funzione predefinita @code{systime()} di
+@command{gawk}.
+Altrimenti, in caso di errore, viene restituito @minus{}1.
+
+Notare che la routine di libreria C @code{strptime()} qui
+richiamata ignora ogni indicazione di fuso orario nella stringa
+che descrive la data, restituendo sempre valori relativi al
+fuso orario del computer.
+@ignore
+It might be better to have this
+routine return a string similar to what @command{gawk}'s @code{mktime()}
+function expects, but we ran out of energy.
+@end ignore
@end table
@node Esempio di estensione API Test
@@ -43693,8 +44271,8 @@ un'estensione.
considerata come in sola lettura dall'estensione.
@item
-@emph{Tutta} la memoria passata da un'estensione a @command{gawk} deve
-essere ottenuta dalle funzioni di allocazione della memoria previste
+@emph{Tutta} la memoria passata da un'estensione a @command{gawk}
+dev'essere ottenuta dalle funzioni di allocazione della memoria previste
dall'API. @command{gawk} @`e responsabile per la gestione di quella memoria e
la libera quando @`e il momento per farlo.
@@ -44472,7 +45050,7 @@ Tandem (non-POSIX)
Compilatore pre-standard VAX C per VAX/VMS
@item
-GCC per VAX e Alpha non @`e stato verificato da parecchio tempo.
+GCC per Alpha non @`e stato verificato da parecchio tempo.
@end itemize
@@ -45219,6 +45797,10 @@ La funzione @code{getline} ridiretta @`e stata resa possibile all'interno di
(@pxref{BEGINFILE/ENDFILE}).
@item
+Supporto per continuare dopo errori di I/O non fatali
+@xref{Continuazione dopo errori}.
+
+@item
Il comando @code{where} @`e stato aggiunto al debugger
(@pxref{Stack di esecuzione}).
@@ -45440,6 +46022,34 @@ integrato, consentendo l'uso di dati persistenti
sistemi
(@pxref{Memoria persistente}).
+@item
+L'elemento @code{PROCINFO["pma"]} esiste se l'allocatore di memoria
+persistente (PMA) @`e disponibile.
+@pxref{Variabili auto-assegnate}.)
+
+@end itemize
+
+La versione 5.3 ha aggiunto le seguenti funzionalit@`a:
+
+@itemize
+@item
+Divisione in campi per file di tipo CSV (Campi separati da virgola)
+(@pxref{Campi separati da virgola}).
+
+@item
+La possibilit@`a che @command{gawk} bufferizzi l'output a @dfn{pipe}
+(@pxref{Noflush}).
+
+@item
+La sequenza di protezione @samp{\u}
+(@pxref{Sequenze di protezione}).
+
+@item
+La necessit@`a di utilizzare la libreria GNU @code{libsigsegv}
+@`e stata rimossa da @command{gawk}.
+Il valore aggiunto relativo non @`e mai stato grande e la funzionalit@`a
+causava problemi in alcuni sistemi.
+
@end itemize
@c XXX ADD MORE STUFF HERE
@@ -45457,18 +46067,20 @@ le tre versioni liberamente disponibili pi@`u usate di @command{awk}
@multitable {File speciale @file{/dev/stderr}} {BWK @command{awk} } {@command{mawk}} {@command{gawk}} {Standard attuale}
@headitem Funzionalit@`a @tab BWK @command{awk} @tab @command{mawk} @tab @command{gawk} @tab Standard attuale
+@item Operatori @code{**} e @code{**=} @tab X @tab @tab X @tab
@item Sequenza di protezione @samp{\x} @tab X @tab X @tab X @tab
-@item Stringa nulla come @code{FS} @tab X @tab X @tab X @tab
+@item Sequenza di protezione @samp{\u} @tab X @tab @tab X @tab
@item File speciale @file{/dev/stdin} @tab X @tab X @tab X @tab
@item File speciale @file{/dev/stdout} @tab X @tab X @tab X @tab
@item File speciale @file{/dev/stderr} @tab X @tab X @tab X @tab
+@item Variabile @code{BINMODE} @tab @tab X @tab X @tab
+@item Supporto CSV @tab X @tab @tab X @tab
+@item Stringa nulla come @code{FS} @tab X @tab X @tab X @tab
@item @code{delete} senza indici @tab X @tab X @tab X @tab X
@item Funzione @code{fflush()} @tab X @tab X @tab X @tab X
+@item Parola chiave @code{func} @tab X @tab @tab X @tab
@item @code{length()} di un vettore @tab X @tab X @tab X @tab
@item Istruzione @code{nextfile} @tab X @tab X @tab X @tab X
-@item Operatori @code{**} e @code{**=} @tab X @tab @tab X @tab
-@item Parola chiave @code{func} @tab X @tab @tab X @tab
-@item Variabile @code{BINMODE} @tab @tab X @tab X @tab
@item @code{RS} come @dfn{regexp} @tab X @tab X @tab X @tab
@item Funzioni gestione data/ora @tab @tab X @tab X @tab
@end multitable
@@ -45889,10 +46501,6 @@ resto del team di sviluppo.
John Malmberg ha apportato miglioramenti significativi alla versione
OpenVMS e alla relativa documentazione.
-@item
-@cindex Colombo, Antonio
-Antonio Giovanni Colombo ha riscritto diversi esempi, che non erano pi@`u
-attuali, contenuti nei primi capitoli, e gliene sono estremamente grato.
Ha inoltre preparato con Marco Curreli e mantiene la traduzione in
italiano di questo libro.
@@ -46387,8 +46995,8 @@ File necessari per compilare @command{gawk} sotto MS-Windows
(@pxref{Installazione su PC} per i dettagli).
@item vms/*
-File necessari per compilare @command{gawk} sotto Vax/VMS e OpenVMS
-(@pxref{Installazione su VMS} per i dettagli).
+File necessari per compilare @command{gawk} sotto OpenVMS
+(@pxref{Installazione su OpenVMS} per i dettagli).
@item test/*
Una serie di test per
@@ -46802,7 +47410,7 @@ vari sistemi non-Unix.
@menu
* Installazione su PC:: Installare e compilare @command{gawk}
su Microsoft Windows.
-* Installazione su VMS:: Installare @command{gawk} su VMS.
+* Installazione su OpenVMS:: Installare @command{gawk} su OpenVMS.
@end menu
@node Installazione su PC
@@ -47079,16 +47687,16 @@ automaticamente la conversione di @code{"\r\n"}, mentre cos@`{@dotless{i}} non @
In ambiente MSYS2, la compilazione usando i comandi classici
@samp{./configure && make} funziona senza necessitare di alcuna modifica.
-@node Installazione su VMS
-@appendixsubsec Compilare e installare @command{gawk} su Vax/VMS e OpenVMS
+@node Installazione su OpenVMS
+@appendixsubsec Compilare e installare @command{gawk} su OpenVMS
@c based on material from Pat Rankin <rankin@eql.caltech.edu>
@c now rankin@pactechdata.com
@c now r.pat.rankin@gmail.com
-@cindex @command{gawk} @subentry versione VMS di
-@cindex installare @command{gawk} @subentry su VMS
-@cindex VMS @subentry installare @command{gawk} su
+@cindex @command{gawk} @subentry versione OpenVMS di
+@cindex installare @command{gawk} @subentry su OpenVMS
+@cindex OpenVMS @subentry installare @command{gawk} su
@ifnotinfo
Questa
@end ifnotinfo
@@ -47098,23 +47706,23 @@ Questo
@value{SUBSECTION}
descrive come compilare e installare @command{gawk}
sotto OpenVMS.
-Il termine classico ``VMS'' @`e usato qui per designare OpenVMS.
@menu
-* Compilazione su VMS:: Come compilare @command{gawk} su VMS.
-* Estensioni dinamiche su VMS:: Compilare estensioni dinamiche
- di @command{gawk} su VMS.
-* Dettagli installazione su VMS:: Come installare @command{gawk} su VMS.
-* Esecuzione su VMS:: Come eseguire @command{gawk} su VMS.
-* GNV su VMS:: Il progetto VMS GNV.
+* Compilazione su OpenVMS:: Come compilare @command{gawk} su OpenVMS.
+* Estensioni dinamiche su OpenVMS:: Compilare estensioni dinamiche
+ di @command{gawk} su OpenVMS.
+* Dettagli installazione su OpenVMS:: Come installare @command{gawk} su
+ OpenVMS.
+* Esecuzione su OpenVMS:: Come eseguire @command{gawk} su OpenVMS.
+* GNV su OpenVMS:: Il progetto GNV su OpenVMS.
@end menu
-@node Compilazione su VMS
-@appendixsubsubsec Compilare @command{gawk} su VMS
-@cindex compilare @command{gawk} @subentry per VMS
-@cindex VMS @subentry compilare @command{gawk} per
+@node Compilazione su OpenVMS
+@appendixsubsubsec Compilare @command{gawk} su OpenVMS
+@cindex compilare @command{gawk} @subentry per OpenVMS
+@cindex OpenVMS @subentry compilare @command{gawk} per
-Per compilare @command{gawk} sotto VMS, esiste una procedura di comandi
+Per compilare @command{gawk} sotto OpenVMS, esiste una procedura di comandi
@code{DCL} che esegue tutti i comandi @code{CC} e @code{LINK} necessari. C'@`e
anche un @file{Makefile} da usare con i programmi di utilit@`a @code{MMS} e
@code{MMK}.
@@ -47152,7 +47760,7 @@ il nome del parametro che specifica l'obiettivo pu@`o dover essere scritto
digitando esattamente le lettere maiuscole e minuscole.
@command{gawk} @`e stato testato usando VMS Software, Inc.@:
-Community editions.
+Community editions:
@itemize @bullet
@item
@@ -47164,15 +47772,15 @@ IA64 @`e anche nota come ``Itanium''.}
@end itemize
Poich@'e HPE ha eliminato il programma di licenza Hobbyist, non @`e possibile
-effettuare ulteriori test su versioni pi@`u datate di VAX/VMS e OpenVMS.
+effettuare ulteriori test su versioni pi@`u datate di OpenVMS.
-@xref{GNV su VMS} per informazioni su come compilare
+@xref{GNV su OpenVMS} per informazioni su come compilare
@command{gawk} come un kit PCSI compatible con il prodotto GNV.
-@node Estensioni dinamiche su VMS
-@appendixsubsubsec Compilare estensioni dinamiche di @command{gawk} in VMS
+@node Estensioni dinamiche su OpenVMS
+@appendixsubsubsec Compilare estensioni dinamiche di @command{gawk} su OpenVMS
-Le estensioni che sono state rese disponibile su VMS possono essere
+Le estensioni che sono state rese disponibile su OpenVMS possono essere
costruite dando uno dei comandi seguenti:
@example
@@ -47197,45 +47805,34 @@ col formato IEEE. La dimensione dei puntatori @`e 32 bit, e il trattamento dei
simbolici dovrebbe richiedere il rispetto esatto di maiuscole/minuscole, con le
abbreviazioni CRC per simboli pi@`u lunghi di 32 bit.
-Per Alpha e Itanium:
-
@example
/nome=(as_is,short)
/float=ieee/ieee_mode=denorm_results
@end example
-Per VAX@footnote{Le estensioni dinamiche in questo momento non funzionano
-su VAX, quanto segue vale solo come documentazione.}:
-
-@example
-/nome=(as_is,short)
-@end example
-
Le macro da usare al momento della compilazione devono essere definite prima di
-includere il primo file di intestazione proveniente da VMS, come segue:
+includere il primo file di intestazione proveniente da OpenVMS, come segue:
@example
-#if (__CRTL_VER >= 70200000) && !defined (__VAX)
+#if (__CRTL_VER >= 70200000)
#define _LARGEFILE 1
#endif
-#ifndef __VAX
#ifdef __CRTL_VER
#if __CRTL_VER >= 80200000
#define _USE_STD_STAT 1
#endif
#endif
-#endif
@end example
-Se si scrivono delle estensioni utente da eseguire su VMS, vanno fornite anche
-queste definizioni. Il file @file{config.h} creato quando si compila
-@command{gawk} su VMS lo fa gi@`a; se invece si usa qualche altro file simile,
-occorre ricordarsi di includerlo prima di qualsiasi file di intestazione
-proveniente da VMS.
+Se si scrivono delle estensioni utente da eseguire su OpenVMS, vanno fornite
+anche queste definizioni. Il file @file{config.h} creato quando si compila
+@command{gawk} su OpenVMS lo fa gi@`a; se invece si usa qualche altro file
+simile, occorre ricordarsi di includerlo prima di qualsiasi file di
+intestazione proveniente da OpenVMS.
-@node Dettagli installazione su VMS
-@appendixsubsubsec Installare @command{gawk} su VMS
+@node Dettagli installazione su OpenVMS
+@appendixsubsubsec Installare @command{gawk} su OpenVMS
Per usare @command{gawk}, tutto ci@`o che serve @`e un comando ``esterno'', che @`e
un simbolo @code{DCL} il cui valore inizia col segno del dollaro.
@@ -47269,14 +47866,14 @@ Per farlo solo nella sessione corrente si pu@`o usare:
$ @kbd{set command gnv$gnu:[vms_bin]gawk_verb.cld}
@end example
-Oppure il sistemista VMS pu@`o usare @file{GNV$GNU:[vms_bin]gawk_verb.cld} per
+Oppure il sistemista OpenVMS pu@`o usare @file{GNV$GNU:[vms_bin]gawk_verb.cld} per
aggiungere i comandi @command{gawk} e @command{awk} alla tabella
@samp{DCLTABLES} valida per tutto il sistema.
La sintassi DCL @`e documentata nel file @file{gawk.hlp}.
In alternativa, l'elemento @file{gawk.hlp} pu@`o essere caricato in una
-libreria di aiuto VMS:
+libreria di aiuto OpenVMS:
@example
$ @kbd{LIBRARY/HELP sys$help:helplib [.vms]gawk.hlp}
@@ -47284,7 +47881,7 @@ $ @kbd{LIBRARY/HELP sys$help:helplib [.vms]gawk.hlp}
@noindent
(Una libreria specifica dell'installazione potrebbe venir usata invece
-della libreria standard VMS library @samp{HELPLIB}.) Dopo aver installato
+della libreria standard OpenVMS @samp{HELPLIB}.) Dopo aver installato
il testo di aiuto, il comando:
@example
@@ -47305,11 +47902,11 @@ ancora stato trovato, @command{gawk} appone il suffisso @samp{.awk} al
@value{FN} e ritenta la ricerca del file. Se @samp{AWK_LIBRARY} non @`e
definita, si usa per essa il valore di default @samp{SYS$LIBRARY:}.
-@node Esecuzione su VMS
-@appendixsubsubsec Eseguire @command{gawk} su VMS
+@node Esecuzione su OpenVMS
+@appendixsubsubsec Eseguire @command{gawk} su OpenVMS
L'elaborazione della riga di comando e le convenzioni per proteggere i
-caratteri sono significativamente differenti in VMS, e quindi gli esempi
+caratteri sono significativamente differenti in OpenVMS, e quindi gli esempi
presenti in questo @value{DOCUMENT} o provenienti da altre fonti necessitano
piccole modifiche. Le modifiche, tuttavia, @emph{sono} veramente piccole, e
tutti i programmi @command{awk} dovrebbero funzionare correttamente.
@@ -47326,33 +47923,34 @@ $ @kbd{gawk -"W" version}
Si noti che il testo con caratteri maiuscoli e misti maiuscoli/minuscoli
dev'essere incluso tra doppi apici.
-La versione VMS di @command{gawk} comprende un'interfaccia in stile @code{DCL},
-oltre a quella originale, di tipo shell (si veda il file di aiuto per ulteriori
-dettagli). Un effetto indesiderato della duplice analisi della riga
-di comando @`e che se c'@`e solo un unico parametro (come nel programma con le
-righe contenenti doppi apici), il comando diviene ambiguo. Per evitare questo
-inconveniente, il flag, normalmente non necessario, @option{--} @`e necessario
-per forzare un esame dei parametri in stile Unix, piuttosto che nella modalit@`a
-@code{DCL}. Se qualsiasi altra opzione preceduta dal segno @option{-} (o pi@`u
-parametri, per esempio, pi@`u @value{DF} in input) @`e presente, non c'@`e ambiguit@`a,
+La versione OpenVMS di @command{gawk} comprende un'interfaccia in stile
+@code{DCL}, oltre a quella originale, di tipo shell (si veda il file di aiuto
+per ulteriori dettagli). Un effetto indesiderato della duplice analisi della
+riga di comando @`e che se c'@`e solo un unico parametro (come nel programma
+con le righe contenenti doppi apici), il comando diviene ambiguo. Per evitare
+questo inconveniente, il flag, normalmente non necessario, @option{--} @`e
+necessario per forzare un esame dei parametri in stile Unix, piuttosto che
+nella modalit@`a @code{DCL}.
+Se qualsiasi altra opzione preceduta dal segno @option{-} (o pi@`u parametri,
+per esempio, pi@`u @value{DF} in input) @`e presente, non c'@`e ambiguit@`a,
e l'opzione @option{--} pu@`o essere omessa.
-@cindex codice di ritorno @subentry di @command{gawk} @subentry in VMS
-@cindex @code{exit} (istruzione) @subentry codice di ritorno di @command{gawk}, in VMS
+@cindex codice di ritorno @subentry di @command{gawk} @subentry in OpenVMS
+@cindex @code{exit} (istruzione) @subentry codice di ritorno di @command{gawk}, in OpenVMS
Il valore di @code{exit} @`e un valore in stile Unix e viene trasformato in
-un codice di ritorno VMS all'uscita del programma.
+un codice di ritorno OpenVMS all'uscita del programma.
-I bit di severit@`a di VMS saranno impostati a partire dal valore dell'istruzione
-@code{exit}. Un errore grave @`e indicato da 1, e VMS imposta la condizione
-@code{ERROR}. Un errore fatale @`e indicato da 2, e VMS imposta la condizione
+I bit di severit@`a di OpenVMS saranno impostati a partire dal valore dell'istruzione
+@code{exit}. Un errore grave @`e indicato da 1, e OpenVMS imposta la condizione
+@code{ERROR}. Un errore fatale @`e indicato da 2, e OpenVMS imposta la condizione
@code{FATAL}. Ogni altro valore imposta la condizione @code{SUCCESS}. Il
-valore d'uscita @`e codificato per aderire agli standard di codifica VMS e avr@`a
+valore d'uscita @`e codificato per aderire agli standard di codifica OpenVMS e avr@`a
un @code{C_FACILITY_NO} di @code{0x350000} con il codice costante @code{0xA000}
aggiunto al numero spostato a sinistra di 3 bit per far posto al codice di
severit@`a.
Per estrarre il codice reale di ritorno dell'istruzione @code{exit}
-di @command{gawk} dalla condizione impostata da VMS, si usi:
+di @command{gawk} dalla condizione impostata da OpenVMS, si usi:
@example
unix_status = (vms_status .and. %x7f8) / 8
@@ -47362,20 +47960,8 @@ unix_status = (vms_status .and. %x7f8) / 8
Un programma C che usa @code{exec()} per chiamare @command{gawk}
ricever@`a il valore originale della exit in stile Unix.
-Precedenti versioni di @command{gawk} per VMS consideravano un
-codice di ritorno a Unix di 0 come 1, un errore come 2,
-un errore fatale come 4, e tutti
-gli altri valori erano restituiti immodificati. Questa era una violazione
-rispetto alle specifiche di codifica delle condizioni di uscita di VMS.
-
-@cindex numeri @subentry in virgola mobile @subentry VAX/VMS
-@cindex VAX/VMS @subentry numeri in virgola mobile,
-L'aritmetica in virgola mobile VAX/VMS usa un arrotondamento statistico.
-@xref{Funzione round}.
-
-VMS restituisce data e ora in formato GMT, a meno che non siano stati impostati
-i nomi logici @code{SYS$TIMEZONE_RULE} o @code{TZ}. Precedenti versioni di
-VMS, come VAX/VMS 7.3, non impostano questi nomi logici.
+OpenVMS restituisce data e ora in formato GMT, a meno che non siano stati impostati
+i nomi logici @code{SYS$TIMEZONE_RULE} o @code{TZ}.
@cindex percorso di ricerca
@cindex percorso di ricerca @subentry per file sorgente
@@ -47389,24 +47975,24 @@ di directory, separate da virgola. Nel definirla, il valore dovrebbe essere
incluso tra doppi apici, in modo che consenta una sola traduzione, e non una
lista di ricerca multitraduzione @code{RMS}.
-@cindex ridirezione in VMS
+@cindex ridirezione in OpenVMS
Questa restrizione vale anche se si esegue @command{gawk} sotto GNV,
in quanto la ridirezione @`e sempre verso un comando DCL.
-Se si ridirigono dati verso un comando o un programma di utilit@`a VMS,
-l'implementazione corrente richiede la creazione di un comando VMS esterno che
+Se si ridirigono dati verso un comando o un programma di utilit@`a OpenVMS,
+l'implementazione corrente richiede la creazione di un comando OpenVMS esterno che
esegua un file di comandi, prima di invocare @command{gawk}.
(Questa restrizione potrebbe essere rimossa in una futura versione di
-@command{gawk} per VMS.)
+@command{gawk} su OpenVMS.)
Senza un tale file di comandi, i dati in input saranno presenti anche
in output, prima dei dati di output veri e propri.
-Ci@`o consente la simulazione di comandi POSIX non disponibili in VMS
+Ci@`o consente la simulazione di comandi POSIX non disponibili in OpenVMS
o l'uso di programmi di utilit@`a GNV.
L'esempio seguente mostra come ridirigere dati da @command{gawk} verso il
-comando VMS @command{sort}.
+comando OpenVMS @command{sort}.
@example
$ sort = "@@device:[dir]vms_gawk_sort.com"
@@ -47434,10 +48020,10 @@ $ define/user sys$input sys$command:
$ sort sys$input: sys$output:
@end example
-@node GNV su VMS
-@appendixsubsubsec Il progetto VMS GNV
+@node GNV su OpenVMS
+@appendixsubsubsec Il progetto GNV su OpenVMS
-Il pacchetto VMS GNV fornisce un ambiente di sviluppo simile
+Il pacchetto OpenVMS GNV fornisce un ambiente di sviluppo simile
a POSIX tramite una collezione di strumenti @dfn{open source}.
Il @command{gawk} presente nel pacchetto base GNV @`e una vecchia versione.
Attualmente, il progetto GNV @`e in fase di riorganizzazione, con l'obiettivo
@@ -47448,7 +48034,7 @@ La procedura normale per compilare @command{gawk} produce un programma
adatto a essere usato con GNV.
Il file @file{vms/gawk_build_steps.txt} nella distribuzione documenta
-la procedura per compilare un pacchetto PCSI compatible con GNV.
+la procedura per compilare un pacchetto PCSI OpenVMS compatible con GNV.
@node Bug
@appendixsec Segnalazione di problemi e bug
@@ -47952,7 +48538,7 @@ Le persone che si occupano delle varie versioni di @command{gawk} sono:
@item MS-Windows con MinGW @tab Eli Zaretskii, @EMAIL{eliz@@gnu.org,eliz (chiocciola) gnu (punto) org}
-@item VMS @tab John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw (chiocciola) qsl (punto) net}
+@item OpenVMS @tab John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw (chiocciola) qsl (punto) net}
@item z/OS (OS/390) @tab Daniel Richard G.@: @EMAIL{skunk@@iSKUNK.ORG,skunk (chiocciola) iSKUNK (punto) ORG}
@end multitable
@@ -48020,7 +48606,7 @@ Brian Kernighan, uno degli sviluppatori originali di Unix @command{awk},
ha reso disponibile liberamente la sua implementazione di @command{awk}.
Pu@`o essere scaricata da GitHub:
@example
-git clone git://github.com/onetrueawk/awk bwkawk
+git clone https://github.com/onetrueawk/awk bwkawk
@end example
@noindent
@@ -48043,7 +48629,7 @@ POSIX @command{awk}.
Incidentalmente, Dan Bornstein ha creato un deposito Git che contiene tutte le
versioni di BWK @command{awk} che @`e riuscito a trovare. @`E disponibile in
-@uref{git://github.com/danfuzz/one-true-awk}.
+@uref{https://github.com/danfuzz/one-true-awk}.
@cindex Brennan, Michael
@cindex @command{mawk} (programma di utilit@`a)
@@ -48248,6 +48834,21 @@ Questo @`e un modulo Python che intende introdurre funzionalit@`a di tipo
ulteriori informazioni. (Questo programma non @`e correlato con la versione
modificata da Nelson Beebe di BWK @command{awk}, descritta prima.)
+@cindex Ramming, J.@: Christopher
+@cindex @command{awkcc}, @subentry traduttore da @command{awk} a C
+@cindex compilatore per @command{awk} @subentry @command{awkcc}
+@cindex sorgente @subentry codice @subentry @command{awkcc}
+@cindex codice sorgente @subentry @command{awkcc}
+@item @command{awkcc}
+Questo @`e un adattamento di una versione Unix di @command{awk}
+che traduce script @command{awk} in programmi C.
+@`E stato scritto da J.@: Christopher Ramming nei Bell Labs,
+attorno al 1988.
+@`E disponibile in @uref{https://github.com/nokia/awkcc}.
+Aggiornare questo programma per renderlo applicabile
+alle versioni pi@`u recenti di @command{gawk} sarebbe
+un interessante esercizio di ingegneria del software.
+
@item @w{QSE @command{awk}}
@cindex QSE @command{awk}
@cindex codice sorgente @subentry QSE @command{awk}
@@ -48311,7 +48912,7 @@ per poter scaricare il file.
@command{gawk} pu@`o essere installato anche su sistemi non-POSIX. I sistemi
correntemente supportati sono MS-Windows, usando
MSYS, MSYS2, MinGW e Cygwin,
-e sia Vax/VMS che OpenVMS. Le istruzioni per ognuno di questi sistemi sono
+e OpenVMS. Le istruzioni per ognuno di questi sistemi sono
incluse in
@ifnotinfo
questa
@@ -48454,7 +49055,10 @@ ugualmente al deposito usando il comando:
git clone http://git.savannah.gnu.org/r/gawk.git
@end example
-Una volta modificato il sorgente, @`e posibile usare @samp{git diff} per
+@noindent
+(Utilizzare un URL di tipo @code{https} @`e ritenuto pi@`u sicuro.)
+
+Una volta modificato il sorgente, @`e possibile usare @samp{git diff} per
produrre una @dfn{patch}, e spedirla al manutentore di @command{gawk}; si veda
@ref{Bug}, per come farlo.
@@ -48852,11 +49456,11 @@ solo scaricare una data versione e provarla?
Il manutentore di @command{gawk} desidera che per tutti gli utenti
@command{awk} interessati sia possibile limitarsi a clonare il deposito sul
-proprio computer, selezionare la variante che lo interessa e costruirla. Senza
+proprio computer, selezionare la variante che lo interessa e costruirla, senza
doversi preoccupare di avere a disposizione le versioni corrette degli Autotool
GNU.@footnote{Ecco un programma GNU che (secondo noi) @`e estremamente difficile
da estrarre dal deposito Git e compilare. Per esempio, in un vecchio (ma
-ancora funzionante) PowerPC Macintosh, con il sistema operativo Mac Os X 10.5,
+ancora funzionante) PowerPC Macintosh, con il sistema operativo macOs 10.5,
@`e stato necessario scaricare e compilare una tonnellata di software,
incominciando dallo stesso programma Git, per riuscire a lavorare con l'ultima
versione del codice. Non @`e un'esperienza piacevole e, specie sui vecchi
@@ -49428,10 +50032,10 @@ Si veda la @inlineraw{docbook, <xref linkend="figura-generica-flusso"/>}.
@float Figura,figura-generica-flusso
@caption{Flusso generico di un programma}
@ifclear SMALLPRINT
-@center @image{programma-generico, , , Flusso generico di un programma}
+@center @image{gawk-programma-generico, , , Flusso generico di un programma}
@end ifclear
@ifset SMALLPRINT
-@center @image{programma-generico, 11cm, , Flusso generico di un programma}
+@center @image{gawk-programma-generico, 11cm, , Flusso generico di un programma}
@end ifset
@end float
@end ifnotdocbook
@@ -49440,7 +50044,7 @@ Si veda la @inlineraw{docbook, <xref linkend="figura-generica-flusso"/>}.
<figure id="figura-generica-flusso" float="0">
<title>Flusso generico di un programma</title>
<mediaobject>
-<imageobject role="web"><imagedata fileref="programma-generico.png" format="PNG"/></imageobject>
+<imageobject role="web"><imagedata fileref="gawk-programma-generico.png" format="PNG"/></imageobject>
</mediaobject>
</figure>
@end docbook
@@ -49478,10 +50082,10 @@ come si vede nella @inlineraw{docbook, <xref linkend="figura-flusso-elaborazione
@float Figura,figura-flusso-elaborazione
@caption{Fasi di un programma generico}
@ifclear SMALLPRINT
-@center @image{flusso-elaborazione, , , Fasi di un programma generico}
+@center @image{gawk-flusso-elaborazione, , , Fasi di un programma generico}
@end ifclear
@ifset SMALLPRINT
-@center @image{flusso-elaborazione, 11cm , , Fasi di un programma generico}
+@center @image{gawk-flusso-elaborazione, 11cm , , Fasi di un programma generico}
@end ifset
@end float
@end ifnotdocbook
@@ -49490,7 +50094,7 @@ come si vede nella @inlineraw{docbook, <xref linkend="figura-flusso-elaborazione
<figura id="figura-flusso-elaborazione" float="0">
<title>Fasi di un programma generico</title>
<mediaobject>
-<imageobject role="web"><imagedata fileref="flusso-elaborazione.png" format="PNG"/></imageobject>
+<imageobject role="web"><imagedata fileref="gawk-flusso-elaborazione.png" format="PNG"/></imageobject>
</mediaobject>
</figure>
@end docbook
@@ -51078,7 +51682,7 @@ termini della sezione 6d.
@end enumerate
Una porzione separabile del codice oggetto, il cui sorgente @`e escluso dal
-Sorgente Corrispondente e trattato come Libreria di Sistema, non deve essere
+Sorgente Corrispondente e trattato come Libreria di Sistema, non dev'essere
obbligatoriamente inclusa nella distribuzione del codice oggetto del
programma.
@@ -51111,7 +51715,7 @@ distribuzione avviene come parte di una transazione nella quale il diritto di
possesso e di uso del Prodotto Utente viene trasferito al destinatario per
sempre o per un periodo prefissato (indipendentemente da come la transazione
sia caratterizzata), il Sorgente Corrispondente distribuito secondo le
-condizioni di questa sezione deve essere accompagnato dalle Informazioni di
+condizioni di questa sezione dev'essere accompagnato dalle Informazioni di
Installazione. Questa condizione non @`e richiesta se n@`e tu n@`e una terza parte
ha la possibilit@`a di installare versioni modificate del codice oggetto sul
Prodotto Utente (per esempio, se il programma @`e installato su una ROM)
@@ -51627,7 +52231,7 @@ codificata in un formato le cui specifiche sono disponibili pubblicamente,
tale che il suo contenuto possa essere modificato in modo semplice con
generici editor di testi o (per immagini composte da pixel) con generici
editor di immagini o (per i disegni) con qualche editor di disegni
-ampiamente diffuso; la copia deve essere adatta al trattamento per la
+ampiamente diffuso; la copia dev'essere adatta al trattamento per la
formattazione o per la conversione in una variet@`a di formati atti alla
successiva formattazione. Una copia fatta in un formato di file, per il
resto trasparente, i cui marcatori o assenza di tali sono stati progettati
diff --git a/doc/it/gendocs.sh b/doc/it/gendocs.sh
index 1872de9d..11969c65 100755
--- a/doc/it/gendocs.sh
+++ b/doc/it/gendocs.sh
@@ -2,13 +2,13 @@
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
-scriptversion=2021-01-01.00
+scriptversion=2022-10-25.23
-# Copyright 2003-2021 Free Software Foundation, Inc.
+# Copyright 2003-2022 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@@ -40,15 +40,15 @@ srcdir=`pwd`
scripturl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh"
templateurl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template"
-: ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="}
-: ${MAKEINFO="makeinfo"}
-: ${TEXI2DVI="texi2dvi"}
-: ${DOCBOOK2HTML="docbook2html"}
-: ${DOCBOOK2PDF="docbook2pdf"}
-: ${DOCBOOK2TXT="docbook2txt"}
-: ${GENDOCS_TEMPLATE_DIR="."}
-: ${PERL='perl'}
-: ${TEXI2HTML="texi2html"}
+: "${SETLANG="env LANG= LC_TIME= LC_MESSAGES= LC_ALL= LANGUAGE="}"
+: "${MAKEINFO="makeinfo"}"
+: "${TEXI2DVI="texi2dvi"}"
+: "${DOCBOOK2HTML="docbook2html"}"
+: "${DOCBOOK2PDF="docbook2pdf"}"
+: "${DOCBOOK2TXT="docbook2txt"}"
+: "${GENDOCS_TEMPLATE_DIR="."}"
+: "${PERL="perl"}"
+: "${TEXI2HTML="texi2html"}"
unset CDPATH
unset use_texi2html
@@ -58,7 +58,7 @@ EMAIL=webmasters@gnu.org # please override with --email
commonarg= # passed to all makeinfo/texi2html invcations.
dirargs= # passed to all tools (-I dir).
dirs= # -I directories.
-htmlarg="--css-ref=/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
+htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
default_htmlarg=true
infoarg=--no-split
generate_ascii=true
@@ -72,22 +72,18 @@ srcfile=
texarg="-t @finalout"
version="gendocs.sh $scriptversion
-
-Copyright 2021 Free Software Foundation, Inc.
+Copyright 2022 Free Software Foundation, Inc.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING."
usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE
-
Generate output in various formats from PACKAGE.texinfo (or .texi or
.txi) source. See the GNU Maintainers document for a more extensive
discussion:
https://www.gnu.org/prep/maintain_toc.html
-
Options:
--email ADR use ADR as contact in generated web pages; always give this.
-
-s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
-o OUTDIR write files into OUTDIR, instead of manual/.
-I DIR append DIR to the Texinfo search path.
@@ -102,57 +98,44 @@ Options:
--source ARG include ARG in tar archive of sources.
--split HOW make split HTML by node, section, chapter; default node.
--tex ARG pass ARG to texi2dvi for DVI and PDF, instead of -t @finalout.
-
--texi2html use texi2html to make HTML target, with all split versions.
--docbook convert through DocBook too (xml, txt, html, pdf).
-
--help display this help and exit successfully.
--version display version information and exit successfully.
-
Simple example: $prog --email bug-gnu-emacs@gnu.org emacs \"GNU Emacs Manual\"
-
Typical sequence:
cd PACKAGESOURCE/doc
wget \"$scripturl\"
wget \"$templateurl\"
$prog --email BUGLIST MANUAL \"GNU MANUAL - One-line description\"
-
Output will be in a new subdirectory \"manual\" (by default;
use -o OUTDIR to override). Move all the new files into your web CVS
tree, as explained in the Web Pages node of maintain.texi.
-
Please use the --email ADDRESS option so your own bug-reporting
address will be used in the generated HTML pages.
-
MANUAL-TITLE is included as part of the HTML <title> of the overall
manual/index.html file. It should include the name of the package being
documented. manual/index.html is created by substitution from the file
$GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the
generic template for your own purposes.)
-
If you have several manuals, you'll need to run this script several
times with different MANUAL values, specifying a different output
directory with -o each time. Then write (by hand) an overall index.html
with links to them all.
-
If a manual's Texinfo sources are spread across several directories,
first copy or symlink all Texinfo sources into a single directory.
(Part of the script's work is to make a tar.gz of the sources.)
-
As implied above, by default monolithic Info files are generated.
If you want split Info, or other Info options, use --info to override.
-
You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML,
and PERL to control the programs that get executed, and
GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is
looked for. With --docbook, the environment variables DOCBOOK2HTML,
DOCBOOK2PDF, and DOCBOOK2TXT are also consulted.
-
By default, makeinfo and texi2dvi are run in the default (English)
locale, since that's the language of most Texinfo manuals. If you
happen to have a non-English manual and non-English web site, see the
SETLANG setting in the source.
-
Email bug reports or enhancement requests to bug-gnulib@gnu.org.
"
@@ -202,7 +185,7 @@ base=$PACKAGE
if $default_htmlarg && test -n "$use_texi2html"; then
# The legacy texi2html doesn't support TOP_NODE_UP_URL
- htmlarg="--css-ref=/software/gnulib/manual.css"
+ htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css"
fi
if test -n "$srcfile"; then
@@ -254,7 +237,6 @@ BEGIN {
}
" -e '
/<img src="(.*?)"/g && ++$need{$1};
-
END {
#print "$me: @{[keys %need]}\n"; # for debugging, show images found.
FILE: for my $f (keys %need) {
@@ -288,7 +270,7 @@ echo "Making output for $srcfile"
echo " in `pwd`"
mkdir -p "$outdir/"
-#
+# ␌
if $generate_info; then
cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\""
echo "Generating info... ($cmd)"
@@ -301,10 +283,10 @@ if $generate_info; then
# separately on the web.
fi # end info
-#
+# ␌
if $generate_tex; then
cmd="$SETLANG $TEXI2DVI $dirargs $texarg \"$srcfile\""
- printf "\nGenerating dvi... ($cmd)\n"
+ printf "\nGenerating dvi... (%s)\n" "$cmd"
eval "$cmd"
# compress/finish dvi:
gzip -f -9 $PACKAGE.dvi
@@ -313,18 +295,18 @@ if $generate_tex; then
ls -l "$outdir/$PACKAGE.dvi.gz"
cmd="$SETLANG $TEXI2DVI --pdf $dirargs $texarg \"$srcfile\""
- printf "\nGenerating pdf... ($cmd)\n"
+ printf "\nGenerating pdf... (%s)\n" "$cmd"
eval "$cmd"
pdf_size=`calcsize $PACKAGE.pdf`
mv $PACKAGE.pdf "$outdir/"
ls -l "$outdir/$PACKAGE.pdf"
fi # end tex (dvi + pdf)
-#
+# ␌
if $generate_ascii; then
opt="-o $PACKAGE.txt --no-split --no-headers $commonarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
- printf "\nGenerating ascii... ($cmd)\n"
+ printf "\nGenerating ascii... (%s)\n" "$cmd"
eval "$cmd"
ascii_size=`calcsize $PACKAGE.txt`
gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
@@ -333,7 +315,7 @@ if $generate_ascii; then
ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz"
fi
-#
+# ␌
if $generate_html; then
# Split HTML at level $1. Used for texi2html.
@@ -341,7 +323,7 @@ html_split()
{
opt="--split=$1 --node-files $commonarg $htmlarg"
cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\""
- printf "\nGenerating html by $1... ($cmd)\n"
+ printf "\nGenerating html by %s... (%s)\n" "$1" "$cmd"
eval "$cmd"
split_html_dir=$PACKAGE.html
(
@@ -359,7 +341,7 @@ html_split()
if test -z "$use_texi2html"; then
opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
- printf "\nGenerating monolithic html... ($cmd)\n"
+ printf "\nGenerating monolithic html... (%s)\n" "$cmd"
rm -rf $PACKAGE.html # in case a directory is left over
eval "$cmd"
html_mono_size=`calcsize $PACKAGE.html`
@@ -380,7 +362,7 @@ if test -z "$use_texi2html"; then
#
opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
- printf "\nGenerating html by $split... ($cmd)\n"
+ printf "\nGenerating html by %s... (%s)\n" "$split" "$cmd"
eval "$cmd"
split_html_dir=$PACKAGE.html
copy_images $split_html_dir/ $split_html_dir/*.html
@@ -398,7 +380,7 @@ if test -z "$use_texi2html"; then
else # use texi2html:
opt="--output $PACKAGE.html $commonarg $htmlarg"
cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\""
- printf "\nGenerating monolithic html with texi2html... ($cmd)\n"
+ printf "\nGenerating monolithic html with texi2html... (%s)\n" "$cmd"
rm -rf $PACKAGE.html # in case a directory is left over
eval "$cmd"
html_mono_size=`calcsize $PACKAGE.html`
@@ -412,7 +394,7 @@ else # use texi2html:
fi
fi # end html
-#
+# ␌
printf "\nMaking .tar.gz for sources...\n"
d=`dirname $srcfile`
(
@@ -423,12 +405,12 @@ d=`dirname $srcfile`
)
texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
-#
+# ␌
# Do everything again through docbook.
if test -n "$docbook"; then
opt="-o - --docbook $commonarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml"
- printf "\nGenerating docbook XML... ($cmd)\n"
+ printf "\nGenerating docbook XML... (%s)\n" "$cmd"
eval "$cmd"
docbook_xml_size=`calcsize $PACKAGE-db.xml`
gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
@@ -438,7 +420,7 @@ if test -n "$docbook"; then
split_html_db_dir=html_node_db
opt="$commonarg -o $split_html_db_dir"
cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\""
- printf "\nGenerating docbook HTML... ($cmd)\n"
+ printf "\nGenerating docbook HTML... (%s)\n" "$cmd"
eval "$cmd"
(
cd ${split_html_db_dir} || exit 1
@@ -451,20 +433,20 @@ if test -n "$docbook"; then
rmdir ${split_html_db_dir}
cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\""
- printf "\nGenerating docbook ASCII... ($cmd)\n"
+ printf "\nGenerating docbook ASCII... (%s)\n" "$cmd"
eval "$cmd"
docbook_ascii_size=`calcsize $PACKAGE-db.txt`
mv $PACKAGE-db.txt "$outdir/"
cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\""
- printf "\nGenerating docbook PDF... ($cmd)\n"
+ printf "\nGenerating docbook PDF... (%s)\n" "$cmd"
eval "$cmd"
docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
mv $PACKAGE-db.pdf "$outdir/"
fi
-#
-printf "\nMaking index.html for $PACKAGE...\n"
+# ␌
+printf "\nMaking index.html for %s...\n" "$PACKAGE"
if test -z "$use_texi2html"; then
CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\
/%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d"
diff --git a/doc/it/pm-gawk.1 b/doc/it/pm-gawk.1
index 631bad47..5e40f1d3 100644..100755
--- a/doc/it/pm-gawk.1
+++ b/doc/it/pm-gawk.1
@@ -2,7 +2,7 @@
.\"Traduzione per la versione gawk-5.2.0 di A.G. Colombo - 12 Agosto 2022
.\"Aggiornamento per la versione gawk-5.2.0 di A.G. Colombo - 14 Agosto 2022
.ds PM \fIManuale utente funzionalità Memoria Persistente in gawk\fP
-.TH PM-GAWK 1 "14 agosto 2022" "Free Software Foundation" "Comandi di utilità"
+.TH PM-GAWK 1 "17 novembre 2022" "Free Software Foundation" "Comandi di utilità"
.SH NOME
gawk con memoria persistente \- dati e funzioni persistenti
.SH SINTASSI
@@ -165,6 +165,11 @@ con memoria persistente è stata sviluppata da
Haris Volos, Zi Fan Tan e Jianan Li
a partire da una diramazione della distribuzione sorgente di
.I gawk .
+.SH AVVERTIMENTI
+Il filesysten CIFS in ambiente GNU/Linux crea dei problemi
+all'allocatore di memoria persistente. Evitare quindi di
+usare un file di appoggio che risieda su un tale filesystem con
+.IR pm-gawk .
.SH SEGNALAZIONE DI ERRORI
Seguire le procedure descritte in \*(EP e in \*(PM.
Se si ritiene che gli errori siano legati alla
diff --git a/doc/it/texinfo.tex b/doc/it/texinfo.tex
index 46e22690..795e85da 100644..100755
--- a/doc/it/texinfo.tex
+++ b/doc/it/texinfo.tex
@@ -3,9 +3,9 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2022-04-09.08}
+\def\texinfoversion{2023-03-21.06}
%
-% Copyright 1985, 1986, 1988, 1990-2022 Free Software Foundation, Inc.
+% Copyright 1985, 1986, 1988, 1990-2023 Free Software Foundation, Inc.
%
% This texinfo.tex file is free software: you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
@@ -58,12 +58,6 @@
\message{Loading texinfo [version \texinfoversion]:}
-% If in a .fmt file, print the version number
-% and turn on active characters that we couldn't do earlier because
-% they might have appeared in the input file name.
-\everyjob{\message{[Texinfo version \texinfoversion]}%
- \catcode`+=\active \catcode`\_=\active}
-
% LaTeX's \typeout. This ensures that the messages it is used for
% are identical in format to the corresponding ones from latex/pdflatex.
\def\typeout{\immediate\write17}%
@@ -259,9 +253,6 @@
%
\def\finalout{\overfullrule=0pt }
-\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
-\newdimen\topandbottommargin \topandbottommargin=.75in
-
% Output a mark which sets \thischapter, \thissection and \thiscolor.
% We dump everything together because we only have one kind of mark.
% This works because we only use \botmark / \topmark, not \firstmark.
@@ -335,16 +326,8 @@
\newbox\footlinebox
% When outputting the double column layout for indices, an output routine
-% is run several times, which hides the original value of \topmark. This
-% can lead to a page heading being output and duplicating the chapter heading
-% of the index. Hence, save the contents of \topmark at the beginning of
-% the output routine. The saved contents are valid until we actually
-% \shipout a page.
-%
-% (We used to run a short output routine to actually set \topmark and
-% \firstmark to the right values, but if this was called with an empty page
-% containing whatsits for writing index entries, the whatsits would be thrown
-% away and the index auxiliary file would remain empty.)
+% is run several times, hiding the original value of \topmark. Hence, save
+% \topmark at the beginning.
%
\newtoks\savedtopmark
\newif\iftopmarksaved
@@ -369,15 +352,9 @@
%
\checkchapterpage
%
- % Retrieve the information for the headings from the marks in the page,
- % and call Plain TeX's \makeheadline and \makefootline, which use the
- % values in \headline and \footline.
- %
- % Common context changes for both heading and footing.
- % Do this outside of the \shipout so @code etc. will be expanded in
- % the headline as they should be, not taken literally (outputting ''code).
+ % Make the heading and footing. \makeheadline and \makefootline
+ % use the contents of \headline and \footline.
\def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
- %
\ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
\global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
\ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
@@ -565,7 +542,7 @@
% ... but they get defined via ``\envdef\foo{...}'':
\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
-\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
+\long\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
% Check whether we're in the right environment:
\def\checkenv#1{%
@@ -626,6 +603,9 @@
% @/ allows a line break.
\let\/=\allowbreak
+% @- allows explicit insertion of hyphenation points
+\def\-{\discretionary{\normaldash}{}{}}%
+
% @. is an end-of-sentence period.
\def\.{.\spacefactor=\endofsentencespacefactor\space}
@@ -635,21 +615,6 @@
% @? is an end-of-sentence query.
\def\?{?\spacefactor=\endofsentencespacefactor\space}
-% @frenchspacing on|off says whether to put extra space after punctuation.
-%
-\def\onword{on}
-\def\offword{off}
-%
-\parseargdef\frenchspacing{%
- \def\temp{#1}%
- \ifx\temp\onword \plainfrenchspacing
- \else\ifx\temp\offword \plainnonfrenchspacing
- \else
- \errhelp = \EMsimple
- \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
- \fi\fi
-}
-
% @w prevents a word break. Without the \leavevmode, @w at the
% beginning of a paragraph, when TeX is still in vertical mode, would
% produce a whole line of output instead of starting the paragraph.
@@ -743,32 +708,22 @@ where each line of input produces a line of output.}
\dimen2 = \ht\strutbox
\advance\dimen2 by \dp\strutbox
\ifdim\dimen0 > \dimen2
+ % This is similar to the 'needspace' module in LaTeX.
+ % The first penalty allows a break if the end of the page is
+ % not too far away. Following penalties and skips are discarded.
+ % Otherwise, require at least \dimen0 of vertical space.
%
- % Do a \strut just to make the height of this box be normal, so the
- % normal leading is inserted relative to the preceding line.
- % And a page break here is fine.
- \vtop to #1\mil{\strut\vfil}%
- %
- % TeX does not even consider page breaks if a penalty added to the
- % main vertical list is 10000 or more. But in order to see if the
- % empty box we just added fits on the page, we must make it consider
- % page breaks. On the other hand, we don't want to actually break the
- % page after the empty box. So we use a penalty of 9999.
- %
- % There is an extremely small chance that TeX will actually break the
- % page at this \penalty, if there are no other feasible breakpoints in
- % sight. (If the user is using lots of big @group commands, which
- % almost-but-not-quite fill up a page, TeX will have a hard time doing
- % good page breaking, for example.) However, I could not construct an
- % example where a page broke at this \penalty; if it happens in a real
- % document, then we can reconsider our strategy.
+ % (We used to use a \vtop to reserve space, but this had spacing issues
+ % when followed by a section heading, as it was not a "discardable item".
+ % This also has the benefit of providing glue before the page break if
+ % there isn't enough space.)
+ \vskip0pt plus \dimen0
+ \penalty-100
+ \vskip0pt plus -\dimen0
+ \vskip \dimen0
\penalty9999
- %
- % Back up by the size of the box, whether we did a page break or not.
- \kern -#1\mil
- %
- % Do not allow a page break right after this kern.
- \nobreak
+ \vskip -\dimen0
+ \penalty0\relax % this hides the above glue from \safewhatsit and \dobreak
\fi
}
@@ -1257,13 +1212,17 @@ output) for that.)}
%
% Set color, and create a mark which defines \thiscolor accordingly,
% so that \makeheadline knows which color to restore.
+ \def\curcolor{0 0 0}%
\def\setcolor#1{%
- \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
- \domark
- \pdfsetcolor{#1}%
+ \ifx#1\curcolor\else
+ \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
+ \domark
+ \pdfsetcolor{#1}%
+ \xdef\curcolor{#1}%
+ \fi
}
%
- \def\maincolor{\rgbBlack}
+ \let\maincolor\rgbBlack
\pdfsetcolor{\maincolor}
\edef\thiscolor{\maincolor}
\def\currentcolordefs{}
@@ -1419,7 +1378,7 @@ output) for that.)}
%
% by default, use black for everything.
\def\urlcolor{\rgbBlack}
- \def\linkcolor{\rgbBlack}
+ \let\linkcolor\rgbBlack
\def\endlink{\setcolor{\maincolor}\pdfendlink}
%
% Adding outlines to PDF; macros for calculating structure of outlines
@@ -1597,9 +1556,10 @@ output) for that.)}
\next}
\def\makelink{\addtokens{\toksB}%
{\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
- \def\pdflink#1{%
+ \def\pdflink#1{\pdflinkpage{#1}{#1}}%
+ \def\pdflinkpage#1#2{%
\startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
- \setcolor{\linkcolor}#1\endlink}
+ \setcolor{\linkcolor}#2\endlink}
\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
\else
% non-pdf mode
@@ -1846,10 +1806,11 @@ output) for that.)}
\next}
\def\makelink{\addtokens{\toksB}%
{\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
- \def\pdflink#1{%
+ \def\pdflink#1{\pdflinkpage{#1}{#1}}%
+ \def\pdflinkpage#1#2{%
\special{pdf:bann << /Border [0 0 0]
/Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
- \setcolor{\linkcolor}#1\endlink}
+ \setcolor{\linkcolor}#2\endlink}
\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
%
%
@@ -2194,6 +2155,11 @@ end
\pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
}%
\fi\fi
+%
+% This is what gets called when #5 of \setfont is empty.
+\let\cmap\gobble
+%
+% (end of cmaps)
% Set the font macro #1 to the font named \fontprefix#2.
@@ -2209,11 +2175,10 @@ end
\def\setfont#1#2#3#4#5{%
\font#1=\fontprefix#2#3 scaled #4
\csname cmap#5\endcsname#1%
+ \ifx#2\ttshape\hyphenchar#1=-1 \fi
+ \ifx#2\ttbshape\hyphenchar#1=-1 \fi
+ \ifx#2\ttslshape\hyphenchar#1=-1 \fi
}
-% This is what gets called when #5 of \setfont is empty.
-\let\cmap\gobble
-%
-% (end of cmaps)
% Use cm as the default font prefix.
% To specify the font prefix, you must define \fontprefix
@@ -2576,7 +2541,7 @@ end
\def\it{\fam=\itfam \setfontstyle{it}}
\def\sl{\fam=\slfam \setfontstyle{sl}}
\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
-\def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt}
+\def\tt{\fam=\ttfam \setfontstyle{tt}}
% Texinfo sort of supports the sans serif font style, which plain TeX does not.
% So we set up a \sf.
@@ -2604,34 +2569,30 @@ end
\scriptfont\sffam=\sevensf
}
-%
-% The font-changing commands (all called \...fonts) redefine the meanings
-% of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs
-% to also set the current \fam for math mode. Our \STYLE (e.g., \rm)
-% commands hardwire \STYLEfont to set the current font.
-%
-% The fonts used for \ifont are for "math italics" (\itfont is for italics
-% in regular text). \syfont is also used in math mode only.
-%
-% Each font-changing command also sets the names \lsize (one size lower)
-% and \lllsize (three sizes lower). These relative commands are used
-% in, e.g., the LaTeX logo and acronyms.
-%
-% This all needs generalizing, badly.
+
+% \defineassignfonts{SIZE} -
+% Define sequence \assignfontsSIZE, which switches between font sizes
+% by redefining the meanings of \STYLEfont. (Just \STYLE additionally sets
+% the current \fam for math mode.)
%
+\def\defineassignfonts#1{%
+ \expandafter\edef\csname assignfonts#1\endcsname{%
+ \let\noexpand\rmfont\csname #1rm\endcsname
+ \let\noexpand\itfont\csname #1it\endcsname
+ \let\noexpand\slfont\csname #1sl\endcsname
+ \let\noexpand\bffont\csname #1bf\endcsname
+ \let\noexpand\ttfont\csname #1tt\endcsname
+ \let\noexpand\smallcaps\csname #1sc\endcsname
+ \let\noexpand\sffont \csname #1sf\endcsname
+ \let\noexpand\ifont \csname #1i\endcsname
+ \let\noexpand\syfont \csname #1sy\endcsname
+ \let\noexpand\ttslfont\csname #1ttsl\endcsname
+ }
+}
\def\assignfonts#1{%
- \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
- \expandafter\let\expandafter\itfont\csname #1it\endcsname
- \expandafter\let\expandafter\slfont\csname #1sl\endcsname
- \expandafter\let\expandafter\bffont\csname #1bf\endcsname
- \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
- \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
- \expandafter\let\expandafter\sffont \csname #1sf\endcsname
- \expandafter\let\expandafter\ifont \csname #1i\endcsname
- \expandafter\let\expandafter\syfont \csname #1sy\endcsname
- \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
+ \csname assignfonts#1\endcsname
}
\newif\ifrmisbold
@@ -2655,12 +2616,21 @@ end
\csname\curfontstyle\endcsname
}%
+% Define the font-changing commands (all called \...fonts).
+% Each font-changing command also sets the names \lsize (one size lower)
+% and \lllsize (three sizes lower). These relative commands are used
+% in, e.g., the LaTeX logo and acronyms.
+%
+% Note: The fonts used for \ifont are for "math italics" (\itfont is for
+% italics in regular text). \syfont is also used in math mode only.
+%
\def\definefontsetatsize#1#2#3#4#5{%
+ \defineassignfonts{#1}%
\expandafter\def\csname #1fonts\endcsname{%
\def\curfontsize{#1}%
\def\lsize{#2}\def\lllsize{#3}%
\csname rmisbold#5\endcsname
- \assignfonts{#1}%
+ \csname assignfonts#1\endcsname
\resetmathfonts
\setleading{#4}%
}}
@@ -2705,9 +2675,22 @@ end
% Check if we are currently using a typewriter font. Since all the
% Computer Modern typewriter fonts have zero interword stretch (and
% shrink), and it is reasonable to expect all typewriter fonts to have
-% this property, we can check that font parameter.
-%
-\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
+% this property, we can check that font parameter. #1 is what to
+% print if we are indeed using \tt; #2 is what to print otherwise.
+\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
+
+% Same as above, but check for italic font. Actually this also catches
+% non-italic slanted fonts since it is impossible to distinguish them from
+% italic fonts. But since this is only used by $ and it uses \sl anyway
+% this is not a problem.
+\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
+
+
+% Check if internal flag is clear, i.e. has not been @set.
+\def\ifflagclear#1#2#3{%
+ \expandafter\ifx\csname SET#1\endcsname\relax
+ #2\else#3\fi
+}
{
\catcode`\'=\active
@@ -2716,41 +2699,33 @@ end
\gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
\gdef\setregularquotes{\let`\lq \let'\rq}
}
+\setregularquotes
-% Allow an option to not use regular directed right quote/apostrophe
-% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
-% The undirected quote is ugly, so don't make it the default, but it
-% works for pasting with more pdf viewers (at least evince), the
-% lilypond developers report. xpdf does work with the regular 0x27.
+% output for ' in @code
+% in tt font hex 0D (undirected) or 27 (curly right quote)
%
\def\codequoteright{%
- \ifmonospace
- \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
- \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
- '%
- \else \char'15 \fi
- \else \char'15 \fi
- \else
- '%
- \fi
+ \ifusingtt
+ {\ifflagclear{txicodequoteundirected}%
+ {\ifflagclear{codequoteundirected}%
+ {'}%
+ {\char"0D }}%
+ {\char"0D }}%
+ {'}%
}
-%
-% and a similar option for the left quote char vs. a grave accent.
-% Modern fonts display ASCII 0x60 as a grave accent, so some people like
-% the code environments to do likewise.
+
+% output for ` in @code
+% in tt font hex 12 (grave accent) or 60 (curly left quote)
+% \relax disables Spanish ligatures ?` and !` of \tt font.
%
\def\codequoteleft{%
- \ifmonospace
- \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
- \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
- % [Knuth] pp. 380,381,391
- % \relax disables Spanish ligatures ?` and !` of \tt font.
- \relax`%
- \else \char'22 \fi
- \else \char'22 \fi
- \else
- \relax`%
- \fi
+ \ifusingtt
+ {\ifflagclear{txicodequotebacktick}%
+ {\ifflagclear{codequotebacktick}%
+ {\relax`}%
+ {\char"12 }}%
+ {\char"12 }}%
+ {\relax`}%
}
% Commands to set the quote options.
@@ -2768,7 +2743,7 @@ end
\errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
\fi\fi
}
-%
+
\parseargdef\codequotebacktick{%
\def\temp{#1}%
\ifx\temp\onword
@@ -2783,6 +2758,11 @@ end
\fi\fi
}
+% Turn them on by default
+\let\SETtxicodequoteundirected = t
+\let\SETtxicodequotebacktick = t
+
+
% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
\def\noligaturesquoteleft{\relax\lq}
@@ -2797,15 +2777,16 @@ end
\def\dosmartslant#1#2{%
\ifusingtt
{{\ttsl #2}\let\next=\relax}%
- {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
+ {\def\next{{#1#2}\smartitaliccorrection}}%
\next
}
\def\smartslanted{\dosmartslant\sl}
\def\smartitalic{\dosmartslant\it}
-% Output an italic correction unless \next (presumed to be the following
-% character) is such as not to need one.
-\def\smartitaliccorrection{%
+% Output an italic correction unless the following character is such as
+% not to need one.
+\def\smartitaliccorrection{\futurelet\next\smartitaliccorrectionx}
+\def\smartitaliccorrectionx{%
\ifx\next,%
\else\ifx\next-%
\else\ifx\next.%
@@ -2816,27 +2797,41 @@ end
\aftersmartic
}
-% Unconditional use \ttsl, and no ic. @var is set to this for defuns.
-\def\ttslanted#1{{\ttsl #1}}
-
-% @cite is like \smartslanted except unconditionally use \sl. We never want
-% ttsl for book titles, do we?
-\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
+% @cite unconditionally uses \sl with \smartitaliccorrection.
+\def\cite#1{{\sl #1}\smartitaliccorrection}
+% @var unconditionally uses \sl. This gives consistency for
+% parameter names whether they are in @def, @table @code or a
+% regular paragraph.
+% To get ttsl font for @var when used in code context, @set txicodevaristt.
+% The \null is to reset \spacefactor.
\def\aftersmartic{}
\def\var#1{%
\let\saveaftersmartic = \aftersmartic
\def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
- \smartslanted{#1}%
+ %
+ \ifflagclear{txicodevaristt}%
+ {\def\varnext{{{\sl #1}}\smartitaliccorrection}}%
+ {\def\varnext{\smartslanted{#1}}}%
+ \varnext
}
+% To be removed after next release
+\def\SETtxicodevaristt{}% @set txicodevaristt
+
\let\i=\smartitalic
\let\slanted=\smartslanted
\let\dfn=\smartslanted
\let\emph=\smartitalic
-% Explicit font changes: @r, @sc, undocumented @ii.
-\def\r#1{{\rm #1}} % roman font
+% @r for roman font, used for code comment
+\def\r#1{{%
+ \usenormaldash % get --, --- ligatures even if in @code
+ \defcharsdefault % in case on def line
+ \rm #1}}
+{\catcode`-=\active \gdef\usenormaldash{\let-\normaldash}}
+
+% @sc, undocumented @ii.
\def\sc#1{{\smallcaps#1}} % smallcaps font
\def\ii#1{{\it #1}} % italic font
@@ -2847,12 +2842,8 @@ end
% @sansserif, explicit sans.
\def\sansserif#1{{\sf #1}}
-% We can't just use \exhyphenpenalty, because that only has effect at
-% the end of a paragraph. Restore normal hyphenation at the end of the
-% group within which \nohyphenation is presumably called.
-%
-\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
-\def\restorehyphenation{\hyphenchar\font = `- }
+\newif\iffrenchspacing
+\frenchspacingfalse
% Set sfcode to normal for the chars that usually have another value.
% Can't use plain's \frenchspacing because it uses the `\x notation, and
@@ -2860,21 +2851,45 @@ end
%
\catcode`@=11
\def\plainfrenchspacing{%
- \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
- \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
- \def\endofsentencespacefactor{1000}% for @. and friends
+ \iffrenchspacing\else
+ \frenchspacingtrue
+ \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
+ \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
+ \def\endofsentencespacefactor{1000}% for @. and friends
+ \fi
}
\def\plainnonfrenchspacing{%
- \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
- \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
- \def\endofsentencespacefactor{3000}% for @. and friends
+ \iffrenchspacing
+ \frenchspacingfalse
+ \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
+ \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
+ \def\endofsentencespacefactor{3000}% for @. and friends
+ \fi
}
\catcode`@=\other
\def\endofsentencespacefactor{3000}% default
+% @frenchspacing on|off says whether to put extra space after punctuation.
+%
+\def\onword{on}
+\def\offword{off}
+%
+\let\frenchspacingsetting\plainnonfrenchspacing % used in output routine
+\parseargdef\frenchspacing{%
+ \def\temp{#1}%
+ \ifx\temp\onword \let\frenchspacingsetting\plainfrenchspacing
+ \else\ifx\temp\offword \let\frenchspacingsetting\plainnonfrenchspacing
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
+ \fi\fi
+ \frenchspacingsetting
+}
+
+
% @t, explicit typewriter.
\def\t#1{%
- {\tt \plainfrenchspacing #1}%
+ {\tt \defcharsdefault \plainfrenchspacing #1}%
\null
}
@@ -2895,27 +2910,29 @@ end
% Switch to typewriter.
\tt
%
- % But `\ ' produces the large typewriter interword space.
+ % `\ ' produces the large typewriter interword space.
\def\ {{\spaceskip = 0pt{} }}%
%
- % Turn off hyphenation.
- \nohyphenation
- %
\plainfrenchspacing
#1%
}%
\null % reset spacefactor to 1000
}
-% We *must* turn on hyphenation at `-' and `_' in @code.
-% (But see \codedashfinish below.)
+% This is for LuaTeX: It is not sufficient to disable hyphenation at
+% explicit dashes by setting `\hyphenchar` to -1.
+\def\dashnobreak{%
+ \normaldash
+ \penalty 10000 }
+
+% We must turn on hyphenation at `-' and `_' in @code.
% Otherwise, it is too hard to avoid overfull hboxes
% in the Emacs manual, the Library manual, etc.
+% We explicitly allow hyphenation at these characters
+% using \discretionary.
%
-% Unfortunately, TeX uses one parameter (\hyphenchar) to control
-% both hyphenation at - and hyphenation within words.
-% We must therefore turn them both off (\tclose does that)
-% and arrange explicitly to hyphenate at a dash. -- rms.
+% Hyphenation at - and hyphenation within words was turned off
+% by default for the tt fonts using the \hyphenchar parameter of TeX.
{
\catcode`\-=\active \catcode`\_=\active
\catcode`\'=\active \catcode`\`=\active
@@ -2928,13 +2945,9 @@ end
\let-\codedash
\let_\codeunder
\else
- \let-\normaldash
+ \let-\dashnobreak
\let_\realunder
\fi
- % Given -foo (with a single dash), we do not want to allow a break
- % after the hyphen.
- \global\let\codedashprev=\codedash
- %
\codex
}
%
@@ -2944,21 +2957,30 @@ end
%
% Now, output a discretionary to allow a line break, unless
% (a) the next character is a -, or
- % (b) the preceding character is a -.
+ % (b) the preceding character is a -, or
+ % (c) we are at the start of the string.
+ % In both cases (b) and (c), \codedashnobreak should be set to \codedash.
+ %
% E.g., given --posix, we do not want to allow a break after either -.
% Given --foo-bar, we do want to allow a break between the - and the b.
\ifx\next\codedash \else
- \ifx\codedashprev\codedash
+ \ifx\codedashnobreak\codedash
\else \discretionary{}{}{}\fi
\fi
% we need the space after the = for the case when \next itself is a
% space token; it would get swallowed otherwise. As in @code{- a}.
- \global\let\codedashprev= \next
+ \global\let\codedashnobreak= \next
}
}
\def\normaldash{-}
%
-\def\codex #1{\tclose{#1}\endgroup}
+\def\codex #1{\tclose{%
+ % Given -foo (with a single dash), we do not want to allow a break
+ % after the -. \codedashnobreak is set to the first character in
+ % @code.
+ \futurelet\codedashnobreak\relax
+ #1%
+}\endgroup}
\def\codeunder{%
% this is all so @math{@code{var_name}+1} can work. In math mode, _
@@ -3205,7 +3227,7 @@ end
% definition of @key with no lozenge.
%
-\def\key#1{{\setregularquotes \nohyphenation \tt #1}\null}
+\def\key#1{{\setregularquotes \tt #1}\null}
% @clicksequence{File @click{} Open ...}
\def\clicksequence#1{\begingroup #1\endgroup}
@@ -3408,8 +3430,8 @@ $$%
\let\atchar=\@
% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
-\def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
-\def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
+\def\lbracechar{{\ifusingtt{\char123}{\ensuremath\lbrace}}}
+\def\rbracechar{{\ifusingtt{\char125}{\ensuremath\rbrace}}}
\let\{=\lbracechar
\let\}=\rbracechar
@@ -3463,8 +3485,13 @@ $$%
% Revert to plain's \scriptsize, which is 7pt.
\count255=\the\fam $\fam\count255 \scriptstyle A$%
\else
- % For 11pt, we can use our lllsize.
- \switchtolllsize A%
+ \ifx\curfontsize\smallword
+ % For footnotes and indices
+ \count255=\the\fam $\fam\count255 \scriptstyle A$%
+ \else
+ % For 11pt, we can use our lllsize.
+ \switchtolllsize A%
+ \fi
\fi
}%
\vss
@@ -3472,6 +3499,7 @@ $$%
\kern-.15em
\TeX
}
+\def\smallword{small}
% Some math mode symbols. Define \ensuremath to switch into math mode
% unless we are already there. Expansion tricks may not be needed here,
@@ -3550,7 +3578,7 @@ $$%
% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
%
-\def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi}
+\def\pounds{{\ifusingtt{\ecfont\char"BF}{\it\$}}}
% @euro{} comes from a separate font, depending on the current style.
% We use the free feym* fonts from the eurosym package by Henrik
@@ -3664,18 +3692,17 @@ $$%
% hopefully nobody will notice/care.
\edef\ecsize{\csname\curfontsize ecsize\endcsname}%
\edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
- \ifmonospace
- % typewriter:
- \font\thisecfont = #1ctt\ecsize \space at \nominalsize
- \else
- \ifx\curfontstyle\bfstylename
- % bold:
- \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
- \else
- % regular:
- \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
- \fi
- \fi
+ \ifusingtt
+ % typewriter:
+ {\font\thisecfont = #1ctt\ecsize \space at \nominalsize}%
+ % else
+ {\ifx\curfontstyle\bfstylename
+ % bold:
+ \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
+ \else
+ % regular:
+ \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
+ \fi}%
\thisecfont
}
@@ -3691,7 +3718,10 @@ $$%
% @textdegree - the normal degrees sign.
%
-\def\textdegree{$^\circ$}
+\def\textdegree{%
+ \ifmmode ^\circ
+ \else {\tcfont \char 176}%
+ \fi}
% Laurent Siebenmann reports \Orb undefined with:
% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
@@ -3708,11 +3738,11 @@ $$%
% only change font for tt for correct kerning and to avoid using
% \ecfont unless necessary.
\def\quotedblleft{%
- \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi
+ \ifusingtt{{\ecfont\char"10}}{{\char"5C}}%
}
\def\quotedblright{%
- \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi
+ \ifusingtt{{\ecfont\char"11}}{{\char`\"}}%
}
@@ -3737,13 +3767,14 @@ $$%
want the contents after the title page.}}%
\parseargdef\shorttitlepage{%
- \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
- \endgroup\page\hbox{}\page}
+ {\headingsoff \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
+ \endgroup\page\hbox{}\page}\pageone}
\envdef\titlepage{%
% Open one extra group, as we want to close it in the middle of \Etitlepage.
\begingroup
\parindent=0pt \textfonts
+ \headingsoff
% Leave some space at the very top of the page.
\vglue\titlepagetopglue
% No rule at page bottom unless we print one at the top with @title.
@@ -3771,11 +3802,9 @@ $$%
% If we use the new definition of \page, we always get a blank page
% after the title page, which we certainly don't want.
\oldpage
+ \pageone
\endgroup
%
- % Need this before the \...aftertitlepage checks so that if they are
- % in effect the toc pages will come out with page numbers.
- \HEADINGSon
}
\def\finishtitlepage{%
@@ -3842,15 +3871,16 @@ $$%
\newtoks\oddfootline % footline on odd pages
% Now make \makeheadline and \makefootline in Plain TeX use those variables
-\headline={{\textfonts\rm
+\headline={{\textfonts\rm\frenchspacingsetting
\ifchapterpage
\ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi
\else
\ifodd\pageno\the\oddheadline\else\the\evenheadline\fi
\fi}}
-\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
- \else \the\evenfootline \fi}\HEADINGShook}
+\footline={{\textfonts\rm\frenchspacingsetting
+ \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}%
+ \HEADINGShook}
\let\HEADINGShook=\relax
% Commands to set those variables.
@@ -3943,46 +3973,37 @@ $$%
}
\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
-\HEADINGSoff % it's the default
-% When we turn headings on, set the page number to 1.
+% Set the page number to 1.
\def\pageone{
\global\pageno=1
\global\arabiccount = \pagecount
}
+\let\contentsalignmacro = \chappager
+
+% \def\HEADINGSon{\HEADINGSdouble} % defined by \CHAPPAGon
+
% For double-sided printing, put current file name in lower left corner,
% chapter name on inside top of right hand pages, document
% title on inside top of left hand pages, and page numbers on outside top
% edge of all pages.
-\def\HEADINGSdouble{%
-\pageone
-\HEADINGSdoublex
-}
-\let\contentsalignmacro = \chappager
-
-% For single-sided printing, chapter title goes across top left of page,
-% page number on top right.
-\def\HEADINGSsingle{%
-\pageone
-\HEADINGSsinglex
-}
-\def\HEADINGSon{\HEADINGSdouble}
-
-\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
+\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdouble}
\let\HEADINGSdoubleafter=\HEADINGSafter
-\def\HEADINGSdoublex{%
+\def\HEADINGSdouble{%
\global\evenfootline={\hfil}
\global\oddfootline={\hfil}
\global\evenheadline={\line{\folio\hfil\thistitle}}
\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\evenchapheadline={\line{\folio\hfil}}
+\global\evenchapheadline={\line{\folio\hfil\thistitle}}
\global\oddchapheadline={\line{\hfil\folio}}
\global\let\contentsalignmacro = \chapoddpage
}
-\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
-\def\HEADINGSsinglex{%
+% For single-sided printing, chapter title goes across top left of page,
+% page number on top right.
+\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsingle}
+\def\HEADINGSsingle{%
\global\evenfootline={\hfil}
\global\oddfootline={\hfil}
\global\evenheadline={\line{\thischapter\hfil\folio}}
@@ -3994,7 +4015,6 @@ $$%
% for @setchapternewpage off
\def\HEADINGSsinglechapoff{%
-\pageone
\global\evenfootline={\hfil}
\global\oddfootline={\hfil}
\global\evenheadline={\line{\thischapter\hfil\folio}}
@@ -4364,8 +4384,7 @@ $$%
% undo it ourselves.
\def\headitemfont{\b}% for people to use in the template row; not changeable
\def\headitem{%
- \checkenv\multitable
- \crcr
+ \crcr % must appear first
\gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
\global\everytab={\bf}% can't use \headitemfont since the parsing differs
\the\everytab % for the first item
@@ -4450,7 +4469,7 @@ $$%
\message{conditionals,}
-% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
+% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotlatex, @ifnotplaintext,
% @ifnotxml always succeed. They currently do nothing; we don't
% attempt to check whether the conditionals are properly nested. But we
% have to remember that they are conditionals, so that @end doesn't
@@ -4464,6 +4483,7 @@ $$%
\makecond{ifnotdocbook}
\makecond{ifnothtml}
\makecond{ifnotinfo}
+\makecond{ifnotlatex}
\makecond{ifnotplaintext}
\makecond{ifnotxml}
@@ -4476,10 +4496,12 @@ $$%
\def\ifdocbook{\doignore{ifdocbook}}
\def\ifhtml{\doignore{ifhtml}}
\def\ifinfo{\doignore{ifinfo}}
+\def\iflatex{\doignore{iflatex}}
\def\ifnottex{\doignore{ifnottex}}
\def\ifplaintext{\doignore{ifplaintext}}
\def\ifxml{\doignore{ifxml}}
\def\ignore{\doignore{ignore}}
+\def\latex{\doignore{latex}}
\def\menu{\doignore{menu}}
\def\xml{\doignore{xml}}
@@ -4718,13 +4740,11 @@ $$%
% except not \outer, so it can be used within macros and \if's.
\edef\newwrite{\makecsname{ptexnewwrite}}
-% \newindex {foo} defines an index named IX.
+% \newindex {IX} defines an index named IX.
% It automatically defines \IXindex such that
% \IXindex ...rest of line... puts an entry in the index IX.
% It also defines \IXindfile to be the number of the output channel for
% the file that accumulates this index. The file's extension is IX.
-% The name of an index should be no more than 2 characters long
-% for the sake of vms.
%
\def\newindex#1{%
\expandafter\chardef\csname#1indfile\endcsname=0
@@ -4787,21 +4807,6 @@ $$%
\def\docodeindexxxx #1{\docind{\indexname}{#1}}
-% Used for the aux, toc and index files to prevent expansion of Texinfo
-% commands.
-%
-\def\atdummies{%
- \definedummyletter\@%
- \definedummyletter\ %
- \definedummyletter\{%
- \definedummyletter\}%
- \definedummyletter\&%
- %
- % Do the redefinitions.
- \definedummies
- \otherbackslash
-}
-
% \definedummyword defines \#1 as \string\#1\space, thus effectively
% preventing its expansion. This is used only for control words,
% not control letters, because the \space would be incorrect for
@@ -4817,110 +4822,91 @@ $$%
%
\def\definedummyword #1{\def#1{\string#1\space}}%
\def\definedummyletter#1{\def#1{\string#1}}%
-\let\definedummyaccent\definedummyletter
-% Called from \atdummies to prevent the expansion of commands.
+% Used for the aux, toc and index files to prevent expansion of Texinfo
+% commands. Most of the commands are controlled through the
+% \ifdummies conditional.
%
-\def\definedummies{%
+\def\atdummies{%
+ \dummiestrue
%
- \let\commondummyword\definedummyword
- \let\commondummyletter\definedummyletter
- \let\commondummyaccent\definedummyaccent
- \commondummiesnofonts
+ \definedummyletter\@%
+ \definedummyletter\ %
+ \definedummyletter\{%
+ \definedummyletter\}%
+ \definedummyletter\&%
%
\definedummyletter\_%
\definedummyletter\-%
%
- % Non-English letters.
- \definedummyword\AA
- \definedummyword\AE
- \definedummyword\DH
- \definedummyword\L
- \definedummyword\O
- \definedummyword\OE
- \definedummyword\TH
- \definedummyword\aa
- \definedummyword\ae
- \definedummyword\dh
- \definedummyword\exclamdown
- \definedummyword\l
- \definedummyword\o
- \definedummyword\oe
- \definedummyword\ordf
- \definedummyword\ordm
- \definedummyword\questiondown
- \definedummyword\ss
- \definedummyword\th
- %
- % Although these internal commands shouldn't show up, sometimes they do.
- \definedummyword\bf
- \definedummyword\gtr
- \definedummyword\hat
- \definedummyword\less
- \definedummyword\sf
- \definedummyword\sl
- \definedummyword\tclose
- \definedummyword\tt
- %
- \definedummyword\LaTeX
- \definedummyword\TeX
- %
- % Assorted special characters.
- \definedummyword\ampchar
- \definedummyword\atchar
- \definedummyword\arrow
- \definedummyword\backslashchar
- \definedummyword\bullet
- \definedummyword\comma
- \definedummyword\copyright
- \definedummyword\registeredsymbol
- \definedummyword\dots
- \definedummyword\enddots
- \definedummyword\entrybreak
- \definedummyword\equiv
- \definedummyword\error
- \definedummyword\euro
- \definedummyword\expansion
- \definedummyword\geq
- \definedummyword\guillemetleft
- \definedummyword\guillemetright
- \definedummyword\guilsinglleft
- \definedummyword\guilsinglright
- \definedummyword\lbracechar
- \definedummyword\leq
- \definedummyword\mathopsup
- \definedummyword\minus
- \definedummyword\ogonek
- \definedummyword\pounds
- \definedummyword\point
- \definedummyword\print
- \definedummyword\quotedblbase
- \definedummyword\quotedblleft
- \definedummyword\quotedblright
- \definedummyword\quoteleft
- \definedummyword\quoteright
- \definedummyword\quotesinglbase
- \definedummyword\rbracechar
- \definedummyword\result
- \definedummyword\sub
- \definedummyword\sup
- \definedummyword\textdegree
- %
\definedummyword\subentry
%
% We want to disable all macros so that they are not expanded by \write.
+ \let\commondummyword\definedummyword
\macrolist
\let\value\dummyvalue
%
- \normalturnoffactive
-}
-
-% \commondummiesnofonts: common to \definedummies and \indexnofonts.
-% Define \commondummyletter, \commondummyaccent and \commondummyword before
-% using. Used for accents, font commands, and various control letters.
-%
-\def\commondummiesnofonts{%
- % Control letters and accents.
+ \turnoffactive
+}
+
+\newif\ifdummies
+\newif\ifindexnofonts
+
+\def\commondummyletter#1{%
+ \expandafter\let\csname\string#1:impl\endcsname#1%
+ \edef#1{%
+ \noexpand\ifindexnofonts
+ % empty expansion
+ \noexpand\else
+ \noexpand\ifdummies\string#1%
+ \noexpand\else
+ \noexpand\jumptwofi % dispose of the \fi
+ \expandafter\noexpand\csname\string#1:impl\endcsname
+ \noexpand\fi
+ \noexpand\fi}%
+}
+
+\def\commondummyaccent#1{%
+ \expandafter\let\csname\string#1:impl\endcsname#1%
+ \edef#1{%
+ \noexpand\ifindexnofonts
+ \noexpand\expandafter % dispose of \else ... \fi
+ \noexpand\asis
+ \noexpand\else
+ \noexpand\ifdummies\string#1%
+ \noexpand\else
+ \noexpand\jumptwofi % dispose of the \fi
+ \expandafter\noexpand\csname\string#1:impl\endcsname
+ \noexpand\fi
+ \noexpand\fi}%
+}
+
+% Like \commondummyaccent but add a \space at the end of the dummy expansion
+% #2 is the expansion used for \indexnofonts. #2 is always followed by
+% \asis to remove a pair of following braces.
+\def\commondummyword#1#2{%
+ \expandafter\let\csname\string#1:impl\endcsname#1%
+ \expandafter\def\csname\string#1:ixnf\endcsname{#2\asis}%
+ \edef#1{%
+ \noexpand\ifindexnofonts
+ \noexpand\expandafter % dispose of \else ... \fi
+ \expandafter\noexpand\csname\string#1:ixnf\endcsname
+ \noexpand\else
+ \noexpand\ifdummies\string#1\space
+ \noexpand\else
+ \noexpand\jumptwofi % dispose of the \fi \fi
+ \expandafter\noexpand\csname\string#1:impl\endcsname
+ \noexpand\fi
+ \noexpand\fi}%
+}
+\def\jumptwofi#1\fi\fi{\fi\fi#1}
+
+% For \atdummies and \indexnofonts. \atdummies sets
+% \dummiestrue and \indexnofonts sets \indexnofontstrue.
+\def\definedummies{
+ % @-sign is always an escape character when reading auxiliary files
+ \escapechar = `\@
+ %
\commondummyletter\!%
\commondummyaccent\"%
\commondummyaccent\'%
@@ -4934,58 +4920,123 @@ $$%
\commondummyaccent\^%
\commondummyaccent\`%
\commondummyaccent\~%
- \commondummyword\u
- \commondummyword\v
- \commondummyword\H
- \commondummyword\dotaccent
- \commondummyword\ogonek
- \commondummyword\ringaccent
- \commondummyword\tieaccent
- \commondummyword\ubaraccent
- \commondummyword\udotaccent
- \commondummyword\dotless
+ %
+ % Control letters and accents.
+ \commondummyword\u {}%
+ \commondummyword\v {}%
+ \commondummyword\H {}%
+ \commondummyword\dotaccent {}%
+ \commondummyword\ogonek {}%
+ \commondummyword\ringaccent {}%
+ \commondummyword\tieaccent {}%
+ \commondummyword\ubaraccent {}%
+ \commondummyword\udotaccent {}%
+ \commondummyword\dotless {}%
%
% Texinfo font commands.
- \commondummyword\b
- \commondummyword\i
- \commondummyword\r
- \commondummyword\sansserif
- \commondummyword\sc
- \commondummyword\slanted
- \commondummyword\t
+ \commondummyword\b {}%
+ \commondummyword\i {}%
+ \commondummyword\r {}%
+ \commondummyword\sansserif {}%
+ \commondummyword\sc {}%
+ \commondummyword\slanted {}%
+ \commondummyword\t {}%
%
% Commands that take arguments.
- \commondummyword\abbr
- \commondummyword\acronym
- \commondummyword\anchor
- \commondummyword\cite
- \commondummyword\code
- \commondummyword\command
- \commondummyword\dfn
- \commondummyword\dmn
- \commondummyword\email
- \commondummyword\emph
- \commondummyword\env
- \commondummyword\file
- \commondummyword\image
- \commondummyword\indicateurl
- \commondummyword\inforef
- \commondummyword\kbd
- \commondummyword\key
- \commondummyword\math
- \commondummyword\option
- \commondummyword\pxref
- \commondummyword\ref
- \commondummyword\samp
- \commondummyword\strong
- \commondummyword\tie
- \commondummyword\U
- \commondummyword\uref
- \commondummyword\url
- \commondummyword\var
- \commondummyword\verb
- \commondummyword\w
- \commondummyword\xref
+ \commondummyword\abbr {}%
+ \commondummyword\acronym {}%
+ \commondummyword\anchor {}%
+ \commondummyword\cite {}%
+ \commondummyword\code {}%
+ \commondummyword\command {}%
+ \commondummyword\dfn {}%
+ \commondummyword\dmn {}%
+ \commondummyword\email {}%
+ \commondummyword\emph {}%
+ \commondummyword\env {}%
+ \commondummyword\file {}%
+ \commondummyword\image {}%
+ \commondummyword\indicateurl{}%
+ \commondummyword\inforef {}%
+ \commondummyword\kbd {}%
+ \commondummyword\key {}%
+ \commondummyword\math {}%
+ \commondummyword\option {}%
+ \commondummyword\pxref {}%
+ \commondummyword\ref {}%
+ \commondummyword\samp {}%
+ \commondummyword\strong {}%
+ \commondummyword\tie {}%
+ \commondummyword\U {}%
+ \commondummyword\uref {}%
+ \commondummyword\url {}%
+ \commondummyword\var {}%
+ \commondummyword\verb {}%
+ \commondummyword\w {}%
+ \commondummyword\xref {}%
+ %
+ \commondummyword\AA {AA}%
+ \commondummyword\AE {AE}%
+ \commondummyword\DH {DZZ}%
+ \commondummyword\L {L}%
+ \commondummyword\O {O}%
+ \commondummyword\OE {OE}%
+ \commondummyword\TH {TH}%
+ \commondummyword\aa {aa}%
+ \commondummyword\ae {ae}%
+ \commondummyword\dh {dzz}%
+ \commondummyword\exclamdown {!}%
+ \commondummyword\l {l}%
+ \commondummyword\o {o}%
+ \commondummyword\oe {oe}%
+ \commondummyword\ordf {a}%
+ \commondummyword\ordm {o}%
+ \commondummyword\questiondown {?}%
+ \commondummyword\ss {ss}%
+ \commondummyword\th {th}%
+ %
+ \commondummyword\LaTeX {LaTeX}%
+ \commondummyword\TeX {TeX}%
+ %
+ % Assorted special characters.
+ \commondummyword\ampchar {\normalamp}%
+ \commondummyword\atchar {\@}%
+ \commondummyword\arrow {->}%
+ \commondummyword\backslashchar {\realbackslash}%
+ \commondummyword\bullet {bullet}%
+ \commondummyword\comma {,}%
+ \commondummyword\copyright {copyright}%
+ \commondummyword\dots {...}%
+ \commondummyword\enddots {...}%
+ \commondummyword\entrybreak {}%
+ \commondummyword\equiv {===}%
+ \commondummyword\error {error}%
+ \commondummyword\euro {euro}%
+ \commondummyword\expansion {==>}%
+ \commondummyword\geq {>=}%
+ \commondummyword\guillemetleft {<<}%
+ \commondummyword\guillemetright {>>}%
+ \commondummyword\guilsinglleft {<}%
+ \commondummyword\guilsinglright {>}%
+ \commondummyword\lbracechar {\{}%
+ \commondummyword\leq {<=}%
+ \commondummyword\mathopsup {sup}%
+ \commondummyword\minus {-}%
+ \commondummyword\pounds {pounds}%
+ \commondummyword\point {.}%
+ \commondummyword\print {-|}%
+ \commondummyword\quotedblbase {"}%
+ \commondummyword\quotedblleft {"}%
+ \commondummyword\quotedblright {"}%
+ \commondummyword\quoteleft {`}%
+ \commondummyword\quoteright {'}%
+ \commondummyword\quotesinglbase {,}%
+ \commondummyword\rbracechar {\}}%
+ \commondummyword\registeredsymbol {R}%
+ \commondummyword\result {=>}%
+ \commondummyword\sub {}%
+ \commondummyword\sup {}%
+ \commondummyword\textdegree {o}%
}
\let\indexlbrace\relax
@@ -5003,25 +5054,24 @@ $$%
\catcode`\-=13
\catcode`\`=13
\gdef\indexnonalnumdisappear{%
- \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
+ \ifflagclear{txiindexlquoteignore}{}{%
% @set txiindexlquoteignore makes us ignore left quotes in the sort term.
% (Introduced for FSFS 2nd ed.)
\let`=\empty
- \fi
+ }%
%
- \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
+ \ifflagclear{txiindexbackslashignore}{}{%
\backslashdisappear
- \fi
- %
- \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
+ }%
+ \ifflagclear{txiindexhyphenignore}{}{%
\def-{}%
- \fi
- \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
+ }%
+ \ifflagclear{txiindexlessthanignore}{}{%
\def<{}%
- \fi
- \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
+ }%
+ \ifflagclear{txiindexatsignignore}{}{%
\def\@{}%
- \fi
+ }%
}
\gdef\indexnonalnumreappear{%
@@ -5037,18 +5087,7 @@ $$%
% would be for a given command (usually its argument).
%
\def\indexnofonts{%
- % Accent commands should become @asis.
- \def\commondummyaccent##1{\let##1\asis}%
- % We can just ignore other control letters.
- \def\commondummyletter##1{\let##1\empty}%
- % All control words become @asis by default; overrides below.
- \let\commondummyword\commondummyaccent
- \commondummiesnofonts
- %
- % Don't no-op \tt, since it isn't a user-level command
- % and is used in the definitions of the active chars like <, >, |, etc.
- % Likewise with the other plain tex font commands.
- %\let\tt=\asis
+ \indexnofontstrue
%
\def\ { }%
\def\@{@}%
@@ -5060,84 +5099,19 @@ $$%
\let\lbracechar\{%
\let\rbracechar\}%
%
- % Non-English letters.
- \def\AA{AA}%
- \def\AE{AE}%
- \def\DH{DZZ}%
- \def\L{L}%
- \def\OE{OE}%
- \def\O{O}%
- \def\TH{TH}%
- \def\aa{aa}%
- \def\ae{ae}%
- \def\dh{dzz}%
- \def\exclamdown{!}%
- \def\l{l}%
- \def\oe{oe}%
- \def\ordf{a}%
- \def\ordm{o}%
- \def\o{o}%
- \def\questiondown{?}%
- \def\ss{ss}%
- \def\th{th}%
- %
- \let\do\indexnofontsdef
- %
- \do\LaTeX{LaTeX}%
- \do\TeX{TeX}%
- %
- % Assorted special characters.
- \do\atchar{@}%
- \do\arrow{->}%
- \do\bullet{bullet}%
- \do\comma{,}%
- \do\copyright{copyright}%
- \do\dots{...}%
- \do\enddots{...}%
- \do\equiv{==}%
- \do\error{error}%
- \do\euro{euro}%
- \do\expansion{==>}%
- \do\geq{>=}%
- \do\guillemetleft{<<}%
- \do\guillemetright{>>}%
- \do\guilsinglleft{<}%
- \do\guilsinglright{>}%
- \do\leq{<=}%
- \do\lbracechar{\{}%
- \do\minus{-}%
- \do\point{.}%
- \do\pounds{pounds}%
- \do\print{-|}%
- \do\quotedblbase{"}%
- \do\quotedblleft{"}%
- \do\quotedblright{"}%
- \do\quoteleft{`}%
- \do\quoteright{'}%
- \do\quotesinglbase{,}%
- \do\rbracechar{\}}%
- \do\registeredsymbol{R}%
- \do\result{=>}%
- \do\textdegree{o}%
%
% We need to get rid of all macros, leaving only the arguments (if present).
% Of course this is not nearly correct, but it is the best we can do for now.
- % makeinfo does not expand macros in the argument to @deffn, which ends up
- % writing an index entry, and texindex isn't prepared for an index sort entry
- % that starts with \.
%
% Since macro invocations are followed by braces, we can just redefine them
% to take a single TeX argument. The case of a macro invocation that
% goes to end-of-line is not handled.
%
+ \def\commondummyword##1{\let##1\asis}%
\macrolist
\let\value\indexnofontsvalue
}
-% Give the control sequence a definition that removes the {} that follows
-% its use, e.g. @AA{} -> AA
-\def\indexnofontsdef#1#2{\def#1##1{#2}}%
-
@@ -5207,6 +5181,8 @@ $$%
% The default definitions
\def\sortas#1{}%
\def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
+\def\putwordSeeAlso{See also}
+\def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
%
% for Italian
%
@@ -5275,7 +5251,10 @@ $$%
\xdef\trimmed{\segment}%
\xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
\xdef\indexsortkey{\trimmed}%
- \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
+ \ifx\indexsortkey\empty
+ \message{Empty index sort key near line \the\inputlineno}%
+ \xdef\indexsortkey{ }%
+ \fi
}\fi
%
% Append to \fullindexsortkey.
@@ -5320,9 +5299,7 @@ $$%
%
\atdummies
%
- \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax\else
- \escapeisbackslash
- \fi
+ \ifflagclear{txiindexescapeisbackslash}{}{\escapeisbackslash}%
%
% For texindex which always views { and } as separators.
\def\{{\lbracechar{}}%
@@ -5506,9 +5483,9 @@ $$%
% old index files using \ as the escape character. Reading this would
% at best lead to typesetting garbage, at worst a TeX syntax error.
\def\printindexzz#1#2\finish{%
- \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax
+ \ifflagclear{txiindexescapeisbackslash}{%
\uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
- \expandafter\ifx\csname SETtxiskipindexfileswithbackslash\endcsname\relax
+ \ifflagclear{txiskipindexfileswithbackslash}{%
\errmessage{%
ERROR: A sorted index file in an obsolete format was skipped.
To fix this problem, please upgrade your version of 'texi2dvi'
@@ -5524,15 +5501,15 @@ this, Texinfo will try to use index files in the old format.
If you continue to have problems, deleting the index files and starting again
might help (with 'rm \jobname.?? \jobname.??s')%
}%
- \else
+ }{%
(Skipped sorted index file in obsolete format)
- \fi
+ }%
\else
\begindoublecolumns
\input \jobname.\indexname s
\enddoublecolumns
\fi
- \else
+ }{%
\begindoublecolumns
\catcode`\\=0\relax
%
@@ -5542,7 +5519,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\catcode`\@=0\relax
\input \jobname.\indexname s
\enddoublecolumns
- \fi
+ }%
}
% These macros are used by the sorted index file itself.
@@ -5617,6 +5594,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\newdimen\entryrightmargin
\entryrightmargin=0pt
+% for PDF output, whether to make the text of the entry a link to the page
+% number. set for @contents and @shortcontents where there is only one
+% page number.
+\newif\iflinkentrytext
+
% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
% then page number (#2) flushed to the right margin. It is used for index
% and table of contents entries. The paragraph is indented by \leftskip.
@@ -5643,7 +5625,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
}
\def\entrybreak{\unskip\space\ignorespaces}%
\def\doentry{%
- % Save the text of the entry
+ % Save the text of the entry in \boxA
\global\setbox\boxA=\hbox\bgroup
\bgroup % Instead of the swallowed brace.
\noindent
@@ -5653,12 +5635,21 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% with catcodes occurring.
}
{\catcode`\@=11
+% #1 is the page number
\gdef\finishentry#1{%
- \egroup % end box A
+ \egroup % end \boxA
\dimen@ = \wd\boxA % Length of text of entry
+ % add any leaders and page number to \boxA.
\global\setbox\boxA=\hbox\bgroup
- \unhbox\boxA
- % #1 is the page number.
+ \ifpdforxetex
+ \iflinkentrytext
+ \pdflinkpage{#1}{\unhbox\boxA}%
+ \else
+ \unhbox\boxA
+ \fi
+ \else
+ \unhbox\boxA
+ \fi
%
% Get the width of the page numbers, and only use
% leaders if they are present.
@@ -5677,6 +5668,8 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\fi
\fi
\egroup % end \boxA
+ %
+ % now output
\ifdim\wd\boxB = 0pt
\noindent\unhbox\boxA\par
\nobreak
@@ -6376,7 +6369,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\fi
}
-\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
+\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname\HEADINGSon}
\def\CHAPPAGoff{%
\global\let\contentsalignmacro = \chappager
@@ -6393,7 +6386,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\global\let\pchapsepmacro=\chapoddpage
\global\def\HEADINGSon{\HEADINGSdouble}}
-\CHAPPAGon
+\setchapternewpage on
% \chapmacro - Chapter opening.
%
@@ -6406,6 +6399,16 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\def\Yappendixkeyword{Yappendix}
\def\Yomitfromtockeyword{Yomitfromtoc}
%
+%
+% Definitions for @thischapter. These can be overridden in translation
+% files.
+\def\thischapterAppendix{%
+ \putwordAppendix{} \thischapternum: \thischaptername}
+
+\def\thischapterChapter{%
+ \putwordChapter{} \thischapternum: \thischaptername}
+%
+%
\def\chapmacro#1#2#3{%
\expandafter\ifx\thisenv\titlepage\else
\checkenv{}% chapters, etc., should not start inside an environment.
@@ -6428,22 +6431,14 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\xdef\currentchapterdefs{%
\gdef\noexpand\thischaptername{\the\toks0}%
\gdef\noexpand\thischapternum{\appendixletter}%
- % \noexpand\putwordAppendix avoids expanding indigestible
- % commands in some of the translations.
- \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
- \noexpand\thischapternum:
- \noexpand\thischaptername}%
+ \let\noexpand\thischapter\noexpand\thischapterAppendix
}%
\else
\toks0={#1}%
\xdef\currentchapterdefs{%
\gdef\noexpand\thischaptername{\the\toks0}%
\gdef\noexpand\thischapternum{\the\chapno}%
- % \noexpand\putwordChapter avoids expanding indigestible
- % commands in some of the translations.
- \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
- \noexpand\thischapternum:
- \noexpand\thischaptername}%
+ \let\noexpand\thischapter\noexpand\thischapterChapter
}%
\fi\fi\fi
%
@@ -6529,6 +6524,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\def\subsubsecheadingskip{\subsecheadingskip}
\def\subsubsecheadingbreak{\subsecheadingbreak}
+% Definition for @thissection. This can be overridden in translation
+% files.
+\def\thissectionDef{%
+ \putwordSection{} \thissectionnum: \thissectionname}
+%
+
% Print any size, any type, section title.
%
@@ -6570,11 +6571,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\xdef\currentsectiondefs{%
\gdef\noexpand\thissectionname{\the\toks0}%
\gdef\noexpand\thissectionnum{#4}%
- % \noexpand\putwordSection avoids expanding indigestible
- % commands in some of the translations.
- \gdef\noexpand\thissection{\noexpand\putwordSection{}
- \noexpand\thissectionnum:
- \noexpand\thissectionname}%
+ \let\noexpand\thissection\noexpand\thissectionDef
}%
\fi
\else
@@ -6583,11 +6580,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\xdef\currentsectiondefs{%
\gdef\noexpand\thissectionname{\the\toks0}%
\gdef\noexpand\thissectionnum{#4}%
- % \noexpand\putwordSection avoids expanding indigestible
- % commands in some of the translations.
- \gdef\noexpand\thissection{\noexpand\putwordSection{}
- \noexpand\thissectionnum:
- \noexpand\thissectionname}%
+ \let\noexpand\thissection\noexpand\thissectionDef
}%
\fi
\fi\fi\fi
@@ -6773,8 +6766,14 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\def\thistitle{}% no title in double-sided headings
% Record where the Roman numerals started.
\ifnum\romancount=0 \global\romancount=\pagecount \fi
+ \linkentrytexttrue
}
+% \raggedbottom in plain.tex hardcodes \topskip so override it
+\catcode`\@=11
+\def\raggedbottom{\advance\topskip by 0pt plus60pt \r@ggedbottomtrue}
+\catcode`\@=\other
+
% redefined for the two-volume lispref. We always output on
% \jobname.toc even if this is redefined.
%
@@ -6895,7 +6894,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% Chapters, in the short toc.
% See comments in \dochapentry re vbox and related settings.
\def\shortchapentry#1#2#3#4{%
- \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
+ \tocentry{\shortchaplabel{#2}\labelspace #1}{#4}%
}
% Appendices, in the main contents.
@@ -6910,7 +6909,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% Unnumbered chapters.
\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
-\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
+\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{#4}}
% Sections.
\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
@@ -6942,24 +6941,24 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% Move the page numbers slightly to the right
\advance\entryrightmargin by -0.05em
\chapentryfonts
- \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+ \tocentry{#1}{#2}%
\endgroup
\nobreak\vskip .25\baselineskip plus.1\baselineskip
}
\def\dosecentry#1#2{\begingroup
\secentryfonts \leftskip=\tocindent
- \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+ \tocentry{#1}{#2}%
\endgroup}
\def\dosubsecentry#1#2{\begingroup
\subsecentryfonts \leftskip=2\tocindent
- \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+ \tocentry{#1}{#2}%
\endgroup}
\def\dosubsubsecentry#1#2{\begingroup
\subsubsecentryfonts \leftskip=3\tocindent
- \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+ \tocentry{#1}{#2}%
\endgroup}
% We use the same \entry macro as for the index entries.
@@ -6968,9 +6967,6 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% Space between chapter (or whatever) number and the title.
\def\labelspace{\hskip1em \relax}
-\def\dopageno#1{{\rm #1}}
-\def\doshortpageno#1{{\rm #1}}
-
\def\chapentryfonts{\secfonts \rm}
\def\secentryfonts{\textfonts}
\def\subsecentryfonts{\textfonts}
@@ -7115,19 +7111,25 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\newdimen\cartouter\newdimen\cartinner
\newskip\normbskip\newskip\normpskip\newskip\normlskip
-
-\envdef\cartouche{%
+\envparseargdef\cartouche{%
\cartouchefontdefs
\ifhmode\par\fi % can't be in the midst of a paragraph.
\startsavinginserts
\lskip=\leftskip \rskip=\rightskip
\leftskip=0pt\rightskip=0pt % we want these *outside*.
+ %
+ % Set paragraph width for text inside cartouche. There are
+ % left and right margins of 3pt each plus two vrules 0.4pt each.
\cartinner=\hsize \advance\cartinner by-\lskip
\advance\cartinner by-\rskip
+ \advance\cartinner by -6.8pt
+ %
+ % For drawing top and bottom of cartouche. Each corner char
+ % adds 6pt and we take off the width of a rule to line up with the
+ % right boundary perfectly.
\cartouter=\hsize
- \advance\cartouter by 18.4pt % allow for 3pt kerns on either
- % side, and for 6pt waste from
- % each corner char, and rule thickness
+ \advance\cartouter by 11.6pt
+ %
\normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
%
% If this cartouche directly follows a sectioning command, we need the
@@ -7135,20 +7137,23 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% collide with the section heading.
\ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
%
- \setbox\groupbox=\vbox\bgroup
+ \setbox\groupbox=\vtop\bgroup
\baselineskip=0pt\parskip=0pt\lineskip=0pt
\carttop
\hbox\bgroup
- \hskip\lskip
- \vrule\kern3pt
- \vbox\bgroup
- \kern3pt
- \hsize=\cartinner
- \baselineskip=\normbskip
- \lineskip=\normlskip
- \parskip=\normpskip
- \vskip -\parskip
- \comment % For explanation, see the end of def\group.
+ \hskip\lskip
+ \vrule\kern3pt
+ \vbox\bgroup
+ \hsize=\cartinner
+ \baselineskip=\normbskip
+ \lineskip=\normlskip
+ \parskip=\normpskip
+ \def\arg{#1}%
+ \ifx\arg\empty\else
+ \centerV{\hfil \bf #1 \hfil}%
+ \fi
+ \kern3pt
+ \vskip -\parskip
}
\def\Ecartouche{%
\ifhmode\par\fi
@@ -7302,22 +7307,6 @@ might help (with 'rm \jobname.?? \jobname.??s')%
}
\let\Eraggedright\par
-\envdef\raggedleft{%
- \parindent=0pt \leftskip0pt plus2em
- \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
- \hbadness=10000 % Last line will usually be underfull, so turn off
- % badness reporting.
-}
-\let\Eraggedleft\par
-
-\envdef\raggedcenter{%
- \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
- \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
- \hbadness=10000 % Last line will usually be underfull, so turn off
- % badness reporting.
-}
-\let\Eraggedcenter\par
-
% @quotation does normal linebreaking (hence we can't use \nonfillstart)
% and narrows the margins. We keep \parskip nonzero in general, since
@@ -7415,8 +7404,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\endgroup
%
\def\setupverb{%
- \tt % easiest (and conventionally used) font for verbatim
+ \tt
\def\par{\leavevmode\endgraf}%
+ \parindent = 0pt
\setcodequotes
\tabeightspaces
% Respect line breaks,
@@ -7540,9 +7530,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% file; b) letting users define the frontmatter in as flexible order as
% possible is desirable.
%
-\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
-\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
-%
+\def\copying{\checkenv{}\begingroup\macrobodyctxt\docopying}
+{\catcode`\ =\other
+\gdef\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
+}
+
\def\insertcopying{%
\begingroup
\parindent = 0pt % paragraph indentation looks wrong on title page
@@ -7590,32 +7582,19 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\exdentamount=\defbodyindent
}
-\def\dodefunx#1{%
- % First, check whether we are in the right environment:
- \checkenv#1%
- %
- % As above, allow line break if we have multiple x headers in a row.
- % It's not a great place, though.
- \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
- %
- % And now, it's time to reuse the body of the original defun:
- \expandafter\gobbledefun#1%
-}
-\def\gobbledefun#1\startdefun{}
-
-% \printdefunline \deffnheader{text}
+% Called as \printdefunline \deffooheader{text}
%
\def\printdefunline#1#2{%
\begingroup
\plainfrenchspacing
- % call \deffnheader:
+ % call \deffooheader:
#1#2 \endheader
% common ending:
\interlinepenalty = 10000
\advance\rightskip by 0pt plus 1fil\relax
\endgraf
\nobreak\vskip -\parskip
- \penalty\defunpenalty % signal to \startdefun and \dodefunx
+ \penalty\defunpenalty % signal to \startdefun and \deffoox
% Some of the @defun-type tags do not enable magic parentheses,
% rendering the following check redundant. But we don't optimize.
\checkparencounts
@@ -7624,29 +7603,51 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\def\Edefun{\endgraf\medbreak}
-% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
-% the only thing remaining is to define \deffnheader.
+% @defblock, @defline do not automatically create index entries
+\envdef\defblock{%
+ \startdefun
+}
+\let\Edefblock\Edefun
+
+\def\defline{%
+ \doingtypefnfalse
+ \parseargusing\activeparens{\printdefunline\deflineheader}%
+}
+\def\deflineheader#1 #2 #3\endheader{%
+ \printdefname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
+}
+\def\deftypeline{%
+ \doingtypefntrue
+ \parseargusing\activeparens{\printdefunline\deflineheader}%
+}
+
+% \makedefun{deffoo} (\deffooheader parameters) { (\deffooheader expansion) }
%
+% Define \deffoo, \deffoox \Edeffoo and \deffooheader.
\def\makedefun#1{%
\expandafter\let\csname E#1\endcsname = \Edefun
\edef\temp{\noexpand\domakedefun
\makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
\temp
}
-
-% \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
-%
-% Define \deffn and \deffnx, without parameters.
-% \deffnheader has to be defined explicitly.
-%
\def\domakedefun#1#2#3{%
\envdef#1{%
\startdefun
\doingtypefnfalse % distinguish typed functions from all else
\parseargusing\activeparens{\printdefunline#3}%
}%
- \def#2{\dodefunx#1}%
- \def#3%
+ \def#2{%
+ % First, check whether we are in the right environment:
+ \checkenv#1%
+ %
+ % As in \startdefun, allow line break if we have multiple x headers
+ % in a row. It's not a great place, though.
+ \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
+ %
+ \doingtypefnfalse % distinguish typed functions from all else
+ \parseargusing\activeparens{\printdefunline#3}%
+ }%
+ \def#3% definition of \deffooheader follows
}
\newif\ifdoingtypefn % doing typed function?
@@ -7671,74 +7672,51 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\fi\fi
}
-% \dosubind {index}{topic}{subtopic}
-%
-% If SUBTOPIC is present, precede it with a space, and call \doind.
-% (At some time during the 20th century, this made a two-level entry in an
-% index such as the operation index. Nobody seemed to notice the change in
-% behaviour though.)
-\def\dosubind#1#2#3{%
- \def\thirdarg{#3}%
- \ifx\thirdarg\empty
- \doind{#1}{#2}%
- \else
- \doind{#1}{#2\space#3}%
- \fi
-}
-
% Untyped functions:
% @deffn category name args
-\makedefun{deffn}{\deffngeneral{}}
-
-% @deffn category class name args
-\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
-
-% \defopon {category on}class name args
-\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
+\makedefun{deffn}#1 #2 #3\endheader{%
+ \doind{fn}{\code{#2}}%
+ \printdefname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
+}
-% \deffngeneral {subind}category name args
-%
-\def\deffngeneral#1#2 #3 #4\endheader{%
- \dosubind{fn}{\code{#3}}{#1}%
- \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
+% @defop category class name args
+\makedefun{defop}#1 {\defopheaderx{#1\ \putwordon}}
+\def\defopheaderx#1#2 #3 #4\endheader{%
+ \doind{fn}{\code{#3}\space\putwordon\ \code{#2}}%
+ \printdefname{#1\ \code{#2}}{}{#3}\magicamp\defunargs{#4\unskip}%
}
% Typed functions:
% @deftypefn category type name args
-\makedefun{deftypefn}{\deftypefngeneral{}}
+\makedefun{deftypefn}#1 #2 #3 #4\endheader{%
+ \doind{fn}{\code{#3}}%
+ \doingtypefntrue
+ \printdefname{#1}{#2}{#3}\defunargs{#4\unskip}%
+}
% @deftypeop category class type name args
-\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
-
-% \deftypeopon {category on}class type name args
-\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
-
-% \deftypefngeneral {subind}category type name args
-%
-\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
- \dosubind{fn}{\code{#4}}{#1}%
+\makedefun{deftypeop}#1 {\deftypeopheaderx{#1\ \putwordon}}
+\def\deftypeopheaderx#1#2 #3 #4 #5\endheader{%
+ \doind{fn}{\code{#4}\space\putwordon\ \code{#1\ \code{#2}}}%
\doingtypefntrue
- \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
+ \printdefname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
}
% Typed variables:
% @deftypevr category type var args
-\makedefun{deftypevr}{\deftypecvgeneral{}}
+\makedefun{deftypevr}#1 #2 #3 #4\endheader{%
+ \doind{vr}{\code{#3}}%
+ \printdefname{#1}{#2}{#3}\defunargs{#4\unskip}%
+}
% @deftypecv category class type var args
-\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
-
-% \deftypecvof {category of}class type var args
-\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
-
-% \deftypecvgeneral {subind}category type var args
-%
-\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
- \dosubind{vr}{\code{#4}}{#1}%
- \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
+\makedefun{deftypecv}#1 {\deftypecvheaderx{#1\ \putwordof}}
+\def\deftypecvheaderx#1#2 #3 #4 #5\endheader{%
+ \doind{vr}{\code{#4}\space\putwordof\ \code{#2}}%
+ \printdefname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
}
% Untyped variables:
@@ -7747,17 +7725,15 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
% @defcv category class var args
-\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
-
-% \defcvof {category of}class var args
-\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
+\makedefun{defcv}#1 {\defcvheaderx{#1\ \putwordof}}
+\def\defcvheaderx#1#2 {\deftypecvheaderx{#1}#2 {} }
% Types:
% @deftp category name args
\makedefun{deftp}#1 #2 #3\endheader{%
\doind{tp}{\code{#2}}%
- \defname{#1}{}{#2}\defunargs{#3\unskip}%
+ \printdefname{#1}{}{#2}\defunargs{#3\unskip}%
}
% Remaining @defun-like shortcuts:
@@ -7768,19 +7744,19 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\makedefun{defvar}{\defvrheader{\putwordDefvar} }
\makedefun{defopt}{\defvrheader{\putwordDefopt} }
\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
-\makedefun{defmethod}{\defopon\putwordMethodon}
-\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
-\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
-\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
+\makedefun{defmethod}{\defopheaderx\putwordMethodon}
+\makedefun{deftypemethod}{\deftypeopheaderx\putwordMethodon}
+\makedefun{defivar}{\defcvheaderx\putwordInstanceVariableof}
+\makedefun{deftypeivar}{\deftypecvheaderx\putwordInstanceVariableof}
-% \defname, which formats the name of the @def (not the args).
+% \printdefname, which formats the name of the @def (not the args).
% #1 is the category, such as "Function".
% #2 is the return type, if any.
% #3 is the function name.
%
% We are followed by (but not passed) the arguments, if any.
%
-\def\defname#1#2#3{%
+\def\printdefname#1#2#3{%
\par
% Get the values of \leftskip and \rightskip as they were outside the @def...
\advance\leftskip by -\defbodyindent
@@ -7790,9 +7766,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\rettypeownlinefalse
\ifdoingtypefn % doing a typed function specifically?
% then check user option for putting return type on its own line:
- \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
- \rettypeownlinetrue
- \fi
+ \ifflagclear{txideftypefnnl}{}{\rettypeownlinetrue}%
\fi
%
% How we'll format the category name. Putting it in brackets helps
@@ -7857,30 +7831,22 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\fi % no return type
#3% output function name
}%
- {\rm\enskip}% hskip 0.5 em of \rmfont
+ \ifflagclear{txidefnamenospace}{%
+ {\rm\enskip}% hskip 0.5 em of \rmfont
+ }{}%
%
\boldbrax
% arguments will be output next, if any.
}
-% Print arguments in slanted roman (not ttsl), inconsistently with using
-% tt for the name. This is because literal text is sometimes needed in
-% the argument list (groff manual), and ttsl and tt are not very
-% distinguishable. Prevent hyphenation at `-' chars.
-%
+% Print arguments. Use slanted for @def*, typewriter for @deftype*.
\def\defunargs#1{%
- % use sl by default (not ttsl),
- % tt for the names.
- \df \sl \hyphenchar\font=0
- %
- % On the other hand, if an argument has two dashes (for instance), we
- % want a way to get ttsl. We used to recommend @var for that, so
- % leave the code in, but it's strange for @var to lead to typewriter.
- % Nowadays we recommend @code, since the difference between a ttsl hyphen
- % and a tt hyphen is pretty tiny. @code also disables ?` !`.
- \def\var##1{{\setregularquotes\ttslanted{##1}}}%
- #1%
- \sl\hyphenchar\font=45
+ \bgroup
+ \df \ifdoingtypefn \tt \else \sl \fi
+ \ifflagclear{txicodevaristt}{}%
+ {\def\var##1{{\setregularquotes \ttsl ##1}}}%
+ #1%
+ \egroup
}
% We want ()&[] to print specially on the defun line.
@@ -7899,9 +7865,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% so TeX would otherwise complain about undefined control sequence.
{
\activeparens
- \global\let(=\lparen \global\let)=\rparen
- \global\let[=\lbrack \global\let]=\rbrack
- \global\let& = \&
+ \gdef\defcharsdefault{%
+ \let(=\lparen \let)=\rparen
+ \let[=\lbrack \let]=\rbrack
+ \let& = \&%
+ }
+ \globaldefs=1 \defcharsdefault
\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
\gdef\magicamp{\let&=\amprm}
@@ -7912,7 +7881,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% If we encounter &foo, then turn on ()-hacking afterwards
\newif\ifampseen
-\def\amprm#1 {\ampseentrue{\bf\&#1 }}
+\def\amprm#1 {\ampseentrue{\rm\&#1 }}
\def\parenfont{%
\ifampseen
@@ -8085,24 +8054,17 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\catcode`\_=\other
\catcode`\|=\other
\catcode`\~=\other
- \passthroughcharstrue
-}
-
-\def\scanargctxt{% used for copying and captions, not macros.
- \scanctxt
\catcode`\@=\other
- \catcode`\\=\other
\catcode`\^^M=\other
+ \catcode`\\=\active
+ \passthroughcharstrue
}
-\def\macrobodyctxt{% used for @macro definitions
+\def\macrobodyctxt{% used for @macro definitions and @copying
\scanctxt
\catcode`\ =\other
- \catcode`\@=\other
\catcode`\{=\other
\catcode`\}=\other
- \catcode`\^^M=\other
- \usembodybackslash
}
% Used when scanning braced macro arguments. Note, however, that catcode
@@ -8111,14 +8073,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\def\macroargctxt{%
\scanctxt
\catcode`\ =\active
- \catcode`\@=\other
- \catcode`\^^M=\other
- \catcode`\\=\active
}
\def\macrolineargctxt{% used for whole-line arguments without braces
\scanctxt
- \catcode`\@=\other
\catcode`\{=\other
\catcode`\}=\other
}
@@ -8162,7 +8120,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
\addtomacrolist{\the\macname}%
\fi
- \begingroup \macrobodyctxt
+ \begingroup \macrobodyctxt \usembodybackslash
\ifrecursive \expandafter\parsermacbody
\else \expandafter\parsemacbody
\fi}
@@ -8247,12 +8205,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
%
% We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
% body to be transformed.
-% Set \macrobody to the body of the macro, and call \defmacro.
+% Set \macrobody to the body of the macro, and call \macrodef.
%
{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
-\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
+\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
-\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
+\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
% Make @ a letter, so that we can make private-to-Texinfo macro names.
\edef\texiatcatcode{\the\catcode`\@}
@@ -8471,35 +8429,36 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% \xdef is used so that macro definitions will survive the file
% they're defined in: @include reads the file inside a group.
%
-\def\defmacro{%
+\def\macrodef{%
\let\hash=##% convert placeholders to macro parameter chars
\ifnum\paramno=1
- \def\xeatspaces##1{##1}%
- % This removes the pair of braces around the argument. We don't
- % use \eatspaces, because this can cause ends of lines to be lost
- % when the argument to \eatspaces is read, leading to line-based
- % commands like "@itemize" not being read correctly.
+ \long\def\xeatspaces##1{##1}%
+ % We don't use \xeatspaces for single-argument macros, because we
+ % want to keep ends of lines. This definition removes \xeatspaces
+ % when \macrobody is expanded below.
\else
- \let\xeatspaces\relax % suppress expansion
+ \def\xeatspaces{\string\xeatspaces}%
+ % This expands \xeatspaces as a sequence of character tokens, which
+ % stops \scantokens inserting an extra space after the control sequence.
\fi
\ifcase\paramno
% 0
\expandafter\xdef\csname\the\macname\endcsname{%
- \bgroup
+ \begingroup
\noexpand\spaceisspace
\noexpand\endlineisspace
\noexpand\expandafter % skip any whitespace after the macro name.
\expandafter\noexpand\csname\the\macname @@@\endcsname}%
\expandafter\xdef\csname\the\macname @@@\endcsname{%
- \egroup
+ \endgroup
\noexpand\scanmacro{\macrobody}}%
\or % 1
\expandafter\xdef\csname\the\macname\endcsname{%
- \bgroup
+ \begingroup
\noexpand\braceorline
\expandafter\noexpand\csname\the\macname @@@\endcsname}%
\expandafter\xdef\csname\the\macname @@@\endcsname##1{%
- \egroup
+ \endgroup
\noexpand\scanmacro{\macrobody}%
}%
\else % at most 9
@@ -8510,7 +8469,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% @MACNAME@@@ removes braces surrounding the argument list.
% @MACNAME@@@@ scans the macro body with arguments substituted.
\expandafter\xdef\csname\the\macname\endcsname{%
- \bgroup
+ \begingroup
\noexpand\expandafter % This \expandafter skip any spaces after the
\noexpand\macroargctxt % macro before we change the catcode of space.
\noexpand\expandafter
@@ -8524,7 +8483,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\expandafter\xdef
\expandafter\expandafter
\csname\the\macname @@@@\endcsname\paramlist{%
- \egroup\noexpand\scanmacro{\macrobody}}%
+ \endgroup\noexpand\scanmacro{\macrobody}}%
\else % 10 or more:
\expandafter\xdef\csname\the\macname\endcsname{%
\noexpand\getargvals@{\the\macname}{\argl}%
@@ -8646,6 +8605,75 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\fi \macnamexxx}
+% @linemacro
+
+\parseargdef\linemacro{%
+ \getargs{#1}% now \macname is the macname and \argl the arglist
+ \ifx\argl\empty
+ \paramno=0
+ \let\hash\relax
+ \def\paramlist{\hash 1\endlinemacro}%
+ \else
+ \expandafter\linegetparamlist\argl;%
+ \fi
+ \begingroup \macrobodyctxt \usembodybackslash
+ \parselinemacrobody
+}
+
+% Build up \paramlist which will be used as the parameter text for the macro.
+% At the end it will be like "#1 #2 #3\endlinemacro".
+\def\linegetparamlist#1;{%
+ \paramno=0\def\paramlist{}%
+ \let\hash\relax
+ \linegetparamlistxxx#1,;,%
+}
+\def\linegetparamlistxxx#1,{%
+ \if#1;\let\next=\linegetparamlistxxxx
+ \else \let\next=\linegetparamlistxxx
+ \advance\paramno by 1
+ \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
+ {\hash\the\paramno}%
+ \edef\paramlist{\paramlist\hash\the\paramno\space}%
+ \fi\next}
+\def\linegetparamlistxxxx{%
+ \expandafter\fixparamlist\paramlist\fixparamlist
+}
+% Replace final space token
+\def\fixparamlist#1 \fixparamlist{%
+ \def\paramlist{#1\endlinemacro}%
+}
+
+% Read the body of the macro, replacing backslash-surrounded variables
+%
+{\catcode`\ =\other\long\gdef\parselinemacrobody#1@end linemacro{%
+\xdef\macrobody{#1}%
+\endgroup
+\linemacrodef
+}}
+
+% Make the definition
+\def\linemacrodef{%
+ \let\hash=##%
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \bgroup
+ \noexpand\parsearg
+ \expandafter\noexpand\csname\the\macname @@\endcsname
+ }
+ \expandafter\xdef\csname\the\macname @@\endcsname##1{%
+ \egroup
+ \expandafter\noexpand
+ \csname\the\macname @@@\endcsname##1\noexpand\endlinemacro
+ }
+ \expandafter\expandafter
+ \expandafter\xdef
+ \expandafter\expandafter\csname\the\macname @@@\endcsname\paramlist{%
+ \newlinechar=13 % split \macrobody into lines
+ \noexpand\scantokens{\macrobody}%
+ }
+}
+
+
+
% @alias.
% We need some trickery to remove the optional spaces around the equal
% sign. Make them active and then expand them all to nothing.
@@ -8966,12 +8994,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% output the `[mynode]' via the macro below so it can be overridden.
\xrefprintnodename\printedrefname
%
- \expandafter\ifx\csname SETtxiomitxrefpg\endcsname\relax
- % But we always want a comma and a space:
- ,\space
- %
+ \ifflagclear{txiomitxrefpg}{%
+ % We always want a comma
+ ,%
% output the `page 3'.
- \turnoffactive \putwordpage\tie\refx{#1-pg}%
+ \turnoffactive \putpageref{#1}%
% Add a , if xref followed by a space
\if\space\noexpand\tokenafterxref ,%
\else\ifx\ \tokenafterxref ,% @TAB
@@ -8981,12 +9008,16 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\tokenafterxref ,% @NL
\else\ifx\tie\tokenafterxref ,% @tie
\fi\fi\fi\fi\fi\fi
- \fi
+ }{}%
\fi\fi
\fi
\endlink
\endgroup}
+% can be overridden in translation files
+\def\putpageref#1{%
+ \space\putwordpage\tie\refx{#1-pg}}
+
% Output a cross-manual xref to #1. Used just above (twice).
%
% Only include the text "Section ``foo'' in" if the foo is neither
@@ -9398,6 +9429,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\imagexxx #1,,,,,\finish
\fi
}
+
+% Approximate height of a line in the standard text font.
+\newdimen\capheight
+\setbox0=\vbox{\tenrm H}
+\capheight=\ht0
+
%
% Arguments to @image:
% #1 is (mandatory) image filename; we tack on .eps extension.
@@ -9412,13 +9449,6 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\makevalueexpandable
\ifvmode
\imagevmodetrue
- \else \ifx\centersub\centerV
- % for @center @image, we need a vbox so we can have our vertical space
- \imagevmodetrue
- \vbox\bgroup % vbox has better behavior than vtop here
- \fi\fi
- %
- \ifimagevmode
\medskip
% Usually we'll have text after the image which will insert
% \parskip glue, so insert it here too to equalize the space
@@ -9427,17 +9457,20 @@ might help (with 'rm \jobname.?? \jobname.??s')%
%
% Place image in a \vtop for a top page margin that is (close to) correct,
% as \topskip glue is relative to the first baseline.
- \vtop\bgroup\hrule height 0pt\vskip-\parskip
+ \vtop\bgroup \kern -\capheight \vskip-\parskip
\fi
%
- % Enter horizontal mode so that indentation from an enclosing
- % environment such as @quotation is respected.
- % However, if we're at the top level, we don't want the
- % normal paragraph indentation.
- % On the other hand, if we are in the case of @center @image, we don't
- % want to start a paragraph, which will create a hsize-width box and
- % eradicate the centering.
- \ifx\centersub\centerV \else \imageindent \fi
+ \ifx\centersub\centerV
+ % For @center @image, enter vertical mode and add vertical space
+ % Enter an extra \parskip because @center doesn't add space itself.
+ \vbox\bgroup\vskip\parskip\medskip\vskip\parskip
+ \else
+ % Enter horizontal mode so that indentation from an enclosing
+ % environment such as @quotation is respected.
+ % However, if we're at the top level, we don't want the
+ % normal paragraph indentation.
+ \imageindent
+ \fi
%
% Output the image.
\ifpdf
@@ -9462,7 +9495,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\egroup
\medskip % space after a standalone image
\fi
- \ifx\centersub\centerV \egroup \fi
+ \ifx\centersub\centerV % @center @image
+ \medskip
+ \egroup % close \vbox
+ \fi
\endgroup}
@@ -9629,8 +9665,8 @@ might help (with 'rm \jobname.?? \jobname.??s')%
%
\def\caption{\docaption\thiscaption}
\def\shortcaption{\docaption\thisshortcaption}
-\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
-\def\defcaption#1#2{\egroup \def#1{#2}}
+\def\docaption{\checkenv\float \bgroup\scanctxt\docaptionz}
+\def\docaptionz#1#2{\egroup \def#1{#2}}
% The parameter is the control sequence identifying the counter we are
% going to use. Create it if it doesn't exist and assign it to \floatno.
@@ -9919,12 +9955,10 @@ directory should work if nowhere else does.}
% For native Unicode handling (XeTeX and LuaTeX)
\nativeunicodechardefs
\else
- % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
+ % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX).
+ % Since we already invoke \utfeightchardefs at the top level,
+ % making non-ascii chars active is sufficient.
\setnonasciicharscatcode\active
- % since we already invoked \utfeightchardefs at the top level
- % (below), do not re-invoke it, otherwise our check for duplicated
- % definitions gets triggered. Making non-ascii chars active is
- % sufficient.
\fi
%
\else
@@ -9949,7 +9983,6 @@ directory should work if nowhere else does.}
\fi
}
-% emacs-page
% A message to be logged when using a character that isn't available
% the default font encoding (OT1).
%
@@ -9958,12 +9991,6 @@ directory should work if nowhere else does.}
% Take account of \c (plain) vs. \, (Texinfo) difference.
\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
-% First, make active non-ASCII characters in order for them to be
-% correctly categorized when TeX reads the replacement text of
-% macros containing the character definitions.
-\setnonasciicharscatcode\active
-%
-
\def\gdefchar#1#2{%
\gdef#1{%
\ifpassthroughchars
@@ -9973,8 +10000,14 @@ directory should work if nowhere else does.}
\fi
}}
+\begingroup
+
+% Make non-ASCII characters active for defining the character definition
+% macros.
+\setnonasciicharscatcode\active
+
% Latin1 (ISO-8859-1) character definitions.
-\def\latonechardefs{%
+\gdef\latonechardefs{%
\gdefchar^^a0{\tie}
\gdefchar^^a1{\exclamdown}
\gdefchar^^a2{{\tcfont \char162}} % cent
@@ -10079,7 +10112,7 @@ directory should work if nowhere else does.}
}
% Latin9 (ISO-8859-15) encoding character definitions.
-\def\latninechardefs{%
+\gdef\latninechardefs{%
% Encoding is almost identical to Latin1.
\latonechardefs
%
@@ -10094,7 +10127,7 @@ directory should work if nowhere else does.}
}
% Latin2 (ISO-8859-2) character definitions.
-\def\lattwochardefs{%
+\gdef\lattwochardefs{%
\gdefchar^^a0{\tie}
\gdefchar^^a1{\ogonek{A}}
\gdefchar^^a2{\u{}}
@@ -10112,7 +10145,7 @@ directory should work if nowhere else does.}
\gdefchar^^ae{\v Z}
\gdefchar^^af{\dotaccent Z}
%
- \gdefchar^^b0{\textdegree{}}
+ \gdefchar^^b0{\textdegree}
\gdefchar^^b1{\ogonek{a}}
\gdefchar^^b2{\ogonek{ }}
\gdefchar^^b3{\l}
@@ -10198,6 +10231,8 @@ directory should work if nowhere else does.}
\gdefchar^^ff{\dotaccent{}}
}
+\endgroup % active chars
+
% UTF-8 character definitions.
%
% This code to support UTF-8 is based on LaTeX's utf8.def, with some
@@ -10349,9 +10384,9 @@ directory should work if nowhere else does.}
% Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
% to the corresponding UTF-8 sequence.
\gdef\parseXMLCharref{%
- \ifnum\countUTFz < "A0\relax
+ \ifnum\countUTFz < "20\relax
\errhelp = \EMsimple
- \errmessage{Cannot define Unicode char value < 00A0}%
+ \errmessage{Cannot define Unicode char value < 0020}%
\else\ifnum\countUTFz < "800\relax
\parseUTFviiiA,%
\parseUTFviiiB C\UTFviiiTwoOctetsName.,%
@@ -10421,6 +10456,103 @@ directory should work if nowhere else does.}
% least make most of the characters not bomb out.
%
\def\unicodechardefs{%
+ \DeclareUnicodeCharacter{0020}{ } % space
+ \DeclareUnicodeCharacter{0021}{\char"21 }% % space to terminate number
+ \DeclareUnicodeCharacter{0022}{\char"22 }%
+ \DeclareUnicodeCharacter{0023}{\char"23 }%
+ \DeclareUnicodeCharacter{0024}{\char"24 }%
+ \DeclareUnicodeCharacter{0025}{\char"25 }%
+ \DeclareUnicodeCharacter{0026}{\char"26 }%
+ \DeclareUnicodeCharacter{0027}{\char"27 }%
+ \DeclareUnicodeCharacter{0028}{\char"28 }%
+ \DeclareUnicodeCharacter{0029}{\char"29 }%
+ \DeclareUnicodeCharacter{002A}{\char"2A }%
+ \DeclareUnicodeCharacter{002B}{\char"2B }%
+ \DeclareUnicodeCharacter{002C}{\char"2C }%
+ \DeclareUnicodeCharacter{002D}{\char"2D }%
+ \DeclareUnicodeCharacter{002E}{\char"2E }%
+ \DeclareUnicodeCharacter{002F}{\char"2F }%
+ \DeclareUnicodeCharacter{0030}{0}%
+ \DeclareUnicodeCharacter{0031}{1}%
+ \DeclareUnicodeCharacter{0032}{2}%
+ \DeclareUnicodeCharacter{0033}{3}%
+ \DeclareUnicodeCharacter{0034}{4}%
+ \DeclareUnicodeCharacter{0035}{5}%
+ \DeclareUnicodeCharacter{0036}{6}%
+ \DeclareUnicodeCharacter{0037}{7}%
+ \DeclareUnicodeCharacter{0038}{8}%
+ \DeclareUnicodeCharacter{0039}{9}%
+ \DeclareUnicodeCharacter{003A}{\char"3A }%
+ \DeclareUnicodeCharacter{003B}{\char"3B }%
+ \DeclareUnicodeCharacter{003C}{\char"3C }%
+ \DeclareUnicodeCharacter{003D}{\char"3D }%
+ \DeclareUnicodeCharacter{003E}{\char"3E }%
+ \DeclareUnicodeCharacter{003F}{\char"3F }%
+ \DeclareUnicodeCharacter{0040}{\char"40 }%
+ \DeclareUnicodeCharacter{0041}{A}%
+ \DeclareUnicodeCharacter{0042}{B}%
+ \DeclareUnicodeCharacter{0043}{C}%
+ \DeclareUnicodeCharacter{0044}{D}%
+ \DeclareUnicodeCharacter{0045}{E}%
+ \DeclareUnicodeCharacter{0046}{F}%
+ \DeclareUnicodeCharacter{0047}{G}%
+ \DeclareUnicodeCharacter{0048}{H}%
+ \DeclareUnicodeCharacter{0049}{I}%
+ \DeclareUnicodeCharacter{004A}{J}%
+ \DeclareUnicodeCharacter{004B}{K}%
+ \DeclareUnicodeCharacter{004C}{L}%
+ \DeclareUnicodeCharacter{004D}{M}%
+ \DeclareUnicodeCharacter{004E}{N}%
+ \DeclareUnicodeCharacter{004F}{O}%
+ \DeclareUnicodeCharacter{0050}{P}%
+ \DeclareUnicodeCharacter{0051}{Q}%
+ \DeclareUnicodeCharacter{0052}{R}%
+ \DeclareUnicodeCharacter{0053}{S}%
+ \DeclareUnicodeCharacter{0054}{T}%
+ \DeclareUnicodeCharacter{0055}{U}%
+ \DeclareUnicodeCharacter{0056}{V}%
+ \DeclareUnicodeCharacter{0057}{W}%
+ \DeclareUnicodeCharacter{0058}{X}%
+ \DeclareUnicodeCharacter{0059}{Y}%
+ \DeclareUnicodeCharacter{005A}{Z}%
+ \DeclareUnicodeCharacter{005B}{\char"5B }%
+ \DeclareUnicodeCharacter{005C}{\char"5C }%
+ \DeclareUnicodeCharacter{005D}{\char"5D }%
+ \DeclareUnicodeCharacter{005E}{\char"5E }%
+ \DeclareUnicodeCharacter{005F}{\char"5F }%
+ \DeclareUnicodeCharacter{0060}{\char"60 }%
+ \DeclareUnicodeCharacter{0061}{a}%
+ \DeclareUnicodeCharacter{0062}{b}%
+ \DeclareUnicodeCharacter{0063}{c}%
+ \DeclareUnicodeCharacter{0064}{d}%
+ \DeclareUnicodeCharacter{0065}{e}%
+ \DeclareUnicodeCharacter{0066}{f}%
+ \DeclareUnicodeCharacter{0067}{g}%
+ \DeclareUnicodeCharacter{0068}{h}%
+ \DeclareUnicodeCharacter{0069}{i}%
+ \DeclareUnicodeCharacter{006A}{j}%
+ \DeclareUnicodeCharacter{006B}{k}%
+ \DeclareUnicodeCharacter{006C}{l}%
+ \DeclareUnicodeCharacter{006D}{m}%
+ \DeclareUnicodeCharacter{006E}{n}%
+ \DeclareUnicodeCharacter{006F}{o}%
+ \DeclareUnicodeCharacter{0070}{p}%
+ \DeclareUnicodeCharacter{0071}{q}%
+ \DeclareUnicodeCharacter{0072}{r}%
+ \DeclareUnicodeCharacter{0073}{s}%
+ \DeclareUnicodeCharacter{0074}{t}%
+ \DeclareUnicodeCharacter{0075}{u}%
+ \DeclareUnicodeCharacter{0076}{v}%
+ \DeclareUnicodeCharacter{0077}{w}%
+ \DeclareUnicodeCharacter{0078}{x}%
+ \DeclareUnicodeCharacter{0079}{y}%
+ \DeclareUnicodeCharacter{007A}{z}%
+ \DeclareUnicodeCharacter{007B}{\char"7B }%
+ \DeclareUnicodeCharacter{007C}{\char"7C }%
+ \DeclareUnicodeCharacter{007D}{\char"7D }%
+ \DeclareUnicodeCharacter{007E}{\char"7E }%
+ % \DeclareUnicodeCharacter{007F}{} % DEL
+ %
\DeclareUnicodeCharacter{00A0}{\tie}%
\DeclareUnicodeCharacter{00A1}{\exclamdown}%
\DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
@@ -10438,7 +10570,7 @@ directory should work if nowhere else does.}
\DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
\DeclareUnicodeCharacter{00AF}{\={ }}%
%
- \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
+ \DeclareUnicodeCharacter{00B0}{\textdegree}%
\DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
\DeclareUnicodeCharacter{00B2}{$^2$}%
\DeclareUnicodeCharacter{00B3}{$^3$}%
@@ -10942,7 +11074,7 @@ directory should work if nowhere else does.}
%
\DeclareUnicodeCharacter{20AC}{\euro{}}%
%
- \DeclareUnicodeCharacter{2192}{\expansion{}}%
+ \DeclareUnicodeCharacter{2192}{\arrow}%
\DeclareUnicodeCharacter{21D2}{\result{}}%
%
% Mathematical symbols
@@ -11105,24 +11237,26 @@ directory should work if nowhere else does.}
% provide a definition macro to replace/pass-through a Unicode character
%
\def\DeclareUnicodeCharacterNative#1#2{%
- \catcode"#1=\active
- \def\dodeclareunicodecharacternative##1##2##3{%
+ \ifnum"#1>"7F % only make non-ASCII chars active
+ \catcode"#1=\active
+ \def\dodeclareunicodecharacternative##1##2##3{%
+ \begingroup
+ \uccode`\~="##2\relax
+ \uppercase{\gdef~}{%
+ \ifpassthroughchars
+ ##1%
+ \else
+ ##3%
+ \fi
+ }
+ \endgroup
+ }
\begingroup
- \uccode`\~="##2\relax
- \uppercase{\gdef~}{%
- \ifpassthroughchars
- ##1%
- \else
- ##3%
- \fi
- }
+ \uccode`\.="#1\relax
+ \uppercase{\def\UTFNativeTmp{.}}%
+ \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
\endgroup
- }
- \begingroup
- \uccode`\.="#1\relax
- \uppercase{\def\UTFNativeTmp{.}}%
- \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
- \endgroup
+ \fi
}
% Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
@@ -11151,14 +11285,14 @@ directory should work if nowhere else does.}
\relax
}
-% Define all Unicode characters we know about. This makes UTF-8 the default
-% input encoding and allows @U to work.
+% Define all Unicode characters we know about
\iftxinativeunicodecapable
\nativeunicodechardefsatu
\else
\utfeightchardefs
\fi
+
\message{formatting,}
\newdimen\defaultparindent \defaultparindent = 15pt
@@ -11205,13 +11339,9 @@ directory should work if nowhere else does.}
%
\vsize = #1\relax
\advance\vsize by \topskip
- \outervsize = \vsize
- \advance\outervsize by 2\topandbottommargin
\txipageheight = \vsize
%
\hsize = #2\relax
- \outerhsize = \hsize
- \advance\outerhsize by 0.5in
\txipagewidth = \hsize
%
\normaloffset = #4\relax
@@ -11301,7 +11431,7 @@ directory should work if nowhere else does.}
\textleading = 12.5pt
%
\internalpagesizes{160mm}{120mm}%
- {\voffset}{\hoffset}%
+ {\voffset}{-11.4mm}%
{\bindingoffset}{8pt}%
{210mm}{148mm}%
%
@@ -11380,9 +11510,138 @@ directory should work if nowhere else does.}
\hfuzz = 1pt
+\message{microtype,}
+
+% protrusion, from Thanh's protcode.tex.
+\def\mtsetprotcode#1{%
+ \rpcode#1`\!=200 \rpcode#1`\,=700 \rpcode#1`\-=700 \rpcode#1`\.=700
+ \rpcode#1`\;=500 \rpcode#1`\:=500 \rpcode#1`\?=200
+ \rpcode#1`\'=700
+ \rpcode#1 34=500 % ''
+ \rpcode#1 123=300 % --
+ \rpcode#1 124=200 % ---
+ \rpcode#1`\)=50 \rpcode#1`\A=50 \rpcode#1`\F=50 \rpcode#1`\K=50
+ \rpcode#1`\L=50 \rpcode#1`\T=50 \rpcode#1`\V=50 \rpcode#1`\W=50
+ \rpcode#1`\X=50 \rpcode#1`\Y=50 \rpcode#1`\k=50 \rpcode#1`\r=50
+ \rpcode#1`\t=50 \rpcode#1`\v=50 \rpcode#1`\w=50 \rpcode#1`\x=50
+ \rpcode#1`\y=50
+ %
+ \lpcode#1`\`=700
+ \lpcode#1 92=500 % ``
+ \lpcode#1`\(=50 \lpcode#1`\A=50 \lpcode#1`\J=50 \lpcode#1`\T=50
+ \lpcode#1`\V=50 \lpcode#1`\W=50 \lpcode#1`\X=50 \lpcode#1`\Y=50
+ \lpcode#1`\v=50 \lpcode#1`\w=50 \lpcode#1`\x=50 \lpcode#1`\y=0
+ %
+ \mtadjustprotcode#1\relax
+}
+
+\newcount\countC
+\def\mtadjustprotcode#1{%
+ \countC=0
+ \loop
+ \ifcase\lpcode#1\countC\else
+ \mtadjustcp\lpcode#1\countC
+ \fi
+ \ifcase\rpcode#1\countC\else
+ \mtadjustcp\rpcode#1\countC
+ \fi
+ \advance\countC 1
+ \ifnum\countC < 256 \repeat
+}
+
+\newcount\countB
+\def\mtadjustcp#1#2#3{%
+ \setbox\boxA=\hbox{%
+ \ifx#2\font\else#2\fi
+ \char#3}%
+ \countB=\wd\boxA
+ \multiply\countB #1#2#3\relax
+ \divide\countB \fontdimen6 #2\relax
+ #1#2#3=\countB\relax
+}
+
+\ifx\XeTeXrevision\thisisundefined
+ \ifx\luatexversion\thisisundefined
+ \ifpdf % pdfTeX
+ \mtsetprotcode\textrm
+ \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax}
+ \else % TeX
+ \def\mtfontexpand#1{}
+ \fi
+ \else % LuaTeX
+ \mtsetprotcode\textrm
+ \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax}
+ \fi
+\else % XeTeX
+ \mtsetprotcode\textrm
+ \def\mtfontexpand#1{}
+\fi
+
+
+\newif\ifmicrotype
+
+\def\microtypeON{%
+ \microtypetrue
+ %
+ \ifx\XeTeXrevision\thisisundefined
+ \ifx\luatexversion\thisisundefined
+ \ifpdf % pdfTeX
+ \pdfadjustspacing=2
+ \pdfprotrudechars=2
+ \fi
+ \else % LuaTeX
+ \adjustspacing=2
+ \protrudechars=2
+ \fi
+ \else % XeTeX
+ \XeTeXprotrudechars=2
+ \fi
+ %
+ \mtfontexpand\textrm
+ \mtfontexpand\textsl
+ \mtfontexpand\textbf
+}
+
+\def\microtypeOFF{%
+ \microtypefalse
+ %
+ \ifx\XeTeXrevision\thisisundefined
+ \ifx\luatexversion\thisisundefined
+ \ifpdf % pdfTeX
+ \pdfadjustspacing=0
+ \pdfprotrudechars=0
+ \fi
+ \else % LuaTeX
+ \adjustspacing=0
+ \protrudechars=0
+ \fi
+ \else % XeTeX
+ \XeTeXprotrudechars=0
+ \fi
+}
+
+\microtypeOFF
+
+\parseargdef\microtype{%
+ \def\txiarg{#1}%
+ \ifx\txiarg\onword
+ \microtypeON
+ \else\ifx\txiarg\offword
+ \microtypeOFF
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @microtype option `\txiarg', must be on|off}%
+ \fi\fi
+}
+
+
\message{and turning on texinfo input format.}
+% Make UTF-8 the default encoding.
+\documentencodingzzz{UTF-8}
+
\def^^L{\par} % remove \outer, so ^L can appear in an @comment
+\catcode`\^^K = 10 % treat vertical tab as whitespace
% DEL is a comment character, in case @c does not suffice.
\catcode`\^^? = 14
@@ -11398,23 +11657,6 @@ directory should work if nowhere else does.}
\catcode`\|=\other \def\normalverticalbar{|}
\catcode`\~=\other \def\normaltilde{~}
-% This macro is used to make a character print one way in \tt
-% (where it can probably be output as-is), and another way in other fonts,
-% where something hairier probably needs to be done.
-%
-% #1 is what to print if we are indeed using \tt; #2 is what to print
-% otherwise. Since all the Computer Modern typewriter fonts have zero
-% interword stretch (and shrink), and it is reasonable to expect all
-% typewriter fonts to have this, we can check that font parameter.
-%
-\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
-
-% Same as above, but check for italic font. Actually this also catches
-% non-italic slanted fonts since it is impossible to distinguish them from
-% italic fonts. But since this is only used by $ and it uses \sl anyway
-% this is not a problem.
-\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
-
% Set catcodes for Texinfo file
% Active characters for printing the wanted glyph.
@@ -11460,23 +11702,32 @@ directory should work if nowhere else does.}
% Used sometimes to turn off (effectively) the active characters even after
% parsing them.
\def\turnoffactive{%
- \normalturnoffactive
+ \passthroughcharstrue
+ \let-=\normaldash
+ \let"=\normaldoublequote
+ \let$=\normaldollar %$ font-lock fix
+ \let+=\normalplus
+ \let<=\normalless
+ \let>=\normalgreater
+ \let^=\normalcaret
+ \let_=\normalunderscore
+ \let|=\normalverticalbar
+ \let~=\normaltilde
\otherbackslash
+ \setregularquotes
+ \unsepspaces
}
-\catcode`\@=0
+% If a .fmt file is being used, characters that might appear in a file
+% name cannot be active until we have parsed the command line.
+% So turn them off again, and have \loadconf turn them back on.
+\catcode`+=\other \catcode`\_=\other
+
% \backslashcurfont outputs one backslash character in current font,
% as in \char`\\.
\global\chardef\backslashcurfont=`\\
-% \realbackslash is an actual character `\' with catcode other.
-{\catcode`\\=\other @gdef@realbackslash{\}}
-
-% In Texinfo, backslash is an active character; it prints the backslash
-% in fixed width font.
-\catcode`\\=\active % @ for escape char from now on.
-
% Print a typewriter backslash. For math mode, we can't simply use
% \backslashcurfont: the story here is that in math mode, the \char
% of \backslashcurfont ends up printing the roman \ from the math symbol
@@ -11486,109 +11737,120 @@ directory should work if nowhere else does.}
% ignored family value; char position "5C). We can't use " for the
% usual hex value because it has already been made active.
-@def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
-@let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
-
-% \otherbackslash defines an active \ to be a literal `\' character with
-% catcode other.
-@gdef@otherbackslash{@let\=@realbackslash}
-
-% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
-% the literal character `\'.
-%
-{@catcode`- = @active
- @gdef@normalturnoffactive{%
- @passthroughcharstrue
- @let-=@normaldash
- @let"=@normaldoublequote
- @let$=@normaldollar %$ font-lock fix
- @let+=@normalplus
- @let<=@normalless
- @let>=@normalgreater
- @let^=@normalcaret
- @let_=@normalunderscore
- @let|=@normalverticalbar
- @let~=@normaltilde
- @let\=@ttbackslash
- @setregularquotes
- @unsepspaces
- }
-}
+\def\ttbackslash{{\tt \ifmmode \mathchar29020 \else \backslashcurfont \fi}}
+\let\backslashchar = \ttbackslash % \backslashchar{} is for user documents.
-% If a .fmt file is being used, characters that might appear in a file
-% name cannot be active until we have parsed the command line.
-% So turn them off again, and have @fixbackslash turn them back on.
-@catcode`+=@other @catcode`@_=@other
-
-% \enablebackslashhack - allow file to begin `\input texinfo'
-%
-% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
-% That is what \eatinput is for; after that, the `\' should revert to printing
-% a backslash.
-% If the file did not have a `\input texinfo', then it is turned off after
-% the first line; otherwise the first `\' in the file would cause an error.
-% This is used on the very last line of this file, texinfo.tex.
-% We also use @c to call @fixbackslash, in case ends of lines are hidden.
-{
-@catcode`@^=7
-@catcode`@^^M=13@gdef@enablebackslashhack{%
- @global@let\ = @eatinput%
- @catcode`@^^M=13%
- @def@c{@fixbackslash@c}%
- % Definition for the newline at the end of this file.
- @def ^^M{@let^^M@secondlinenl}%
- % Definition for a newline in the main Texinfo file.
- @gdef @secondlinenl{@fixbackslash}%
+% These are made active for url-breaking, so need
+% active definitions as the normal characters.
+\def\normaldot{.}
+\def\normalquest{?}
+\def\normalslash{/}
+
+% \newlinesloadsconf - call \loadconf as soon as possible in the
+% file, e.g. at the first newline.
+%
+{\catcode`\^=7
+\catcode`\^^M=13
+\gdef\newlineloadsconf{%
+ \catcode`\^^M=13 %
+ \newlineloadsconfzz%
+}
+\gdef\newlineloadsconfzz#1^^M{%
+ \def\c{\loadconf\c}%
+ % Definition for the first newline read in the file
+ \def ^^M{\loadconf}%
% In case the first line has a whole-line command on it
- @let@originalparsearg@parsearg
- @def@parsearg{@fixbackslash@originalparsearg}
+ \let\originalparsearg\parsearg%
+ \def\parsearg{\loadconf\originalparsearg}%
}}
-{@catcode`@^=7 @catcode`@^^M=13%
-@gdef@eatinput input texinfo#1^^M{@fixbackslash}}
% Emergency active definition of newline, in case an active newline token
% appears by mistake.
-{@catcode`@^=7 @catcode13=13%
-@gdef@enableemergencynewline{%
- @gdef^^M{%
- @par%
- %<warning: active newline>@par%
+{\catcode`\^=7 \catcode13=13%
+\gdef\enableemergencynewline{%
+ \gdef^^M{%
+ \par%
+ %<warning: active newline>\par%
}}}
-@gdef@fixbackslash{%
- @ifx\@eatinput @let\ = @ttbackslash @fi
- @catcode13=5 % regular end of line
- @enableemergencynewline
- @let@c=@comment
- @let@parsearg@originalparsearg
+% \loadconf gets called at the beginning of every Texinfo file.
+% If texinfo.cnf is present on the system, read it. Useful for site-wide
+% @afourpaper, etc. Not opening texinfo.cnf directly in texinfo.tex
+% makes it possible to make a format file for Texinfo.
+%
+\gdef\loadconf{%
+ \relax % Terminate the filename if running as "tex '&texinfo' FILE.texi".
+ %
+ % Turn off the definitions that trigger \loadconf
+ \everyjobreset
+ \catcode13=5 % regular end of line
+ \enableemergencynewline
+ \let\c=\comment
+ \let\parsearg\originalparsearg
+ %
% Also turn back on active characters that might appear in the input
% file name, in case not using a pre-dumped format.
- @catcode`+=@active
- @catcode`@_=@active
- %
- % If texinfo.cnf is present on the system, read it.
- % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
- % called at the beginning of every Texinfo file. Not opening texinfo.cnf
- % directly in this file, texinfo.tex, makes it possible to make a format
- % file for Texinfo.
+ \catcode`+=\active
+ \catcode`\_=\active
%
- @openin 1 texinfo.cnf
- @ifeof 1 @else @input texinfo.cnf @fi
- @closein 1
+ \openin 1 texinfo.cnf
+ \ifeof 1 \else \input texinfo.cnf \fi
+ \closein 1
}
+% Redefine some control sequences to be controlled by the \ifdummies
+% and \ifindexnofonts switches. Do this at the end so that the control
+% sequences are all defined.
+\definedummies
+
+
+
+
+\catcode`\@=0
+
+% \realbackslash is an actual character `\' with catcode other.
+{\catcode`\\=\other @gdef@realbackslash{\}}
+
+% In Texinfo, backslash is an active character; it prints the backslash
+% in fixed width font.
+\catcode`\\=\active % @ for escape char from now on.
+
+@let\ = @ttbackslash
+
+% If in a .fmt file, print the version number.
+% \eatinput stops the `\input texinfo' from showing up.
+% After that, `\' should revert to printing a backslash.
+% Turn on active characters that we couldn't do earlier because
+% they might have appeared in the input file name.
+%
+@everyjob{@message{[Texinfo version @texinfoversion]}%
+ @global@let\ = @eatinput
+ @catcode`+=@active @catcode`@_=@active}
+
+{@catcode`@^=7 @catcode`@^^M=13%
+@gdef@eatinput input texinfo#1^^M{@loadconf}}
+
+@def@everyjobreset{@ifx\@eatinput @let\ = @ttbackslash @fi}
+
+% \otherbackslash defines an active \ to be a literal `\' character with
+% catcode other.
+@gdef@otherbackslash{@let\=@realbackslash}
+
+% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
+% the literal character `\'.
+%
+{@catcode`- = @active
+ @gdef@normalturnoffactive{%
+ @turnoffactive
+ @let\=@ttbackslash
+ }
+}
% Say @foo, not \foo, in error messages.
@escapechar = `@@
-% These (along with & and #) are made active for url-breaking, so need
-% active definitions as the normal characters.
-@def@normaldot{.}
-@def@normalquest{?}
-@def@normalslash{/}
-
% These look ok in all fonts, so just make them not special.
% @hashchar{} gets its own user-level command, because of #line.
@catcode`@& = @other @def@normalamp{&}
@@ -11603,15 +11865,11 @@ directory should work if nowhere else does.}
@c Do this last of all since we use ` in the previous @catcode assignments.
@catcode`@'=@active
@catcode`@`=@active
-@setregularquotes
@c Local variables:
@c eval: (add-hook 'before-save-hook 'time-stamp nil t)
@c time-stamp-pattern: "texinfoversion{%Y-%02m-%02d.%02H}"
-@c page-delimiter: "^\\\\message\\|emacs-page"
+@c page-delimiter: "^\\\\message"
@c End:
-@c vim:sw=2:
-
-@enablebackslashhack
-
+@newlineloadsconf
diff --git a/doc/wordlist b/doc/wordlist
index 5342b675..8deb26ab 100644
--- a/doc/wordlist
+++ b/doc/wordlist
@@ -49,6 +49,7 @@ BOOL
BREs
BSIZE
BTL
+BUFFERPIPE
BWK
Banzai
BeOS
@@ -351,6 +352,7 @@ Nextfile
Nlines
NoSQL
Nof
+Noflush
Nonalphabetic
Nonconstant
Nondecimal
@@ -1233,6 +1235,7 @@ libgcc
libintl
libmawk
libs
+libsigsegv
libtool
licensors
lineannotation
@@ -1571,6 +1574,7 @@ readline
realdata
realloc
realprogram
+rec
recomputation
redir
reenable
@@ -1759,6 +1763,7 @@ tlines
tm
tmp
tmy
+tocsv
tolower
toolset
toupper
diff --git a/doc/wordlist3 b/doc/wordlist3
index d8846134..cc71f108 100644
--- a/doc/wordlist3
+++ b/doc/wordlist3
@@ -59,6 +59,7 @@ compl
coprocess
coprocesses
cos
+csv
datespec
dcgettext
dcngettext
diff --git a/extras/Makefile.in b/extras/Makefile.in
index 9686adce..8b0f9b36 100644
--- a/extras/Makefile.in
+++ b/extras/Makefile.in
@@ -120,11 +120,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
- $(top_srcdir)/m4/libsigsegv.m4 $(top_srcdir)/m4/longlong.m4 \
- $(top_srcdir)/m4/mpfr.m4 $(top_srcdir)/m4/nls.m4 \
- $(top_srcdir)/m4/noreturn.m4 $(top_srcdir)/m4/pma.m4 \
- $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
- $(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/socket.m4 \
+ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/mpfr.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/noreturn.m4 \
+ $(top_srcdir)/m4/pma.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/readline.m4 \
+ $(top_srcdir)/m4/socket.m4 \
$(top_srcdir)/m4/triplet-transformation.m4 \
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -214,7 +214,6 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GREP = @GREP@
-HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -229,13 +228,10 @@ LIBMPFR = @LIBMPFR@
LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
-LIBSIGSEGV = @LIBSIGSEGV@
-LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
-LTLIBSIGSEGV = @LTLIBSIGSEGV@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
diff --git a/field.c b/field.c
index 343a3100..0f0f5192 100644
--- a/field.c
+++ b/field.c
@@ -59,12 +59,15 @@ static long sc_parse_field(long, char **, int, NODE *,
Regexp *, Setfunc, NODE *, NODE *, bool);
static long fw_parse_field(long, char **, int, NODE *,
Regexp *, Setfunc, NODE *, NODE *, bool);
+static long comma_parse_field(long, char **, int, NODE *,
+ Regexp *, Setfunc, NODE *, NODE *, bool);
static const awk_fieldwidth_info_t *api_fw = NULL;
static long fpat_parse_field(long, char **, int, NODE *,
Regexp *, Setfunc, NODE *, NODE *, bool);
static void set_element(long num, char * str, long len, NODE *arr);
static void grow_fields_arr(long num);
static void set_field(long num, char *str, long len, NODE *dummy);
+static void set_comma_field(long num, char *str, long len, NODE *dummy);
static void purge_record(void);
static char *parse_extent; /* marks where to restart parse of record */
@@ -111,6 +114,15 @@ init_fields()
field0_valid = true;
}
+/* init_csv_fields --- set up to handle --csv */
+
+void
+init_csv_fields(void)
+{
+ if (do_csv)
+ parse_field = comma_parse_field;
+}
+
/* grow_fields --- acquire new fields as needed */
static void
@@ -147,6 +159,27 @@ set_field(long num,
n->flags = (STRCUR|STRING|USER_INPUT); /* do not set MALLOC */
}
+/* set_comma_field --- set the value of a particular field, coming from CSV */
+
+/*ARGSUSED*/
+static void
+set_comma_field(long num,
+ char *str,
+ long len,
+ NODE *dummy ATTRIBUTE_UNUSED) /* just to make interface same as set_element */
+{
+ NODE *n;
+ NODE *val = make_string(str, len);
+
+ if (num > nf_high_water)
+ grow_fields_arr(num);
+ n = fields_arr[num];
+ n->stptr = val->stptr;
+ n->stlen = val->stlen;
+ n->flags = (STRCUR|STRING|USER_INPUT|MALLOC);
+ freenode(val);
+}
+
/* rebuild_record --- Someone assigned a value to $(something).
Fix up $0 to be right */
@@ -741,6 +774,113 @@ sc_parse_field(long up_to, /* parse only up to this field number */
}
/*
+ * comma_parse_field --- CSV parsing same as BWK awk.
+ *
+ * This is called both from get_field() and from do_split()
+ * via (*parse_field)(). This variation is for when FS is a comma,
+ * we do very basic CSV parsing, the same as BWK awk.
+ */
+
+static long
+comma_parse_field(long up_to, /* parse only up to this field number */
+ char **buf, /* on input: string to parse; on output: point to start next */
+ int len,
+ NODE *fs,
+ Regexp *rp ATTRIBUTE_UNUSED,
+ Setfunc set, /* routine to set the value of the parsed field */
+ NODE *n,
+ NODE *sep_arr, /* array of field separators (maybe NULL) */
+ bool in_middle ATTRIBUTE_UNUSED)
+{
+ char *scan = *buf;
+ static const char comma = ',';
+ long nf = parse_high_water;
+ char *end = scan + len;
+
+ static char *newfield = NULL;
+ static size_t buflen = 0;
+
+ if (newfield == NULL) {
+ emalloc(newfield, char *, BUFSIZ, "comma_parse_field");
+ buflen = BUFSIZ;
+ }
+
+ if (set == set_field) // not an array element
+ set = set_comma_field;
+
+ if (up_to == UNLIMITED)
+ nf = 0;
+
+ if (len == 0) {
+ (*set)(++nf, newfield, 0L, n);
+ return nf;
+ }
+
+ for (; nf < up_to;) {
+ char *new_end = newfield;
+ memset(newfield, '\0', buflen);
+
+ while (*scan != comma && scan < end) {
+ if (*scan == '"') {
+ for (scan++; scan < end;) {
+ // grow buffer if needed
+ if (new_end >= newfield + buflen) {
+ size_t offset = buflen;
+
+ buflen *= 2;
+ erealloc(newfield, char *, buflen, "comma_parse_field");
+ new_end = newfield + offset;
+ }
+
+ if (*scan == '"' && scan[1] == '"') { // "" -> "
+ *new_end++ = '"';
+ scan += 2;
+ } else if (*scan == '"' && (scan == end-1 || scan[1] == comma)) {
+ // close of quoted string
+ scan++;
+ break;
+ } else {
+ *new_end++ = *scan++;
+ }
+ }
+ } else {
+ // unquoted field
+ while (*scan != comma && scan < end) {
+ // grow buffer if needed
+ if (new_end >= newfield + buflen) {
+ size_t offset = buflen;
+
+ buflen *= 2;
+ erealloc(newfield, char *, buflen, "comma_parse_field");
+ new_end = newfield + offset;
+ }
+ *new_end++ = *scan++;
+ }
+ }
+ }
+
+ (*set)(++nf, newfield, (long)(new_end - newfield), n);
+
+ if (scan == end)
+ break;
+
+ if (scan == *buf) {
+ scan++;
+ continue;
+ }
+
+ scan++;
+ if (scan == end) { /* FS at end of record */
+ (*set)(++nf, newfield, 0L, n);
+ break;
+ }
+ }
+
+ *buf = scan;
+ return nf;
+}
+
+/*
* calc_mbslen --- calculate the length in bytes of a multi-byte string
* containing len characters.
*/
@@ -1033,7 +1173,10 @@ do_split(int nargs)
if ((sep->flags & REGEX) != 0)
sep = sep->typed_re;
- if ( (sep->re_flags & FS_DFLT) != 0
+ if (do_csv && (sep->re_flags & FS_DFLT) != 0 && nargs == 3) {
+ fs = NULL;
+ parseit = comma_parse_field;
+ } else if ( (sep->re_flags & FS_DFLT) != 0
&& current_field_sep() == Using_FS
&& ! RS_is_null) {
parseit = parse_field;
@@ -1146,11 +1289,29 @@ do_patsplit(int nargs)
static void
set_parser(parse_field_func_t func)
{
+ /*
+ * Setting FS does nothing if CSV mode, warn in that case,
+ * but don't warn on first call which happens at initialization.
+ */
+ static bool first_time = true;
+ static bool warned = false;
+
+ if (! first_time && do_csv) {
+ if (! warned) {
+ warned = true;
+ warning(_("assignment to FS/FIELDWIDTHS/FPAT has no effect when using --csv"));
+ }
+ return;
+ }
+
normal_parse_field = func;
if (! api_parser_override && parse_field != func) {
parse_field = func;
update_PROCINFO_str("FS", current_field_sep_str());
}
+
+ if (first_time)
+ first_time = false;
}
/* set_FIELDWIDTHS --- handle an assignment to FIELDWIDTHS */
@@ -1309,7 +1470,8 @@ set_FS()
save_rs = dupnode(RS_node->var_value);
resave_fs = true;
- /* If FS_re_no_case assignment is fatal (make_regexp in remake_re)
+ /*
+ * If FS_re_no_case assignment is fatal (make_regexp in remake_re)
* FS_regexp will be NULL with a non-null FS_re_yes_case.
* refree() handles null argument; no need for `if (FS_regexp != NULL)' below.
* Please do not remerge.
diff --git a/io.c b/io.c
index dcbec287..dccf3952 100644
--- a/io.c
+++ b/io.c
@@ -260,10 +260,12 @@ static void find_input_parser(IOBUF *iop);
static bool find_output_wrapper(awk_output_buf_t *outbuf);
static void init_output_wrapper(awk_output_buf_t *outbuf);
static bool find_two_way_processor(const char *name, struct redirect *rp);
+static bool avoid_flush(const char *name);
static RECVALUE rs1scan(IOBUF *iop, struct recmatch *recm, SCANSTATE *state);
static RECVALUE rsnullscan(IOBUF *iop, struct recmatch *recm, SCANSTATE *state);
static RECVALUE rsrescan(IOBUF *iop, struct recmatch *recm, SCANSTATE *state);
+static RECVALUE csvscan(IOBUF *iop, struct recmatch *recm, SCANSTATE *state);
static RECVALUE (*matchrec)(IOBUF *iop, struct recmatch *recm, SCANSTATE *state) = rs1scan;
@@ -340,6 +342,15 @@ init_io()
read_can_timeout = true;
}
+/* init_csv_records --- set up for CSV handling */
+
+void
+init_csv_records(void)
+{
+ if (do_csv)
+ matchrec = csvscan;
+}
+
#if defined(__MINGW32__) || defined(__CYGWIN__)
/* binmode --- convert BINMODE to string for fopen */
@@ -951,7 +962,11 @@ redirect_string(const char *str, size_t explen, bool not_string,
/* set close-on-exec */
os_close_on_exec(fileno(rp->output.fp), str, "pipe", "to");
- rp->flag |= RED_FLUSH;
+
+ // Allow the user to say they don't want pipe output
+ // to be flushed all the time.
+ if (! avoid_flush(str))
+ rp->flag |= RED_FLUSH;
break;
case redirect_pipein:
if (extfd >= 0) {
@@ -3815,6 +3830,56 @@ find_longest_terminator:
return REC_OK;
}
+/* csvscan --- handle --csv mode */
+
+static RECVALUE
+csvscan(IOBUF *iop, struct recmatch *recm, SCANSTATE *state)
+{
+ char *bp;
+ char rs = '\n';
+ static bool in_quote = false;
+
+ memset(recm, '\0', sizeof(struct recmatch));
+ *(iop->dataend) = rs; /* set sentinel */
+ recm->start = iop->off; /* beginning of record */
+
+ if (*state == NOSTATE) /* reset in_quote at the beginning of the record */
+ in_quote = false;
+
+ bp = iop->off;
+ if (*state == INDATA) /* skip over data we've already seen */
+ bp += iop->scanoff;
+
+ /* look for a newline outside quotes */
+ do {
+ while (*bp != rs) {
+ if (*bp == '\"')
+ in_quote = ! in_quote;
+ bp++;
+ }
+ if (bp > iop->off && bp[-1] == '\r') {
+ // convert CR-LF to LF by shifting the record
+ memmove(bp - 1, bp, iop->dataend - bp);
+ iop->dataend--;
+ bp--;
+ }
+ } while (in_quote && bp < iop->dataend && bp++);
+
+ /* set len to what we have so far, in case this is all there is */
+ recm->len = bp - recm->start;
+
+ if (bp < iop->dataend) { /* found it in the buffer */
+ recm->rt_start = bp;
+ recm->rt_len = 1;
+ *state = NOSTATE;
+ return REC_OK;
+ } else {
+ *state = INDATA;
+ iop->scanoff = bp - iop->off;
+ return NOTERM;
+ }
+}
+
/* retryable --- return true if PROCINFO[<filename>, "RETRY"] exists */
static inline int
@@ -4064,6 +4129,13 @@ get_a_record(char **out, /* pointer to pointer to data */
void
set_RS()
{
+ /*
+ * Setting RS does nothing if CSV mode, warn in that case,
+ * but don't warn on first call which happens at initialization.
+ */
+ static bool first_time = true;
+ static bool warned = false;
+
static NODE *save_rs = NULL;
/*
@@ -4094,9 +4166,18 @@ set_RS()
refree(RS_re[1]);
RS_re[0] = RS_re[1] = RS_regexp = NULL;
+ if (! first_time && do_csv) {
+ if (! warned) {
+ warned = true;
+ warning(_("assignment to RS has no effect when using --csv"));
+ }
+ return;
+ }
+
if (RS->stlen == 0) {
RS_is_null = true;
- matchrec = rsnullscan;
+ if (first_time || ! do_csv)
+ matchrec = rsnullscan;
} else if ((RS->stlen > 1 || (RS->flags & REGEX) != 0) && ! do_traditional) {
static bool warned = false;
@@ -4104,17 +4185,23 @@ set_RS()
RS_re[1] = make_regexp(RS->stptr, RS->stlen, true, true, true);
RS_regexp = RS_re[IGNORECASE];
- matchrec = rsrescan;
+ if (first_time || ! do_csv)
+ matchrec = rsrescan;
if (do_lint_extensions && ! warned) {
lintwarn(_("multicharacter value of `RS' is a gawk extension"));
warned = true;
}
- } else
- matchrec = rs1scan;
+ } else {
+ if (first_time || ! do_csv)
+ matchrec = rs1scan;
+ }
set_FS:
if (current_field_sep() == Using_FS)
set_FS();
+
+ if (first_time)
+ first_time = false;
}
@@ -4486,3 +4573,14 @@ init_output_wrapper(awk_output_buf_t *outbuf)
outbuf->gawk_ferror = gawk_ferror;
outbuf->gawk_fclose = gawk_fclose;
}
+
+/* avoid_flush --- return true if should not flush a pipe every time */
+
+static bool
+avoid_flush(const char *name)
+{
+ static const char bufferpipe[] = "BUFFERPIPE";
+
+ return in_PROCINFO(bufferpipe, NULL, NULL) != NULL
+ || in_PROCINFO(name, bufferpipe, NULL) != NULL;
+}
diff --git a/m4/ChangeLog b/m4/ChangeLog
index fb13cf09..1292cfd0 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,7 @@
+2022-12-01 Arnold D. Robbins <arnold@skeeve.com>
+
+ * libsigsegv.m4: Removed.
+
2022-11-27 Arnold D. Robbins <arnold@skeeve.com>
* pma.m4: Don't build an x86 binary on non-x86 macOS systems.
diff --git a/m4/libsigsegv.m4 b/m4/libsigsegv.m4
deleted file mode 100644
index 9d255d3b..00000000
--- a/m4/libsigsegv.m4
+++ /dev/null
@@ -1,16 +0,0 @@
-# libsigsegv.m4 serial 4
-dnl Copyright (C) 2002-2003, 2008-2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible, Sam Steingold.
-
-AC_DEFUN([gl_LIBSIGSEGV],
-[
- AC_LIB_HAVE_LINKFLAGS([sigsegv], [],
- [#include <sigsegv.h>], [sigsegv_deinstall_handler();],
- [no, consider installing GNU libsigsegv])
- dnl Some other autoconf macros and clisp's configure use this variable.
- gl_cv_lib_sigsegv="$ac_cv_libsigsegv"
-])
diff --git a/main.c b/main.c
index ba6eda3d..c161e8ee 100644
--- a/main.c
+++ b/main.c
@@ -34,16 +34,6 @@
#include <mcheck.h>
#endif
-#ifdef HAVE_LIBSIGSEGV
-#include <sigsegv.h>
-#else
-typedef void *stackoverflow_context_t;
-/* the argument to this macro is purposely not used */
-#define sigsegv_install_handler(catchsegv) signal(SIGSEGV, catchsig)
-/* define as 0 rather than empty so that (void) cast on it works */
-#define stackoverflow_install_handler(catchstackoverflow, extra_stack, STACK_SIZE) 0
-#endif
-
#define DEFAULT_PROFILE "awkprof.out" /* where to put profile */
#define DEFAULT_VARFILE "awkvars.out" /* where to put vars */
#define DEFAULT_PREC 53
@@ -60,10 +50,6 @@ static void init_vars(void);
static NODE *load_environ(void);
static NODE *load_procinfo(void);
static void catchsig(int sig);
-#ifdef HAVE_LIBSIGSEGV
-static int catchsegv(void *fault_address, int serious);
-static void catchstackoverflow(int emergency, stackoverflow_context_t scp);
-#endif
static void nostalgia(void) ATTRIBUTE_NORETURN;
static void version(void) ATTRIBUTE_NORETURN;
static void init_fds(void);
@@ -185,6 +171,7 @@ static const struct option optab[] = {
{ "bignum", no_argument, NULL, 'M' },
{ "characters-as-bytes", no_argument, & do_binary, 'b' },
{ "copyright", no_argument, NULL, 'C' },
+ { "csv", no_argument, NULL, 'k' },
{ "debug", optional_argument, NULL, 'D' },
{ "dump-variables", optional_argument, NULL, 'd' },
{ "exec", required_argument, NULL, 'E' },
@@ -226,7 +213,6 @@ int
main(int argc, char **argv)
{
int i;
- char *extra_stack;
bool have_srcfile = false;
SRCFILE *s;
char *cp;
@@ -291,6 +277,7 @@ main(int argc, char **argv)
#endif
set_locale_stuff();
+ (void) signal(SIGSEGV, catchsig);
(void) signal(SIGFPE, catchsig);
#ifdef SIGBUS
(void) signal(SIGBUS, catchsig);
@@ -311,12 +298,6 @@ main(int argc, char **argv)
*/
ignore_sigpipe();
- (void) sigsegv_install_handler(catchsegv);
-#define STACK_SIZE (16*1024)
- emalloc(extra_stack, char *, STACK_SIZE, "main");
- (void) stackoverflow_install_handler(catchstackoverflow, extra_stack, STACK_SIZE);
-#undef STACK_SIZE
-
/* initialize the null string */
Nnull_string = make_string("", 0);
@@ -395,6 +376,9 @@ main(int argc, char **argv)
}
}
+ if (do_csv && do_posix)
+ fatal(_("`--posix' and `--csv' conflict"));
+
if (do_lint) {
if (os_is_setuid())
lintwarn(_("running %s setuid root may be a security problem"), myname);
@@ -435,6 +419,10 @@ main(int argc, char **argv)
/* Set up the special variables */
init_vars();
+ /* set up CSV */
+ init_csv_records();
+ init_csv_fields();
+
/* Set up the field variables */
init_fields();
@@ -577,10 +565,6 @@ main(int argc, char **argv)
if (do_tidy_mem)
release_all_vars();
- /* keep valgrind happier */
- if (extra_stack)
- efree(extra_stack);
-
final_exit(exit_val);
return exit_val; /* to suppress warnings */
}
@@ -648,6 +632,7 @@ usage(int exitval, FILE *fp)
fputs(_("\t-h\t\t\t--help\n"), fp);
fputs(_("\t-i includefile\t\t--include=includefile\n"), fp);
fputs(_("\t-I\t\t\t--trace\n"), fp);
+ fputs(_("\t-k\t\t\t--csv\n"), fp);
fputs(_("\t-l library\t\t--load=library\n"), fp);
/*
* TRANSLATORS: the "fatal", "invalid" and "no-ext" here are literal
@@ -1129,6 +1114,9 @@ load_procinfo()
update_PROCINFO_str("pma", get_pma_version());
#endif /* USE_PERSISTENT_MALLOC */
+ if (do_csv)
+ update_PROCINFO_num("CSV", 1);
+
load_procinfo_argv();
return PROCINFO_node;
}
@@ -1358,37 +1346,6 @@ catchsig(int sig)
/* NOTREACHED */
}
-#ifdef HAVE_LIBSIGSEGV
-/* catchsegv --- for use with libsigsegv */
-
-static int
-catchsegv(void *fault_address, int serious)
-{
- if (errcount > 0) // assume a syntax error corrupted our data structures
- exit(EXIT_FATAL);
-
- set_loc(__FILE__, __LINE__);
- msg(_("fatal error: internal error: segfault"));
- fflush(NULL);
- abort();
- /*NOTREACHED*/
- return 0;
-}
-
-/* catchstackoverflow --- for use with libsigsegv */
-
-static void
-catchstackoverflow(int emergency, stackoverflow_context_t scp)
-{
- set_loc(__FILE__, __LINE__);
- msg(_("fatal error: internal error: stack overflow"));
- fflush(NULL);
- abort();
- /*NOTREACHED*/
- return;
-}
-#endif /* HAVE_LIBSIGSEGV */
-
/* nostalgia --- print the famous error message and die */
static void
@@ -1624,7 +1581,7 @@ parse_args(int argc, char **argv)
/*
* The + on the front tells GNU getopt not to rearrange argv.
*/
- const char *optlist = "+F:f:v:W;bcCd::D::e:E:ghi:Il:L::nNo::Op::MPrSstVYZ:";
+ const char *optlist = "+F:f:v:W;bcCd::D::e:E:ghi:kIl:L::nNo::Op::MPrSstVYZ:";
int old_optind;
int c;
char *scan;
@@ -1723,6 +1680,10 @@ parse_args(int argc, char **argv)
do_itrace = true;
break;
+ case 'k': // k is for "comma". it's a stretch, I know
+ do_flags |= DO_CSV;
+ break;
+
case 'l':
(void) add_srcfile(SRC_EXTLIB, optarg, srcfiles, NULL, NULL);
break;
diff --git a/node.c b/node.c
index ce59ff87..f2871bea 100644
--- a/node.c
+++ b/node.c
@@ -454,7 +454,8 @@ make_str_node(const char *s, size_t len, int flags)
c = *pf++;
if (c == '\\') {
- c = parse_escape(&pf);
+ bool unicode;
+ c = parse_escape(&pf, &unicode);
if (c < 0) {
if (do_lint)
lintwarn(_("backslash string continuation is not portable"));
@@ -462,7 +463,23 @@ make_str_node(const char *s, size_t len, int flags)
continue;
c = '\\';
}
- *ptm++ = c;
+ if (unicode) {
+ char buf[20];
+ size_t n;
+ mbstate_t mbs;
+ int i;
+
+ memset(& mbs, 0, sizeof(mbs));
+
+ n = wcrtomb(buf, c, & mbs);
+ if (n == (size_t) -1) // bad value
+ *ptm++ = '?';
+ else {
+ for (i = 0; i < n; i++)
+ *ptm++ = buf[i];
+ }
+ } else
+ *ptm++ = c;
} else
*ptm++ = c;
}
@@ -540,11 +557,11 @@ r_unref(NODE *tmp)
* If \ is followed by 000, we return 0 and leave the string pointer after the
* zeros. A value of 0 does not mean end of string.
*
- * POSIX doesn't allow \x.
+ * POSIX doesn't allow \x or \u.
*/
int
-parse_escape(const char **string_ptr)
+parse_escape(const char **string_ptr, bool *unicode)
{
int c = *(*string_ptr)++;
int i;
@@ -552,6 +569,8 @@ parse_escape(const char **string_ptr)
int j;
const char *start;
+ *unicode = false;
+
if (do_lint_old) {
switch (c) {
case 'a':
@@ -638,6 +657,40 @@ parse_escape(const char **string_ptr)
if (do_lint && j == 2 && isxdigit((unsigned char)*(*string_ptr)))
lintwarn(_("hex escape \\x%.*s of %d characters probably not interpreted the way you expect"), 3, start, 3);
return i;
+ case 'u':
+ if (do_lint) {
+ static bool warned = false;
+
+ if (! warned) {
+ warned = true;
+ lintwarn(_("POSIX does not allow `\\u' escapes"));
+ }
+ }
+ if (do_posix)
+ return ('u');
+ if (! isxdigit((unsigned char) (*string_ptr)[0])) {
+ warning(_("no hex digits in `\\u' escape sequence"));
+ return ('u');
+ }
+ start = *string_ptr;
+ for (i = j = 0; j < 8; j++) {
+ /* do outside test to avoid multiple side effects */
+ c = (unsigned char) *(*string_ptr)++;
+ if (isxdigit(c)) {
+ i *= 16;
+ if (isdigit(c))
+ i += c - '0';
+ else if (isupper(c))
+ i += c - 'A' + 10;
+ else
+ i += c - 'a' + 10;
+ } else {
+ (*string_ptr)--;
+ break;
+ }
+ }
+ *unicode = true;
+ return i;
case '\\':
case '"':
return c;
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 0da31a42..58164fde 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,8 +1,25 @@
2023-04-13 Arnold D. Robbins <arnold@skeeve.com>
+ * Makefile.tst: Regenerated.
* config.h: Regenerated.
* Makefile.tst: Regenerated.
+2023-03-24 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
+2023-03-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
+2023-03-17 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
+2023-03-16 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
2023-03-12 Eli Zaretskii <eliz@gnu.org>
* Makefile.ext (readdir_test.$(SOEXT)): Fix typo.
@@ -75,6 +92,10 @@
* Makefile.tst: Regenerated.
+2022-08-29 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
2022-08-25 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index d012f626..fef82ef7 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -191,7 +191,8 @@ GAWK_EXT_TESTS = \
arraysort2 arraytype asortbool backw badargs beginfile1 beginfile2 \
asortsymtab \
binmode1 charasbytes clos1way clos1way2 clos1way3 clos1way4 \
- clos1way5 clos1way6 colonwarn commas crlf dbugeval dbugeval2 \
+ clos1way5 clos1way6 colonwarn commas crlf csv1 csv2 csv3 csvodd \
+ dbugeval dbugeval2 \
dbugeval3 dbugeval4 dbugtypedre1 dbugtypedre2 delsub \
devfd devfd1 devfd2 dfacheck1 dumpvars \
elemnew1 elemnew2 elemnew3 errno exit fieldwdth forcenum fpat1 fpat2 \
@@ -222,7 +223,7 @@ GAWK_EXT_TESTS = \
symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \
symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
- typeof4 typeof5 typeof6 watchpoint1
+ typeof4 typeof5 typeof6 unicode1 watchpoint1
ARRAYDEBUG_TESTS = arrdbg
EXTRA_TESTS = inftest regtest ignrcas3
@@ -289,9 +290,12 @@ NEED_SANDBOX = sandbox1
# List of tests that need --traditional
NEED_TRADITIONAL = litoct tradanch rscompat
-# Lists of tests that need the PMA allocator and a backing file
+# List of tests that need the PMA allocator and a backing file
NEED_PMA = pma
+# List of tests that need --csv
+NEED_CSV = csv1 csv2 csv3 csvodd
+
# Lists of tests that run a shell script
RUN_SHELL = exit fflush localenl modifiers next randtest rtlen rtlen01
@@ -311,7 +315,7 @@ NEED_LOCALE_EN = \
backbigs1 backsmalls1 backsmalls2 commas concat4 dfamb1 ignrcas2 lc_num1 \
mbfw1 mbprintf1 mbprintf3 mbprintf4 mbstr1 mbstr2 posix_compare \
printhuge reint2 rri1 subamp subi18n wideidx wideidx2 \
- widesub widesub2 widesub3 widesub4
+ widesub widesub2 widesub3 widesub4 unicode1
# Unused at the moment, since nlstringtest has additional stuff it does
@@ -2725,6 +2729,26 @@ crlf:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+csv1:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+csv2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+csv3:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+csvodd:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
dbugeval2:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -3564,6 +3588,12 @@ typeof6:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+unicode1:
+ @echo $@
+ @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=ENU_USA.1252; export GAWKLOCALE; \
+ AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
double1:
@echo $@ $(ZOS_FAIL)
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/po/ChangeLog b/po/ChangeLog
index 1d72814f..3c537317 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -20,6 +20,7 @@
2022-11-15 Antonio Giovanni Colombo <azc100@gmail.com>
+ * it.po: Updated, dropped final comments
* it.po: Updated.
2022-11-07 Arnold D. Robbins <arnold@skeeve.com>
diff --git a/po/it.po b/po/it.po
index 82500314..e2b0cec3 100644
--- a/po/it.po
+++ b/po/it.po
@@ -3954,23 +3954,23 @@ msgstr ""
msgid "cannot pop main context"
msgstr "non posso salire più in alto nel contesto di esecuzione"
-#~ msgid "assignment to FS/FIELDWIDTHS/FPAT has no effect when using --csv"
-#~ msgstr ""
-#~ "assegnare un valore a FS/FIELDWIDTHS/FPAT non produce effetti se si è "
-#~ "specificato --csv"
+msgid "assignment to FS/FIELDWIDTHS/FPAT has no effect when using --csv"
+msgstr ""
+"assegnare un valore a FS/FIELDWIDTHS/FPAT non produce effetti se si è "
+"specificato --csv"
-#~ msgid "assignment to RS has no effect when using --csv"
-#~ msgstr ""
-#~ "assegnare un valore a RS non produce effetti se si è specificato --csv"
+msgid "assignment to RS has no effect when using --csv"
+msgstr ""
+"assegnare un valore a RS non produce effetti se si è specificato --csv"
-#~ msgid "`--posix' and `--csv' conflict"
-#~ msgstr "`--posix' e `--csv' mutualmente esclusive"
+msgid "`--posix' and `--csv' conflict"
+msgstr "`--posix' e `--csv' mutualmente esclusive"
-#~ msgid "\t-k\t\t\t--csv\n"
-#~ msgstr "\t-k\t\t\t--csv\n"
+msgid "\t-k\t\t\t--csv\n"
+msgstr "\t-k\t\t\t--csv\n"
-#~ msgid "POSIX does not allow `\\u' escapes"
-#~ msgstr "POSIX non consente escape `\\u'"
+msgid "POSIX does not allow `\\u' escapes"
+msgstr "POSIX non consente escape `\\u'"
-#~ msgid "no hex digits in `\\u' escape sequence"
-#~ msgstr "niente cifre esadecimali nella sequenza di protezione `\\u'"
+msgid "no hex digits in `\\u' escape sequence"
+msgstr "niente cifre esadecimali nella sequenza di protezione `\\u'"
diff --git a/re.c b/re.c
index 9c1905a6..3ebf0206 100644
--- a/re.c
+++ b/re.c
@@ -118,6 +118,8 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal)
character. */
if ((gawk_mb_cur_max == 1 || ! is_multibyte) &&
(*src == '\\')) {
+ bool unicode;
+
c = *++src;
switch (c) {
case '\0': /* \\ before \0, either dynamic data or real end of string */
@@ -134,6 +136,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal)
case 't':
case 'v':
case 'x':
+ case 'u':
case '0':
case '1':
case '2':
@@ -142,7 +145,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal)
case '5':
case '6':
case '7':
- c2 = parse_escape(&src);
+ c2 = parse_escape(&src, &unicode);
if (c2 < 0)
cant_happen("received bad result %d from parse_escape()", c2);
/*
@@ -155,7 +158,23 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal)
&& (isdigit(c) || c == 'x')
&& strchr("()|*+?.^$\\[]", c2) != NULL)
*dest++ = '\\';
- *dest++ = (char) c2;
+ if (unicode) {
+ char buf[20];
+ size_t n;
+ mbstate_t mbs;
+ int i;
+
+ memset(& mbs, 0, sizeof(mbs));
+
+ n = wcrtomb(buf, c, & mbs);
+ if (n == (size_t) -1) // bad value
+ *dest++ = '?';
+ else {
+ for (i = 0; i < n; i++)
+ *dest++ = buf[i];
+ }
+ } else
+ *dest++ = (char) c2;
if (do_lint
&& ! nul_warned
&& c2 == '\0') {
diff --git a/support/Makefile.in b/support/Makefile.in
index 1f5b209f..0c20902b 100644
--- a/support/Makefile.in
+++ b/support/Makefile.in
@@ -124,11 +124,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
- $(top_srcdir)/m4/libsigsegv.m4 $(top_srcdir)/m4/longlong.m4 \
- $(top_srcdir)/m4/mpfr.m4 $(top_srcdir)/m4/nls.m4 \
- $(top_srcdir)/m4/noreturn.m4 $(top_srcdir)/m4/pma.m4 \
- $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
- $(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/socket.m4 \
+ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/mpfr.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/noreturn.m4 \
+ $(top_srcdir)/m4/pma.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/readline.m4 \
+ $(top_srcdir)/m4/socket.m4 \
$(top_srcdir)/m4/triplet-transformation.m4 \
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -256,7 +256,6 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GREP = @GREP@
-HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -271,13 +270,10 @@ LIBMPFR = @LIBMPFR@
LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
-LIBSIGSEGV = @LIBSIGSEGV@
-LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
-LTLIBSIGSEGV = @LTLIBSIGSEGV@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
diff --git a/test/ChangeLog b/test/ChangeLog
index 651fdb98..ca6dfe64 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2023-04-13 Manuel Collado <mcollado2011@gmail.com>
+
+ * Makefile.am (EXTRA_DIST): New test: csvodd.
+ (NEED_CSV): Add csvodd.
+ * New files: csvodd.awk, csvodd.in, csvodd.ok:
+
2023-04-13 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): New test: asortsymtab.
@@ -12,6 +18,34 @@
* sort1.awk: Add tests for ind_num_desc and @ind_str_asc.
* sort1.ok: Updated.
+2023-03-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): New test: unicode1.
+ * unicode1.awk, unicode1.ok: New files.
+ * funstack.ok: Updated after code change.
+
+2023-03-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * csv1.in, csv1.ok: Adjusted after code change and to match
+ RFC 4180 format.
+
+2023-03-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST, NEED_CSV, GAWK_EXT_TESTS): New test, csv3.
+ * csv3.awk, csv3.in, csv3.ok: New files.
+
+2023-03-17 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST, NEED_CSV, GAWK_EXT_TESTS): New test, csv2.
+ * csv2.awk, csv2.ok: New files.
+
+2023-03-16 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Gentests: Handle NEED_CSV.
+ * Makefile.am (NEED_CSV): New list of tests that need --csv.
+ * badargs.ok: Update after code changes.
+ * csv1.awk: Adjust after code changes.
+
2023-03-09 Arnold D. Robbins <arnold@skeeve.com>
* badargs.ok: Update after code changes.
@@ -111,6 +145,11 @@
of them fail, don't worry about it. Thanks to
"WeissonHan" <Weisson@linux.alibaba.com> for the report.
+2022-08-29 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): csv1: New test.
+ * csv1.awk, csv1.in, csv1.ok: New files.
+
2022-08-25 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): nsbad2, nsbad3: new tests.
diff --git a/test/Gentests b/test/Gentests
index 42a81cff..b3a8f787 100755
--- a/test/Gentests
+++ b/test/Gentests
@@ -108,6 +108,13 @@ BEGIN {
next
}
+/^NEED_CSV *=/,/[^\\]$/ {
+ gsub(/(^NEED_CSV *=|\\$)/,"")
+ for (i = 1; i <= NF; i++)
+ csv[$i]
+ next
+}
+
/^GENTESTS_UNUSED *=/,/[^\\]$/ {
gsub(/(^GENTESTS_UNUSED *=|\\$)/,"")
for (i = 1; i <= NF; i++)
@@ -229,6 +236,10 @@ function generate(x, s, i, locale_string)
s = s " --re-interval"
delete re_interval[x]
}
+ if (x in csv) {
+ s = s " --csv"
+ delete csv[x]
+ }
if (x".in" in files) {
s = s " < \"$(srcdir)\"/$@.in"
delete files[x".in"]
diff --git a/test/Makefile.am b/test/Makefile.am
index cc99dfa9..1099a620 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -225,6 +225,17 @@ EXTRA_DIST = \
convfmt.ok \
crlf.awk \
crlf.ok \
+ csv1.awk \
+ csv1.in \
+ csv1.ok \
+ csv2.awk \
+ csv2.ok \
+ csv3.awk \
+ csv3.in \
+ csv3.ok \
+ csvodd.awk \
+ csvodd.in \
+ csvodd.ok \
datanonl.awk \
datanonl.in \
datanonl.ok \
@@ -1403,6 +1414,8 @@ EXTRA_DIST = \
typeof5.ok \
typeof6.awk \
typeof6.ok \
+ unicode1.awk \
+ unicode1.ok \
uninit2.awk \
uninit2.ok \
uninit3.awk \
@@ -1506,7 +1519,8 @@ GAWK_EXT_TESTS = \
arraysort2 arraytype asortbool backw badargs beginfile1 beginfile2 \
asortsymtab \
binmode1 charasbytes clos1way clos1way2 clos1way3 clos1way4 \
- clos1way5 clos1way6 colonwarn commas crlf dbugeval dbugeval2 \
+ clos1way5 clos1way6 colonwarn commas crlf csv1 csv2 csv3 csvodd \
+ dbugeval dbugeval2 \
dbugeval3 dbugeval4 dbugtypedre1 dbugtypedre2 delsub \
devfd devfd1 devfd2 dfacheck1 dumpvars \
elemnew1 elemnew2 elemnew3 errno exit fieldwdth forcenum fpat1 fpat2 \
@@ -1537,7 +1551,7 @@ GAWK_EXT_TESTS = \
symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \
symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
- typeof4 typeof5 typeof6 watchpoint1
+ typeof4 typeof5 typeof6 unicode1 watchpoint1
ARRAYDEBUG_TESTS = arrdbg
@@ -1604,9 +1618,12 @@ NEED_SANDBOX = sandbox1
# List of tests that need --traditional
NEED_TRADITIONAL = litoct tradanch rscompat
-# Lists of tests that need the PMA allocator and a backing file
+# List of tests that need the PMA allocator and a backing file
NEED_PMA = pma
+# List of tests that need --csv
+NEED_CSV = csv1 csv2 csv3 csvodd
+
# Lists of tests that run a shell script
RUN_SHELL = exit fflush localenl modifiers next randtest rtlen rtlen01
@@ -1625,7 +1642,7 @@ NEED_LOCALE_EN = \
backbigs1 backsmalls1 backsmalls2 commas concat4 dfamb1 ignrcas2 lc_num1 \
mbfw1 mbprintf1 mbprintf3 mbprintf4 mbstr1 mbstr2 posix_compare \
printhuge reint2 rri1 subamp subi18n wideidx wideidx2 \
- widesub widesub2 widesub3 widesub4
+ widesub widesub2 widesub3 widesub4 unicode1
# Unused at the moment, since nlstringtest has additional stuff it does
# NEED_LOCALE_FR =
diff --git a/test/Makefile.in b/test/Makefile.in
index 3ed140cc..ff0ef955 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -119,11 +119,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
- $(top_srcdir)/m4/libsigsegv.m4 $(top_srcdir)/m4/longlong.m4 \
- $(top_srcdir)/m4/mpfr.m4 $(top_srcdir)/m4/nls.m4 \
- $(top_srcdir)/m4/noreturn.m4 $(top_srcdir)/m4/pma.m4 \
- $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
- $(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/socket.m4 \
+ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/mpfr.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/noreturn.m4 \
+ $(top_srcdir)/m4/pma.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/readline.m4 \
+ $(top_srcdir)/m4/socket.m4 \
$(top_srcdir)/m4/triplet-transformation.m4 \
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -185,7 +185,6 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GREP = @GREP@
-HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -200,13 +199,10 @@ LIBMPFR = @LIBMPFR@
LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
-LIBSIGSEGV = @LIBSIGSEGV@
-LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
-LTLIBSIGSEGV = @LTLIBSIGSEGV@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
@@ -493,6 +489,17 @@ EXTRA_DIST = \
convfmt.ok \
crlf.awk \
crlf.ok \
+ csv1.awk \
+ csv1.in \
+ csv1.ok \
+ csv2.awk \
+ csv2.ok \
+ csv3.awk \
+ csv3.in \
+ csv3.ok \
+ csvodd.awk \
+ csvodd.in \
+ csvodd.ok \
datanonl.awk \
datanonl.in \
datanonl.ok \
@@ -1671,6 +1678,8 @@ EXTRA_DIST = \
typeof5.ok \
typeof6.awk \
typeof6.ok \
+ unicode1.awk \
+ unicode1.ok \
uninit2.awk \
uninit2.ok \
uninit3.awk \
@@ -1774,7 +1783,8 @@ GAWK_EXT_TESTS = \
arraysort2 arraytype asortbool backw badargs beginfile1 beginfile2 \
asortsymtab \
binmode1 charasbytes clos1way clos1way2 clos1way3 clos1way4 \
- clos1way5 clos1way6 colonwarn commas crlf dbugeval dbugeval2 \
+ clos1way5 clos1way6 colonwarn commas crlf csv1 csv2 csv3 csvodd \
+ dbugeval dbugeval2 \
dbugeval3 dbugeval4 dbugtypedre1 dbugtypedre2 delsub \
devfd devfd1 devfd2 dfacheck1 dumpvars \
elemnew1 elemnew2 elemnew3 errno exit fieldwdth forcenum fpat1 fpat2 \
@@ -1805,7 +1815,7 @@ GAWK_EXT_TESTS = \
symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \
symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
- typeof4 typeof5 typeof6 watchpoint1
+ typeof4 typeof5 typeof6 unicode1 watchpoint1
ARRAYDEBUG_TESTS = arrdbg
EXTRA_TESTS = inftest regtest ignrcas3
@@ -1872,9 +1882,12 @@ NEED_SANDBOX = sandbox1
# List of tests that need --traditional
NEED_TRADITIONAL = litoct tradanch rscompat
-# Lists of tests that need the PMA allocator and a backing file
+# List of tests that need the PMA allocator and a backing file
NEED_PMA = pma
+# List of tests that need --csv
+NEED_CSV = csv1 csv2 csv3 csvodd
+
# Lists of tests that run a shell script
RUN_SHELL = exit fflush localenl modifiers next randtest rtlen rtlen01
@@ -1894,7 +1907,7 @@ NEED_LOCALE_EN = \
backbigs1 backsmalls1 backsmalls2 commas concat4 dfamb1 ignrcas2 lc_num1 \
mbfw1 mbprintf1 mbprintf3 mbprintf4 mbstr1 mbstr2 posix_compare \
printhuge reint2 rri1 subamp subi18n wideidx wideidx2 \
- widesub widesub2 widesub3 widesub4
+ widesub widesub2 widesub3 widesub4 unicode1
# Unused at the moment, since nlstringtest has additional stuff it does
@@ -4491,6 +4504,26 @@ crlf:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+csv1:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+csv2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+csv3:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+csvodd:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
dbugeval2:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -5326,6 +5359,12 @@ typeof6:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+unicode1:
+ @echo $@
+ @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; export GAWKLOCALE; \
+ AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
double1:
@echo $@ $(ZOS_FAIL)
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index f532fc92..945cb43d 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1417,6 +1417,26 @@ crlf:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+csv1:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+csv2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+csv3:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+csvodd:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --csv < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
dbugeval2:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -2252,6 +2272,12 @@ typeof6:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+unicode1:
+ @echo $@
+ @-[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; export GAWKLOCALE; \
+ AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
double1:
@echo $@ $(ZOS_FAIL)
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/badargs.ok b/test/badargs.ok
index e75c6cdc..1d79bc78 100644
--- a/test/badargs.ok
+++ b/test/badargs.ok
@@ -17,6 +17,7 @@ Short options: GNU long options: (extensions)
-h --help
-i includefile --include=includefile
-I --trace
+ -k --csv
-l library --load=library
-L[fatal|invalid|no-ext] --lint[=fatal|invalid|no-ext]
-M --bignum
@@ -41,7 +42,7 @@ PLEASE do NOT try to report bugs by posting in comp.lang.awk,
or by using a web forum such as Stack Overflow.
Source code for gawk may be obtained from
-https://www.skeeve.com/gawk/gawk-5.2.1b.tar.gz
+https://www.skeeve.com/gawk/gawk-5.2.60.tar.gz
gawk is a pattern scanning and processing language.
By default it reads standard input and writes standard output.
diff --git a/test/csv1.awk b/test/csv1.awk
new file mode 100644
index 00000000..4896ef7c
--- /dev/null
+++ b/test/csv1.awk
@@ -0,0 +1,10 @@
+# BEGIN {
+# FS = ","
+# }
+
+{
+ printf(" \t%s\t", $0)
+ for (i = 1; i <= NF; i++)
+ printf("[%s]", $i)
+ print ""
+}
diff --git a/test/csv1.in b/test/csv1.in
new file mode 100644
index 00000000..abdcf27e
--- /dev/null
+++ b/test/csv1.in
@@ -0,0 +1,22 @@
+a
+ a
+,a
+ , a
+a,b
+a,b,c
+""
+"abc"
+"a""b"
+"a","b"
+"a,b"
+""""
+""""""
+"""x"""
+,,""
+a''b
+,,
+a,
+"",
+,
+"abc",def
+
diff --git a/test/csv1.ok b/test/csv1.ok
new file mode 100644
index 00000000..e25c3cb8
--- /dev/null
+++ b/test/csv1.ok
@@ -0,0 +1,22 @@
+ a [a]
+ a [ a]
+ ,a [][a]
+ , a [ ][ a]
+ a,b [a][b]
+ a,b,c [a][b][c]
+ "" []
+ "abc" [abc]
+ "a""b" [a"b]
+ "a","b" [a][b]
+ "a,b" [a,b]
+ """" ["]
+ """""" [""]
+ """x""" ["x"]
+ ,,"" [][][]
+ a''b [a''b]
+ ,, [][][]
+ a, [a][]
+ "", [][]
+ , [][]
+ "abc",def [abc][def]
+ []
diff --git a/test/csv2.awk b/test/csv2.awk
new file mode 100644
index 00000000..93cbca65
--- /dev/null
+++ b/test/csv2.awk
@@ -0,0 +1,34 @@
+BEGIN {
+ text[1] = "a"; expected[1] = 1
+ text[2] = " a"; expected[2] = 1
+ text[3] = ",a"; expected[3] = 2
+ text[4] = " , a"; expected[4] = 2
+ text[5] = "a,b"; expected[5] = 2
+ text[6] = "a,b,c"; expected[6] = 3
+ text[7] = "\"\""; expected[7] = 1
+ text[8] = "\"abc\""; expected[8] = 1
+ text[9] = "\"a\"\"b\""; expected[9] = 1
+ text[10] = "\"a\",\"b\""; expected[10] = 2
+ text[11] = "a\"\"b"; expected[11] = 1
+ text[12] = "\"a,b\""; expected[12] = 1
+ text[13] = "\"\"\"\""; expected[13] = 1
+ text[14] = "\"\"\"\"\"\""; expected[14] = 1
+ text[15] = "\"\"\"x\"\"\""; expected[15] = 1
+ text[16] = ",,\"\""; expected[16] = 3
+ text[17] = "a\"\"b"; expected[17] = 1
+ text[18] = "a\"b"; expected[18] = 1
+ text[19] = "a''b"; expected[19] = 1
+ text[20] = "\"abc"; expected[20] = 1
+ text[21] = ",,"; expected[21] = 3
+ text[22] = "a,"; expected[22] = 2
+ text[23] = "\"\","; expected[23] = 2
+ text[24] = ","; expected[24] = 2
+ text[25] = "\"abc\",def"; expected[25] = 2
+
+ for (i = 1; i <= length(text); i++) {
+ n = split(text[i], array)
+ if (n != expected[i])
+ printf("text[%d] = <%s>, expected %d, got %d\n",
+ i, text[i], expected[i], n)
+ }
+}
diff --git a/test/csv2.ok b/test/csv2.ok
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/csv2.ok
diff --git a/test/csv3.awk b/test/csv3.awk
new file mode 100644
index 00000000..ac4e182f
--- /dev/null
+++ b/test/csv3.awk
@@ -0,0 +1,6 @@
+{
+ print "Record:", NR
+ for (i = 1; i <= NF; i++) {
+ printf("\t$%d = <%s>\n", i, $i)
+ }
+}
diff --git a/test/csv3.in b/test/csv3.in
new file mode 100644
index 00000000..d0f45223
--- /dev/null
+++ b/test/csv3.in
@@ -0,0 +1,13 @@
+Forename,Lastname,Address,State,Zipcode
+John,Doe,"120 jefferson st.
+Riverside", NJ, 08075
+Jack,McGinnis,"220 hobo Av.
+Philadelphia", PA,09119
+"John ""Da Man""",Repici,"120 Jefferson St.
+Riverside", NJ,08075
+Stephen,Tyler,"7452 Terrace ""At the Plaza"" road
+SomeTown",SD, 91234
+,Blankman,"
+SomeTown", SD, 00298
+"Joan ""the bone"", Anne",Jet,"9th, at Terrace plc
+Desert City",CO,00123
diff --git a/test/csv3.ok b/test/csv3.ok
new file mode 100644
index 00000000..eadb878a
--- /dev/null
+++ b/test/csv3.ok
@@ -0,0 +1,48 @@
+Record: 1
+ $1 = <Forename>
+ $2 = <Lastname>
+ $3 = <Address>
+ $4 = <State>
+ $5 = <Zipcode>
+Record: 2
+ $1 = <John>
+ $2 = <Doe>
+ $3 = <120 jefferson st.
+Riverside>
+ $4 = < NJ>
+ $5 = < 08075>
+Record: 3
+ $1 = <Jack>
+ $2 = <McGinnis>
+ $3 = <220 hobo Av.
+Philadelphia>
+ $4 = < PA>
+ $5 = <09119>
+Record: 4
+ $1 = <John "Da Man">
+ $2 = <Repici>
+ $3 = <120 Jefferson St.
+Riverside>
+ $4 = < NJ>
+ $5 = <08075>
+Record: 5
+ $1 = <Stephen>
+ $2 = <Tyler>
+ $3 = <7452 Terrace "At the Plaza" road
+SomeTown>
+ $4 = <SD>
+ $5 = < 91234>
+Record: 6
+ $1 = <>
+ $2 = <Blankman>
+ $3 = <
+SomeTown>
+ $4 = < SD>
+ $5 = < 00298>
+Record: 7
+ $1 = <Joan "the bone", Anne>
+ $2 = <Jet>
+ $3 = <9th, at Terrace plc
+Desert City>
+ $4 = <CO>
+ $5 = <00123>
diff --git a/test/csvodd.awk b/test/csvodd.awk
new file mode 100644
index 00000000..8d1948ad
--- /dev/null
+++ b/test/csvodd.awk
@@ -0,0 +1,13 @@
+# Show the string contents. Make begin, end, CR and LN visible.
+function show(str) {
+ gsub("\r", "\\r", str)
+ gsub("\n", "\\n", str)
+ printf("<%s>", str)
+}
+
+# Dump the current record
+{
+ show($0); show(RT); print ""
+ for (k=1; k<=NF; k++) show($k); print ""
+}
+
diff --git a/test/csvodd.in b/test/csvodd.in
new file mode 100644
index 00000000..59d8c207
--- /dev/null
+++ b/test/csvodd.in
@@ -0,0 +1,25 @@
+Normal record
+a,b,c,d
+EOL = CR+LF
+a,b,c,d
+EOL = CR+CR+LF
+a,b,c,d
+Quoted field
+a,"b,c",d
+Quote in quoted field
+a,"b""c",d
+Null fields
+,a,b,,c,d,
+Quoted null field, EOL = CR+LF
+a,b,"",c,d
+Embedded LF
+a,"b
+c",d
+Embedded CR+LF and LF, EOL = CR+LF
+"a
+b","c
+d"
+Embedded plain CR, EOL = LR
+a,b c,d
+No EOL at EOF
+a,b,c,d \ No newline at end of file
diff --git a/test/csvodd.ok b/test/csvodd.ok
new file mode 100644
index 00000000..cf9c44a4
--- /dev/null
+++ b/test/csvodd.ok
@@ -0,0 +1,44 @@
+<Normal record><\n>
+<Normal record>
+<a,b,c,d><\n>
+<a><b><c><d>
+<EOL = CR+LF><\n>
+<EOL = CR+LF>
+<a,b,c,d><\n>
+<a><b><c><d>
+<EOL = CR+CR+LF><\n>
+<EOL = CR+CR+LF>
+<a,b,c,d><\n>
+<a><b><c><d>
+<Quoted field><\n>
+<Quoted field>
+<a,"b,c",d><\n>
+<a><b,c><d>
+<Quote in quoted field><\n>
+<Quote in quoted field>
+<a,"b""c",d><\n>
+<a><b"c><d>
+<Null fields><\n>
+<Null fields>
+<,a,b,,c,d,><\n>
+<><a><b><><c><d><>
+<Quoted null field, EOL = CR+LF><\n>
+<Quoted null field>< EOL = CR+LF>
+<a,b,"",c,d><\n>
+<a><b><><c><d>
+<Embedded LF><\n>
+<Embedded LF>
+<a,"b\nc",d><\n>
+<a><b\nc><d>
+<Embedded CR+LF and LF, EOL = CR+LF><\n>
+<Embedded CR+LF and LF>< EOL = CR+LF>
+<"a\nb","c\nd"><\n>
+<a\nb><c\nd>
+<Embedded plain CR, EOL = LR><\n>
+<Embedded plain CR>< EOL = LR>
+<a,b\rc,d><\n>
+<a><b\rc><d>
+<No EOL at EOF><\n>
+<No EOL at EOF>
+<a,b,c,d><>
+<a><b><c><d>
diff --git a/test/funstack.ok b/test/funstack.ok
index 04030d3b..6c28fad0 100644
--- a/test/funstack.ok
+++ b/test/funstack.ok
@@ -2,7 +2,7 @@ gawk: funstack.awk:129: warning: regexp escape sequence `\"' is not a known rege
gawk: funstack.awk:381: warning: regexp escape sequence `\e' is not a known regexp operator
gawk: funstack.awk:386: warning: regexp escape sequence `\i' is not a known regexp operator
gawk: funstack.awk:395: warning: regexp escape sequence `\o' is not a known regexp operator
-gawk: funstack.awk:402: warning: regexp escape sequence `\u' is not a known regexp operator
+gawk: funstack.awk:402: warning: no hex digits in `\u' escape sequence
gawk: funstack.awk:412: warning: regexp escape sequence `\A' is not a known regexp operator
gawk: funstack.awk:427: warning: regexp escape sequence `\I' is not a known regexp operator
gawk: funstack.awk:436: warning: regexp escape sequence `\O' is not a known regexp operator
diff --git a/test/unicode1.awk b/test/unicode1.awk
new file mode 100644
index 00000000..6f97a2d9
--- /dev/null
+++ b/test/unicode1.awk
@@ -0,0 +1,6 @@
+BEGIN {
+ print "\u03b1" # alpha
+ print "\u05d0" # alef
+ print "\u20b9f" # hiragana "a" (i think)
+ print "\u1f648" # see no evil monkey
+}
diff --git a/test/unicode1.ok b/test/unicode1.ok
new file mode 100644
index 00000000..a8dbd054
--- /dev/null
+++ b/test/unicode1.ok
@@ -0,0 +1,4 @@
+𠮟
+🙈