snapshot of project "mawk", label t20200918

This commit is contained in:
Thomas E. Dickey 2020-09-13 17:31:07 +00:00
parent 44140d6108
commit 895ff3ac6a
11 changed files with 72 additions and 53 deletions

View File

@ -1,4 +1,10 @@
-- $MawkId: CHANGES,v 1.306 2020/09/10 11:23:53 tom Exp $
-- $MawkId: CHANGES,v 1.309 2020/09/13 17:27:56 tom Exp $
20200918
+ build-fix for HP-UX 11.23, which lacks #define's for maximum of
int64_t and uint64_t
+ build-fix for OpenBSD, which mis-types int64_t, just like macOS.
+ build-fix for macOS, which mis-types int64_t
20200911
+ improve range of printf/sprintf for decimal formats by using the

View File

@ -1,4 +1,4 @@
MANIFEST for mawk, version t20200911
MANIFEST for mawk, version t20200918
--------------------------------------------------------------------------------
MANIFEST this file
ACKNOWLEDGMENT acknowledgements

4
init.c
View File

@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: init.c,v 1.70 2020/09/10 10:11:26 tom Exp $
* $MawkId: init.c,v 1.71 2020/09/13 14:26:56 tom Exp $
*/
/* init.c */
@ -530,7 +530,7 @@ static void
process_cmdline(int argc, char **argv)
{
int i, j, nextarg;
char *curArg;
char *curArg = NULL;
char *optArg;
char *optNext;
PFILE dummy; /* starts linked list of filenames */

View File

@ -1,10 +1,4 @@
mawk-cur (1.3.4-20200911) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 30 Aug 2020 14:40:38 -0400
mawk-cur (1.3.4-20200828) unstable; urgency=low
mawk-cur (1.3.4-20200918) unstable; urgency=low
* maintenance updates

View File

@ -1,8 +1,8 @@
Summary: mawk - pattern scanning and text processing language
%define AppProgram mawk
%define AppVersion 1.3.4
%define AppRelease 20200911
# $MawkId: mawk.spec,v 1.83 2020/09/09 08:00:28 tom Exp $
%define AppRelease 20200918
# $MawkId: mawk.spec,v 1.84 2020/09/12 08:20:21 tom Exp $
Name: %{AppProgram}
Version: %{AppVersion}
Release: %{AppRelease}

View File

@ -11,9 +11,9 @@ the GNU General Public License, version 2, 1991.
*/
/*
* $MawkId: patchlev.h,v 1.109 2020/09/09 08:00:28 tom Exp $
* $MawkId: patchlev.h,v 1.110 2020/09/12 08:20:21 tom Exp $
*/
#define PATCH_BASE 1
#define PATCH_LEVEL 3
#define PATCH_STRING ".4"
#define DATE_STRING "20200911"
#define DATE_STRING "20200918"

View File

@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: print.c,v 1.38 2020/09/11 23:30:34 tom Exp $
* $MawkId: print.c,v 1.39 2020/09/13 17:31:07 tom Exp $
*/
#include "mawk.h"
@ -56,7 +56,7 @@ print_cell(CELL *p, FILE *fp)
break;
case C_DOUBLE:
if (p->dval > 0.0) {
if (p->dval >= (double) Max_Long) {
ULong ival = d_to_UL(p->dval);
/* integers can print as "%[l]u", for additional range */

View File

@ -12,7 +12,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: rexp0.c,v 1.44 2020/08/25 19:34:57 tom Exp $
* $MawkId: rexp0.c,v 1.45 2020/09/13 17:24:47 tom Exp $
*/
/* lexical scanner */
@ -135,7 +135,7 @@ do_intervals(
intrvalmin = 0;
intrvalmax = 0;
if (!isdigit(*p) && *p != ',') /* error */
if (!isdigit((UChar) * p) && *p != ',') /* error */
{
RE_error_trap(-E7);
}

28
sizes.h
View File

@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: sizes.h,v 1.18 2020/07/31 22:02:36 tom Exp $
* $MawkId: sizes.h,v 1.21 2020/09/13 17:24:05 tom Exp $
*/
/* sizes.h */
@ -31,12 +31,28 @@ the GNU General Public License, version 2, 1991.
#endif
#if defined(HAVE_STDINT_H) && defined(HAVE_INT64_T) && defined(HAVE_UINT64_T)
#include <stdint.h>
#include <limits.h>
#if defined(INT64_MAX)
#define MAX__INT INT64_MAX
#define MAX__LONG INT64_MAX
#elif defined(LLONG_MAX)
#define MAX__INT LLONG_MAX
#elif defined(LONG_LONG_MAX)
#define MAX__INT LONG_LONG_MAX
#endif
#if defined(UINT64_MAX)
#define MAX__UINT UINT64_MAX
#define MAX__ULONG UINT64_MAX
#elif defined(LLONG_MAX)
#define MAX__UINT ULLONG_MAX
#elif defined(LONG_LONG_MAX)
#define MAX__UINT ULONG_LONG_MAX
#endif
#define MAX__LONG MAX__INT
#define MAX__ULONG MAX__UINT
typedef int64_t Int;
typedef int64_t Long;
@ -48,7 +64,7 @@ typedef uint64_t ULong;
#define Max_UInt MAX__UINT
#define Max_ULong MAX__ULONG
#if SIZEOF_LONG_LONG > SIZEOF_LONG
#if (SIZEOF_LONG_LONG > SIZEOF_LONG) || defined(__APPLE__) || defined(__OpenBSD__)
#define INT_FMT "%lld"
#define UINT_FMT "%llu"
#define LONG_FMT "%lld"
@ -61,7 +77,8 @@ typedef uint64_t ULong;
#define ULONG_FMT "%lu"
#endif
#else
#else /* !defined(HAVE_STDINT_H), etc */
#ifndef MAX__INT
#include <limits.h>
#define MAX__INT INT_MAX
@ -102,6 +119,7 @@ typedef unsigned long ULong;
#define LONG_FMT "%ld"
#define ULONG_FMT "%lu"
#endif /* HAVE_STDINT_H */
#define EVAL_STACK_SIZE 1024 /* initial size , can grow */

54
split.c
View File

@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: split.c,v 1.31 2020/07/14 00:43:07 tom Exp $
* $MawkId: split.c,v 1.32 2020/09/13 14:41:05 tom Exp $
*/
/* split.c */
@ -41,11 +41,11 @@ typedef struct split_block {
static Split_Block_Node split_block_base;
static Split_Block_Node *split_block_list = &split_block_base;
/* usually the list is of size 1
the list never gets smaller than size 1
this function returns a bigger list to size 1
*/
/*
* Usually the list is of size 1.
* The list never gets smaller than size 1.
* This function returns a bigger list to size 1.
*/
static void
spb_list_shrink(void)
{
@ -58,11 +58,11 @@ spb_list_shrink(void)
}
}
/* this function is passed a pointer to the tail of the list,
adds a new node and returns the new tail
This makes the list one node bigger
*/
/*
* This function is passed a pointer to the tail of the list,
* adds a new node and returns the new tail
* This makes the list one node bigger
*/
static Split_Block_Node *
grow_sp_list(Split_Block_Node * tail)
{
@ -144,13 +144,14 @@ re_split(char *s, size_t slen, PTR re)
}
}
/* last match at end of s, so last field is "" */
node_p->strings[idx] = new_STRING0(0);
node_p->strings[idx] = new_STRING0((size_t) 0);
return ++cnt;
}
/* match a string with a regular expression, but
* only matches of positive length count
* input a string str and its length
/*
* Matches a string with a regular expression, but only matches of positive
* length count.
* input is a string str and its length.
* return is match point else 0 if no match
* length of match is returned in *lenp
*/
@ -182,8 +183,9 @@ re_pos_match(char *str, size_t str_len, PTR re, size_t *lenp, int no_bol)
return 0;
}
/* like space split but splits s into single character strings */
/*
* like space split but splits s into single character strings
*/
size_t
null_split(const char *s, size_t slen)
{
@ -192,7 +194,7 @@ null_split(const char *s, size_t slen)
unsigned idx = 0;
while (s < end) {
node_p->strings[idx] = new_STRING1(s++, 1);
node_p->strings[idx] = new_STRING1(s++, (size_t) 1);
if (++idx == SP_SIZE) {
idx = 0;
node_p = grow_sp_list(node_p);
@ -201,13 +203,12 @@ null_split(const char *s, size_t slen)
return slen;
}
/* The caller knows there are cnt STRING* in the split_block_list
/*
* The caller knows there are cnt STRING* in the split_block_list
* buffers. This function uses them to make CELLs in cp[]
* The target CELLs are virgin, they don't need to be
* destroyed
*
*/
void
transfer_to_array(CELL cp[], size_t cnt)
{
@ -227,12 +228,11 @@ transfer_to_array(CELL cp[], size_t cnt)
spb_list_shrink();
}
/* like above but transfers the saved pieces to $1, $2 ... $cnt
/*
* like above but transfers the saved pieces to $1, $2 ... $cnt
* The target CELLs may be string type so need to be destroyed
* The caller has made sure the target CELLs exist
*
*/
*/
void
transfer_to_fields(size_t cnt)
{
@ -271,8 +271,8 @@ transfer_to_fields(size_t cnt)
* sp[-1] pts at X
* sp[-2] holds s
*
exit : sp is 2 less, sp[0] is C_DOUBLE CELL with value equal
to the number of split pieces
* exit : sp is 2 less, sp[0] is C_DOUBLE CELL with value equal
* to the number of split pieces
*/
CELL *
bi_split(CELL *sp)

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $MawkId: mawktest,v 1.41 2020/07/25 09:48:14 tom Exp $
# $MawkId: mawktest,v 1.42 2020/09/12 10:00:23 tom Exp $
###############################################################################
# copyright 2008-2014,2020, Thomas E. Dickey
# copyright 2010, Guido Berhoerster
@ -241,7 +241,8 @@ Finish "repetitions test"
#################################
Summary "\n##################################################\ntested $PROG"
echo "##################################################"
Summary "tested $PROG"
echo "##################################################"
trap 0