From 98ba9765f8e6b0cd22e94e226a21a46b1b6eaf9b Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 17 Oct 2014 09:59:33 +0300 Subject: Fix assumptions about AWKPATH in awklib and test. --- awklib/ChangeLog | 5 +++++ awklib/Makefile.am | 2 +- awklib/Makefile.in | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'awklib') diff --git a/awklib/ChangeLog b/awklib/ChangeLog index 6ef0bbde..13d6b090 100644 --- a/awklib/ChangeLog +++ b/awklib/ChangeLog @@ -1,3 +1,8 @@ +2014-10-17 Andrew J. Schorr + + * Makefile.am (stamp-eg): Use explicit ./extract.awk to avoid + assumptions about AWKPATH in the environment. + 2014-04-08 Arnold D. Robbins * 4.1.1: Release tar ball made. diff --git a/awklib/Makefile.am b/awklib/Makefile.am index 6ffbea81..82b7e07f 100644 --- a/awklib/Makefile.am +++ b/awklib/Makefile.am @@ -68,7 +68,7 @@ $(srcdir)/stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi cd $(srcdir) && \ rm -fr eg && \ rm -fr stamp-eg && \ - $(AWKPROG) -f extract.awk ../doc/gawk.texi ../doc/gawkinet.texi + $(AWKPROG) -f ./extract.awk ../doc/gawk.texi ../doc/gawkinet.texi @echo 'some makes are stupid and will not check a directory' > $(srcdir)/stamp-eg @echo 'against a file, so this file is a place holder. gack.' >> $(srcdir)/stamp-eg diff --git a/awklib/Makefile.in b/awklib/Makefile.in index d32ae04a..4c9a0552 100644 --- a/awklib/Makefile.in +++ b/awklib/Makefile.in @@ -721,7 +721,7 @@ $(srcdir)/stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi cd $(srcdir) && \ rm -fr eg && \ rm -fr stamp-eg && \ - $(AWKPROG) -f extract.awk ../doc/gawk.texi ../doc/gawkinet.texi + $(AWKPROG) -f ./extract.awk ../doc/gawk.texi ../doc/gawkinet.texi @echo 'some makes are stupid and will not check a directory' > $(srcdir)/stamp-eg @echo 'against a file, so this file is a place holder. gack.' >> $(srcdir)/stamp-eg -- cgit v1.2.3 From 46a457244070dac0ff575293348748f1d8db4352 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 5 Nov 2014 05:34:04 +0200 Subject: Small build fix in awklib. --- awklib/ChangeLog | 5 +++++ awklib/Makefile.am | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'awklib') diff --git a/awklib/ChangeLog b/awklib/ChangeLog index 13d6b090..bede4234 100644 --- a/awklib/ChangeLog +++ b/awklib/ChangeLog @@ -1,3 +1,8 @@ +2014-11-05 Juergen Kahrs + + * Makefile.am (AWKPROG): Add quotes around the name in case the + build dir has spaces in it. + 2014-10-17 Andrew J. Schorr * Makefile.am (stamp-eg): Use explicit ./extract.awk to avoid diff --git a/awklib/Makefile.am b/awklib/Makefile.am index 82b7e07f..2e1adaf1 100644 --- a/awklib/Makefile.am +++ b/awklib/Makefile.am @@ -30,7 +30,7 @@ EXTRA_DIST = ChangeLog ChangeLog.0 extract.awk eg $(srcdir)/stamp-eg if TEST_CROSS_COMPILE AWKPROG = LC_ALL=C LANG=C awk$(EXEEXT) else -AWKPROG = LC_ALL=C LANG=C $(abs_top_builddir)/gawk$(EXEEXT) +AWKPROG = LC_ALL=C LANG=C "$(abs_top_builddir)/gawk$(EXEEXT)" endif # Get config.h from the build directory and custom.h from the source directory. -- cgit v1.2.3 From 50925902635e9b66288318fd768157dbeb529f08 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 5 Nov 2014 06:24:09 +0200 Subject: Forgot awklib/Makefile.in. --- awklib/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'awklib') diff --git a/awklib/Makefile.in b/awklib/Makefile.in index 4c9a0552..eb707f6c 100644 --- a/awklib/Makefile.in +++ b/awklib/Makefile.in @@ -342,7 +342,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = ChangeLog ChangeLog.0 extract.awk eg $(srcdir)/stamp-eg -@TEST_CROSS_COMPILE_FALSE@AWKPROG = LC_ALL=C LANG=C $(abs_top_builddir)/gawk$(EXEEXT) +@TEST_CROSS_COMPILE_FALSE@AWKPROG = LC_ALL=C LANG=C "$(abs_top_builddir)/gawk$(EXEEXT)" # With some locales, the script extract.awk fails. # So we fix the locale to some sensible value. @TEST_CROSS_COMPILE_TRUE@AWKPROG = LC_ALL=C LANG=C awk$(EXEEXT) -- cgit v1.2.3 From f35c7514dda9bf9cf06580ab5870af13e0e58103 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 17 Nov 2014 11:11:29 +0200 Subject: Rebuild derived doc files, add ChangeLog entry. --- awklib/eg/lib/ftrans.awk | 2 +- awklib/eg/lib/strtonum.awk | 2 +- awklib/eg/prog/indirectcall.awk | 2 +- awklib/eg/prog/split.awk | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'awklib') diff --git a/awklib/eg/lib/ftrans.awk b/awklib/eg/lib/ftrans.awk index 2fec27ef..6461efff 100644 --- a/awklib/eg/lib/ftrans.awk +++ b/awklib/eg/lib/ftrans.awk @@ -1,4 +1,4 @@ -# ftrans.awk --- handle data file transitions +# ftrans.awk --- handle datafile transitions # # user supplies beginfile() and endfile() functions # diff --git a/awklib/eg/lib/strtonum.awk b/awklib/eg/lib/strtonum.awk index cd56a449..783496e4 100644 --- a/awklib/eg/lib/strtonum.awk +++ b/awklib/eg/lib/strtonum.awk @@ -52,7 +52,7 @@ function mystrtonum(str, ret, n, i, k, c) # a[6] = "1.e3" # a[7] = "1.32" # a[8] = "1.32E2" -# +# # for (i = 1; i in a; i++) # print a[i], strtonum(a[i]), mystrtonum(a[i]) # } diff --git a/awklib/eg/prog/indirectcall.awk b/awklib/eg/prog/indirectcall.awk index 3ecb2887..165b022a 100644 --- a/awklib/eg/prog/indirectcall.awk +++ b/awklib/eg/prog/indirectcall.awk @@ -27,7 +27,7 @@ function do_sort(first, last, compare, data, i, retval) retval = data[1] for (i = 2; i in data; i++) retval = retval " " data[i] - + return retval } # sort --- sort the data in ascending order and return it as a string diff --git a/awklib/eg/prog/split.awk b/awklib/eg/prog/split.awk index 6a7198f6..b878fa50 100644 --- a/awklib/eg/prog/split.awk +++ b/awklib/eg/prog/split.awk @@ -22,7 +22,7 @@ BEGIN { } # test argv in case reading from stdin instead of file if (i in ARGV) - i++ # skip data file name + i++ # skip datafile name if (i in ARGV) { outfile = ARGV[i] ARGV[i] = "" -- cgit v1.2.3 From 90001d0580cdba35ed3813396a095bd9f5a9345e Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 19 Nov 2014 18:45:44 +0200 Subject: Upgrade infrastructure (automake, gettext, libtool). --- awklib/Makefile.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'awklib') diff --git a/awklib/Makefile.in b/awklib/Makefile.in index eb707f6c..8555206c 100644 --- a/awklib/Makefile.in +++ b/awklib/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. @@ -277,6 +277,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOCKET_LIBS = @SOCKET_LIBS@ @@ -479,14 +480,14 @@ distclean-compile: @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique -- cgit v1.2.3 From eccbbe18b119f60bcb4e33259f43f6f3cc0d2581 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sat, 24 Jan 2015 19:51:55 +0200 Subject: Move to Automake 1.15. --- awklib/Makefile.in | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'awklib') diff --git a/awklib/Makefile.in b/awklib/Makefile.in index 8555206c..610b6ee1 100644 --- a/awklib/Makefile.in +++ b/awklib/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -39,7 +39,17 @@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -102,8 +112,6 @@ build_triplet = @build@ host_triplet = @host@ pkglibexec_PROGRAMS = pwcat$(EXEEXT) grcat$(EXEEXT) subdir = awklib -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \ $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \ @@ -118,6 +126,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \ $(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -212,6 +221,8 @@ am__define_uniq_tagged_files = \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ + $(top_srcdir)/mkinstalldirs ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgdatadir = $(datadir)/awk pkglibexecdir = $(libexecdir)/awk @@ -370,7 +381,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu awklib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu awklib/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -698,6 +708,8 @@ uninstall-am: uninstall-binSCRIPTS uninstall-local \ uninstall-binSCRIPTS uninstall-local \ uninstall-pkglibexecPROGRAMS +.PRECIOUS: Makefile + all: $(srcdir)/stamp-eg $(AUXPROGS) igawk $(AUXAWK) -- cgit v1.2.3 From 5153d0f04b7ad460b23ae5a011061f7b93a122ef Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 27 Jan 2015 20:57:58 +0200 Subject: O'Reilly edits and other fixes. --- awklib/eg/lib/bits2str.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'awklib') diff --git a/awklib/eg/lib/bits2str.awk b/awklib/eg/lib/bits2str.awk index 9725ee8f..a10ffad1 100644 --- a/awklib/eg/lib/bits2str.awk +++ b/awklib/eg/lib/bits2str.awk @@ -1,4 +1,4 @@ -# bits2str --- turn a byte into readable 1's and 0's +# bits2str --- turn a byte into readable ones and zeros function bits2str(bits, data, mask) { -- cgit v1.2.3 From ec0a8d6c8ed3855b440aeb90b92088115212fb78 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 1 Feb 2015 21:48:46 +0200 Subject: More O'Reilly fixes. --- awklib/eg/lib/quicksort.awk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'awklib') diff --git a/awklib/eg/lib/quicksort.awk b/awklib/eg/lib/quicksort.awk index 3ba2d6e3..e0ed8bc7 100644 --- a/awklib/eg/lib/quicksort.awk +++ b/awklib/eg/lib/quicksort.awk @@ -4,8 +4,9 @@ # Arnold Robbins, arnold@skeeve.com, Public Domain # January 2009 -# quicksort --- C.A.R. Hoare's quick sort algorithm. See Wikipedia -# or almost any algorithms or computer science text + +# quicksort --- C.A.R. Hoare's quicksort algorithm. See Wikipedia +# or almost any algorithms or computer science text. # # Adapted from K&R-II, page 110 -- cgit v1.2.3 From 6a4160dab42fb7e952b0b91a99eedd4bb6bb1d67 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 2 Feb 2015 06:13:07 +0200 Subject: More O'Reilly edits. --- awklib/eg/lib/assert.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'awklib') diff --git a/awklib/eg/lib/assert.awk b/awklib/eg/lib/assert.awk index 75fd8853..c8e13490 100644 --- a/awklib/eg/lib/assert.awk +++ b/awklib/eg/lib/assert.awk @@ -1,4 +1,4 @@ -# assert --- assert that a condition is true. Otherwise exit. +# assert --- assert that a condition is true. Otherwise, exit. # # Arnold Robbins, arnold@skeeve.com, Public Domain -- cgit v1.2.3 From 1e4b9e300f6bfb84e3187ba2085723d44af9c50f Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 4 Feb 2015 06:16:22 +0200 Subject: More O'Reilly fixes, through Chapter 11. --- awklib/eg/prog/anagram.awk | 6 +++--- awklib/eg/prog/extract.awk | 2 +- awklib/eg/prog/translate.awk | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'awklib') diff --git a/awklib/eg/prog/anagram.awk b/awklib/eg/prog/anagram.awk index 7ca14559..df2768d9 100644 --- a/awklib/eg/prog/anagram.awk +++ b/awklib/eg/prog/anagram.awk @@ -1,5 +1,5 @@ -# anagram.awk --- An implementation of the anagram finding algorithm -# from Jon Bentley's "Programming Pearls", 2nd edition. +# anagram.awk --- An implementation of the anagram-finding algorithm +# from Jon Bentley's "Programming Pearls," 2nd edition. # Addison Wesley, 2000, ISBN 0-201-65788-0. # Column 2, Problem C, section 2.8, pp 18-20. # @@ -21,7 +21,7 @@ key = word2key($1) # Build signature data[key][$1] = $1 # Store word with signature } -# word2key --- split word apart into letters, sort, joining back together +# word2key --- split word apart into letters, sort, and join back together function word2key(word, a, i, n, result) { diff --git a/awklib/eg/prog/extract.awk b/awklib/eg/prog/extract.awk index 24f40ce5..f5dfcf40 100644 --- a/awklib/eg/prog/extract.awk +++ b/awklib/eg/prog/extract.awk @@ -1,4 +1,4 @@ -# extract.awk --- extract files and run programs from texinfo files +# extract.awk --- extract files and run programs from Texinfo files # # Arnold Robbins, arnold@skeeve.com, Public Domain # May 1993 diff --git a/awklib/eg/prog/translate.awk b/awklib/eg/prog/translate.awk index cf7f3897..e7403717 100644 --- a/awklib/eg/prog/translate.awk +++ b/awklib/eg/prog/translate.awk @@ -4,7 +4,7 @@ # August 1989 # February 2009 - bug fix -# Bugs: does not handle things like: tr A-Z a-z, it has +# Bugs: does not handle things like tr A-Z a-z; it has # to be spelled out. However, if `to' is shorter than `from', # the last character in `to' is used for the rest of `from'. -- cgit v1.2.3 From e0c1194c4348e7adf99802461d45e3dd1bd192ff Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 18 Mar 2015 21:43:14 +0200 Subject: Bug fix to inplace extension and doc updates. --- awklib/eg/lib/inplace.awk | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'awklib') diff --git a/awklib/eg/lib/inplace.awk b/awklib/eg/lib/inplace.awk index 6403a228..d1574654 100644 --- a/awklib/eg/lib/inplace.awk +++ b/awklib/eg/lib/inplace.awk @@ -5,10 +5,15 @@ # Please set INPLACE_SUFFIX to make a backup copy. For example, you may # want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule. +# N.B. We call inplace_end() in the BEGINFILE and END rules so that any +# actions in an ENDFILE rule will be redirected as expected. + BEGINFILE { - inplace_begin(FILENAME, INPLACE_SUFFIX) + if (_inplace_filename != "") + inplace_end(_inplace_filename, INPLACE_SUFFIX) + inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX) } -ENDFILE { +END { inplace_end(FILENAME, INPLACE_SUFFIX) } -- cgit v1.2.3 From ddc290584b39bab2c1edcec935a31ea12d343246 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 3 Apr 2015 09:08:54 +0300 Subject: Rename "div()" to "intdiv()". --- awklib/eg/lib/div.awk | 17 ----------------- awklib/eg/lib/intdiv.awk | 20 ++++++++++++++++++++ awklib/eg/prog/pi.awk | 2 +- 3 files changed, 21 insertions(+), 18 deletions(-) delete mode 100644 awklib/eg/lib/div.awk create mode 100644 awklib/eg/lib/intdiv.awk (limited to 'awklib') diff --git a/awklib/eg/lib/div.awk b/awklib/eg/lib/div.awk deleted file mode 100644 index 5939024d..00000000 --- a/awklib/eg/lib/div.awk +++ /dev/null @@ -1,17 +0,0 @@ -# div --- do integer division - -# -# Arnold Robbins, arnold@skeeve.com, Public Domain -# July, 2014 - -function div(numerator, denominator, result) -{ - split("", result) - - numerator = int(numerator) - denominator = int(denominator) - result["quotient"] = int(numerator / denominator) - result["remainder"] = int(numerator % denominator) - - return 0.0 -} diff --git a/awklib/eg/lib/intdiv.awk b/awklib/eg/lib/intdiv.awk new file mode 100644 index 00000000..dbc553b0 --- /dev/null +++ b/awklib/eg/lib/intdiv.awk @@ -0,0 +1,20 @@ +# intdiv --- do integer division + +# +# Arnold Robbins, arnold@skeeve.com, Public Domain +# July, 2014 +# +# Name changed from div() to intdiv() +# April, 2015 + +function intdiv(numerator, denominator, result) +{ + split("", result) + + numerator = int(numerator) + denominator = int(denominator) + result["quotient"] = int(numerator / denominator) + result["remainder"] = int(numerator % denominator) + + return 0.0 +} diff --git a/awklib/eg/prog/pi.awk b/awklib/eg/prog/pi.awk index 3297beff..e1b5bc4f 100644 --- a/awklib/eg/prog/pi.awk +++ b/awklib/eg/prog/pi.awk @@ -10,7 +10,7 @@ BEGIN { for (m = digits * 4; m > 0; --m) { d = m * 2 + 1 x = pi * m - div(x, d, result) + intdiv(x, d, result) pi = result["quotient"] pi = pi + two } -- cgit v1.2.3