snapshot of project "mawk", label t20140821

This commit is contained in:
Thomas E. Dickey 2014-08-22 00:52:21 -04:00
parent 5972bf07d4
commit 6b62514cc3
15 changed files with 46 additions and 40 deletions

View File

@ -1,8 +1,11 @@
-- $MawkId: CHANGES,v 1.198 2014/08/20 22:49:03 tom Exp $
-- $MawkId: CHANGES,v 1.200 2014/08/22 00:48:12 tom Exp $
Changes by Thomas E Dickey <dickey@invisible-island.net>
20140820
20140821
+ change SType and SLen types to improve performance as well as
handling larger regular expressions (suggested by Mike Brennan).
+ fix some minor issues reported by Coverity.
+ regenerate parse.c using byacc 20140422
+ modify makefile-rule for generating parse.c to keep the "#line"
preprocessor lines consistent with the actual filename. This is

View File

@ -1,4 +1,4 @@
MANIFEST for mawk, version t20140820
MANIFEST for mawk, version t20140821
--------------------------------------------------------------------------------
MANIFEST this file
ACKNOWLEDGMENT acknowledgements

View File

@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: bi_funct.c,v 1.91 2014/08/20 19:47:51 tom Exp $
* $MawkId: bi_funct.c,v 1.92 2014/08/21 20:12:27 tom Exp $
* @Log: bi_funct.c,v @
* Revision 1.9 1996/01/14 17:16:11 mike
* flush_all_output() before system()
@ -1409,6 +1409,9 @@ gsub2(PTR re, CELL *repl, CELL *target)
}
}
repl_destroy(&xrepl);
if (output == 0) {
output = new_STRING1(input->str, input->len);
}
TRACE(("..done gsub2\n"));
return output;
}
@ -1496,9 +1499,7 @@ bi_gsub(CELL *sp)
/* cleanup */
free_STRING(string(&sc));
if (tc.ptr != 0) {
free_STRING(string(&tc));
}
free_STRING(string(&tc));
repl_destroy(sp + 1);
return_CELL("bi_gsub", sp);

View File

