snapshot of project "mawk", label t20230711

This commit is contained in:
Thomas E. Dickey 2023-07-11 23:57:56 +00:00
parent 7366f996af
commit 049e52b34b
No known key found for this signature in database
GPG Key ID: CC2AF4472167BE03
10 changed files with 1427 additions and 133 deletions

View File

@ -1,10 +1,13 @@
-- $MawkId: CHANGES,v 1.345 2023/05/26 00:08:06 tom Exp $
-- $MawkId: CHANGES,v 1.346 2023/07/11 23:57:56 tom Exp $
NOTE:
The regular expression changes begun in 2020 are incomplete, e.g., do
not handle a mixture of grouping and brace expressions. Fixing that
issue is needed before a new stable release.
20230711
+ regenerate parse.c using byacc 20230521
20230525
+ fix a regression for big-endian machines caused by mismatch between
printf/sprintf format and long integer types (Original-Mawk #69, cf:

View File

@ -1,4 +1,4 @@
MANIFEST for mawk, version t20230525
MANIFEST for mawk, version t20230711
--------------------------------------------------------------------------------
MANIFEST this file
ACKNOWLEDGMENT acknowledgements

View File

@ -1,4 +1,4 @@
# $MawkId: Makefile.in,v 1.57 2023/04/03 07:37:24 tom Exp $
# $MawkId: Makefile.in,v 1.58 2023/07/11 23:53:09 tom Exp $
# Makefile-template for MAWK
###############################################################################
# copyright 2009-2021,2023 Thomas E. Dickey
@ -114,7 +114,7 @@ fpe_test : $(PROG) # test FPEs are handled OK
parse.c : parse.y
@echo expect 4 shift/reduce conflicts
$(YACC) -d parse.y
sed -e '/^#line/s%"y.tab.c"%"parse.c"%' y.tab.c >parse.c
sed -e '/^#line/s%"y.tab.c"%"parse.c"%' -e '/typedef.*YYINT;/s,int,short,' y.tab.c >$@
rm -f y.tab.c
-if cmp -s y.tab.h parse.h ;\
then rm y.tab.h ;\

View File

@ -1,8 +1,8 @@
/* array.c */
/*
$MawkId: array.c,v 1.26 2021/05/28 23:59:47 tom Exp $
$MawkId: array.c,v 1.27 2023/07/11 23:01:31 tom Exp $
copyright 2009-2020,2021 Thomas E. Dickey
copyright 2009-2021,2023 Thomas E. Dickey
copyright 1991-1996,2014 Michael D. Brennan
This is a source file for mawk, an implementation of
@ -371,7 +371,7 @@ find_by_ival(
/* need to search by string */
char buff[256];
STRING *sval;
sprintf(buff, LONG_FMT, ival);
sprintf(buff, LONG_FMT, (Long) ival);
sval = new_STRING(buff);
p = find_by_sval(A, sval, create_flag, redo);
if (*redo) {
@ -487,7 +487,7 @@ add_string_associations(ARRAY A)
for (i = 0; (unsigned) i <= A->hmask; i++) {
p = table[i].ilink;
while (p) {
sprintf(buff, LONG_FMT, p->ival);
sprintf(buff, LONG_FMT, (Long) p->ival);
p->sval = new_STRING(buff);
p->hval = ahash(p->sval);
p->slink = table[A->hmask & p->hval].slink;

View File

@ -1,4 +1,4 @@
.\" $MawkId: mawk-arrays.7,v 1.11 2020/08/18 23:04:29 tom Exp $
.\" $MawkId: mawk-arrays.7,v 1.12 2020/08/18 23:04:29 tom Exp $
.\" ###########################################################################
.\" # copyright 2008-2019,2020, Thomas E. Dickey
.\" # copyright 1996, Michael D. Brennan
@ -11,7 +11,7 @@
.\" ###########################################################################
.ds N Mawk
.ds n mawk
.TH MAWK-ARRAYS 7 "2020-08-18" "Version 1.3.4" "MISCELLANEOUS"
.TH MAWK-ARRAYS 7 2020-08-18 "Version 1.3.4" Miscellaneous
.\" strings
.ds ex \fIexpr\fR
.\" Bulleted paragraph

View File

@ -1,4 +1,4 @@
.\" $MawkId: mawk-code.7,v 1.39 2020/08/22 01:06:09 tom Exp $
.\" $MawkId: mawk-code.7,v 1.40 2020/08/22 01:06:09 tom Exp $
.\" ###########################################################################
.\" # copyright 2020, Thomas E. Dickey
.\" #
@ -10,7 +10,7 @@
.\" ###########################################################################
.ds N Mawk
.ds n mawk
.TH MAWK-CODE 7 "2020-08-21" "Version 1.3.4" "MISCELLANEOUS"
.TH MAWK-CODE 7 2020-08-21 "Version 1.3.4" Miscellaneous
.\" Bulleted paragraph
.de bP
.ie n .IP \(bu 4

View File

@ -1,4 +1,4 @@
.\" $MawkId: mawk.1,v 1.60 2023/04/04 23:05:06 tom Exp $
.\" $MawkId: mawk.1,v 1.61 2023/04/04 23:05:06 tom Exp $
.\" ###########################################################################
.\" # copyright 2008-2020,2023, Thomas E. Dickey
.\" # copyright 1996, Michael D. Brennan
@ -11,7 +11,7 @@
.\" ###########################################################################
.ds N Mawk
.ds n mawk
.TH MAWK 1 "2023-04-04" "Version 1.3.4" "USER COMMANDS"
.TH MAWK 1 2023-04-04 "Version 1.3.4" "User commands"
.\" strings
.ds ex \fIexpr\fR
.\" Bulleted paragraph

1506
parse.c

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,6 @@
#ifndef _yy_defines_h_
#define _yy_defines_h_
#define UNEXPECTED 257
#define BAD_DECIMAL 258
#define NL 259
@ -79,7 +82,7 @@
#endif
#ifndef YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
typedef union{
typedef union YYSTYPE{
CELL *cp ;
SYMTAB *stp ;
int start ; /* code starting address as offset from code_base */
@ -93,3 +96,5 @@ typedef union{
} YYSTYPE;
#endif /* !YYSTYPE_IS_DECLARED */
extern YYSTYPE yylval;
#endif /* _yy_defines_h_ */

16
parse.y
View File

@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: parse.y,v 1.23 2020/01/20 11:49:54 tom Exp $
* $MawkId: parse.y,v 1.24 2023/07/11 23:05:34 tom Exp $
*/
%{
@ -555,13 +555,14 @@ while_front : WHILE LPAREN expr RPAREN
/* while_statement */
statement : while_front statement
{
int saved_offset ;
int len ;
INST *p1 = CDP($1) ;
INST *p2 = CDP($2) ;
if ( p1 != p2 ) /* real test in loop */
{
int saved_offset ;
int len ;
p1[1].op = CodeOffset(p1 + 1) ;
saved_offset = code_offset ;
len = (int) code_pop(code_ptr) ;
@ -1184,18 +1185,21 @@ save_arglist(const char *s)
{
SYMTAB *result = save_id(s);
CA_REC *saveit = ZMALLOC(CA_REC);
CA_REC *p, *q;
if (saveit != 0) {
CA_REC *p, *q;
int arg_num = 0;
for (p = active_arglist, q = 0; p != 0; q = p, p = p->link) {
++arg_num;
}
saveit->link = 0;
saveit->type = ST_LOCAL_NONE;
saveit->arg_num = (short) arg_num;
saveit->call_lineno = token_lineno;
saveit->sym_p = result;
if (q != 0) {
q->link = saveit;
} else {
@ -1241,8 +1245,6 @@ resize_fblock(FBLOCK * fbp)
static void
field_A2I(void)
{
CELL *cp;
if (code_ptr[-1].op == FE_PUSHA &&
code_ptr[-1].ptr == (PTR) 0) {
/* On most architectures, the two tests are the same; a good
@ -1250,7 +1252,7 @@ field_A2I(void)
segmented architectures, they are not */
code_ptr[-1].op = FE_PUSHI;
} else {
cp = (CELL *) code_ptr[-1].ptr;
CELL *cp = (CELL *) code_ptr[-1].ptr;
if ((cp == field) || ((cp > NF) && (cp <= LAST_PFIELD))) {
code_ptr[-2].op = _PUSHI;