@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: execute.c,v 1.33 2014/08/14 23:47:43 mike Exp $
* $MawkId: execute.c,v 1.35 2014/08/21 23:13:21 tom Exp $
* @Log: execute.c,v @
* Revision 1.13 1996/02/01 04:39:40 mike
* dynamic array scheme
@ -349,7 +349,7 @@ execute(INST * cdp, /* code ptr, start execution here */
if (t && nf < 0)
split_field0();
sp->ptr = (PTR) field_ptr(t);
if (t > nf) {
if (t < 0 || t > nf) {
/* make sure its set to "" */
cp = (CELL *) sp->ptr;
cell_destroy(cp);
@ -368,9 +368,9 @@ execute(INST * cdp, /* code ptr, start execution here */
if (nf < 0)
split_field0();
if (t <= nf)
if (t >= 0 && t <= nf) {
cellcpy(sp, field_ptr(t));
else {
} else {
sp->type = C_STRING;
sp->ptr = (PTR) & null_str;
null_str.ref_cnt++;

View File

@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: field.c,v 1.29 2014/08/17 16:32:23 tom Exp $
* $MawkId: field.c,v 1.31 2014/08/22 00:00:36 tom Exp $
* @Log: field.c,v @
* Revision 1.5 1995/06/18 19:17:47 mike
* Create a type Int which on most machines is an int, but on machines
@ -153,7 +153,7 @@ set_rs_shadow(void)
CELL c;
STRING *sval;
char *s;
unsigned len;
SLen len;
if (posix_space_flag && mawk_state == EXECUTION)
scan_code['\n'] = SC_UNEXPECTED;
@ -694,7 +694,7 @@ fbank_free(CELL *const fb)
for (cp = fb; cp < end; cp++) {
cell_destroy(cp);
}
zfree(fb, FBANK_SZ * sizeof(CELL *));
zfree(fb, FBANK_SZ * sizeof(CELL));
}
static void

View File

@ -1,6 +1,6 @@
/********************************************
field.h
copyright 2009-2010, Thomas E. Dickey
copyright 2009-2010,2014 Thomas E. Dickey
copyright 1991-1995,2014 Michael D. Brennan
This is a source file for mawk, an implementation of
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: field.h,v 1.11 2014/08/15 00:29:17 mike Exp $
* $MawkId: field.h,v 1.12 2014/08/22 00:51:01 tom Exp $
* @Log: field.h,v @
* Revision 1.2 1995/06/18 19:42:16 mike
* Remove some redundant declarations and add some prototypes
@ -38,7 +38,7 @@ the GNU General Public License, version 2, 1991.
extern void set_field0(char *, size_t);
extern void split_field0(void);
extern void field_assign(CELL *, CELL *);
extern char *is_string_split(PTR, unsigned *);
extern char *is_string_split(PTR, SLen *);
extern void slow_cell_assign(CELL *, CELL *);
extern CELL *slow_field_ptr(int);
extern int field_addr_to_index(CELL *);

View File

@ -1,4 +1,4 @@
mawk-cur (1.3.4-20140820) unstable; urgency=low
mawk-cur (1.3.4-20140821) unstable; urgency=low
* improve experimental gsub
* improve field- and buffer-limits

View File

@ -1,8 +1,8 @@
Summary: mawk - pattern scanning and text processing language
%define AppProgram mawk
%define AppVersion 1.3.4
%define AppRelease 20140820
# $MawkId: mawk.spec,v 1.40 2014/08/20 20:04:55 tom Exp $
%define AppRelease 20140821
# $MawkId: mawk.spec,v 1.41 2014/08/21 23:26:58 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.63 2014/08/20 20:04:55 tom Exp $
* $MawkId: patchlev.h,v 1.64 2014/08/21 23:26:58 tom Exp $
*/
#define PATCH_BASE 1
#define PATCH_LEVEL 3
#define PATCH_STRING ".4"
#define DATE_STRING "20140820"
#define DATE_STRING "20140821"

8
rexp.h
View File

@ -1,8 +1,8 @@
/********************************************
rexp.h
copyright 2008-2010,2012, Thomas E. Dickey
copyright 2008-2012,2014, Thomas E. Dickey
copyright 2010, Jonathan Nieder
copyright 1991, Michael D. Brennan
copyright 1991,2014, Michael D. Brennan
This is a source file for mawk, an implementation of
the AWK programming language.
@ -12,7 +12,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: rexp.h,v 1.25 2012/06/27 09:08:10 tom Exp $
* $MawkId: rexp.h,v 1.26 2014/08/22 00:00:17 tom Exp $
* @Log: rexp.h,v @
* Revision 1.2 1993/07/23 13:21:35 mike
* cleanup rexp code
@ -87,8 +87,6 @@ extern void RE_free(void *);
#define END_ON (2*U_ON)
typedef UChar BV[32]; /* bit vector */
typedef char SType;
typedef UChar SLen;
typedef struct {
SType s_type;

View File

@ -12,7 +12,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: rexp2.c,v 1.22 2014/08/08 08:18:24 tom Exp $
* $MawkId: rexp2.c,v 1.23 2014/08/21 23:58:04 tom Exp $
* @Log: rexp2.c,v @
* Revision 1.3 1993/07/24 17:55:12 mike
* more cleanup
@ -269,7 +269,7 @@ REtest(char *str, /* string to test */
RE_CASE();
case M_STR + U_ON + END_ON:
t = (int) (str_end - s) - m->s_len;
t = (int) (str_end - s) - (int) m->s_len;
if (t < 0 || memcmp(s + t, m->s_data.str, (size_t) m->s_len)) {
RE_FILL();
}

View File

@ -12,7 +12,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: rexp3.c,v 1.32 2014/08/18 00:24:34 mike Exp $
* $MawkId: rexp3.c,v 1.33 2014/08/22 00:52:21 tom Exp $
* @Log: rexp3.c,v @
* Revision 1.3 1993/07/24 17:55:15 mike
* more cleanup
@ -180,7 +180,7 @@ REmatch(char *str, /* string to test */
RE_CASE();
case M_STR + U_ON + END_ON:
t = (int) ((str_end - s) - m->s_len);
t = (int) ((SLen) (str_end - s) - m->s_len);
if (t < 0 || memcmp(ts = s + t, m->s_data.str, (size_t) m->s_len)) {
RE_FILL();
}

View File

@ -1,6 +1,6 @@
/*
regexp_system.c
copyright 2009,2010 Thomas E. Dickey
copyright 2009-2010,2014 Thomas E. Dickey
copyright 2005, Aleksey Cheusov
This is a source file for mawk, an implementation of
@ -11,14 +11,14 @@ the GNU General Public License, version 2, 1991.
*/
/*
* $MawkId: rexp4.c,v 1.7 2010/12/10 17:00:00 tom Exp $
* $MawkId: rexp4.c,v 1.8 2014/08/22 00:52:21 tom Exp $
*/
#include "mawk.h"
#include "rexp.h"
#include "field.h"
char *
is_string_split(PTR q, unsigned *lenp)
is_string_split(PTR q, SLen * lenp)
{
STATE *p = (STATE *) q;

6
scan.c
View File

@ -1,6 +1,6 @@
/********************************************
scan.c
copyright 2008-2012,2013, Thomas E. Dickey
copyright 2008-2013,2014, Thomas E. Dickey
copyright 2010, Jonathan Nieder
copyright 1991-1996,2014, Michael D. Brennan
@ -12,7 +12,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: scan.c,v 1.40 2014/08/15 00:46:10 tom Exp $
* $MawkId: scan.c,v 1.41 2014/08/21 20:05:54 tom Exp $
* @Log: scan.c,v @
* Revision 1.8 1996/07/28 21:47:05 mike
* gnuish patch
@ -625,7 +625,7 @@ yylex(void)
}
/* compute field address at compile time */
if ((d = collect_decimal(c, &flag)) == 0.0) {
if ((d = collect_decimal(c, &flag)) <= 0.0) {
if (flag)
ct_ret(flag); /* an error */
else

10
types.h
View File

@ -1,7 +1,7 @@
/********************************************
types.h
copyright 2009-2010,2012 Thomas E. Dickey
copyright 1991,1993, Michael D. Brennan
copyright 2009-2012,2014 Thomas E. Dickey
copyright 1991-1993,2014 Michael D. Brennan
This is a source file for mawk, an implementation of
the AWK programming language.
@ -11,7 +11,7 @@ the GNU General Public License, version 2, 1991.
********************************************/
/*
* $MawkId: types.h,v 1.11 2012/12/07 11:50:12 tom Exp $
* $MawkId: types.h,v 1.12 2014/08/22 00:51:29 tom Exp $
* @Log: types.h,v @
* Revision 1.3 1993/07/15 23:56:18 mike
* general cleanup
@ -98,4 +98,8 @@ typedef union {
PTR ptr;
} INST;
/* regex types */
typedef int SType;
typedef size_t SLen;
#endif /* MAWK_TYPES_H */