- Update to 20100209

PR:		ports/146172
Submitted by:	Pedro Giffuni <giffunip@tutopia.com>
Approved by:	maintainer(timeout, >2 weeks)
This commit is contained in:
Wen Heping 2010-05-19 05:44:33 +00:00
parent d5984a456a
commit 022b90a503
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=254579
8 changed files with 134 additions and 103 deletions

View file

@ -7,7 +7,7 @@
# #
PORTNAME= nawk PORTNAME= nawk
PORTVERSION= 20091126 PORTVERSION= 20100209
CATEGORIES= lang CATEGORIES= lang
MASTER_SITES= http://www.cs.princeton.edu/~bwk/btl.mirror/ MASTER_SITES= http://www.cs.princeton.edu/~bwk/btl.mirror/
DISTNAME= awk DISTNAME= awk

View file

@ -1,3 +1,3 @@
MD5 (nawk/awk.tar.gz) = ec8545e7c732e4402e963c70ba766a5b MD5 (nawk/awk.tar.gz) = 7e6c71ae36ec48ce1d9160f25174bf77
SHA256 (nawk/awk.tar.gz) = 4dbf070864f8ea626ef2b24b2bca6efc8fb372cf6d96fdcf3926663a6e8d0099 SHA256 (nawk/awk.tar.gz) = d3b9c2df870d5dc48575fe5c8c5004c73e9ebf124710e83c0e6febdc0df104c1
SIZE (nawk/awk.tar.gz) = 117853 SIZE (nawk/awk.tar.gz) = 123234

View file

@ -0,0 +1,15 @@
--- awk.h.orig 2004/12/30 01:52:48 1.11
+++ awk.h 2008/06/04 14:04:42 1.12
@@ -127,6 +127,12 @@
#define FTOUPPER 12
#define FTOLOWER 13
#define FFLUSH 14
+#define FAND 15
+#define FFOR 16
+#define FXOR 17
+#define FCOMPL 18
+#define FLSHIFT 19
+#define FRSHIFT 20
/* Node: parse tree is made of nodes, with Cell's at bottom */

View file

@ -1,67 +0,0 @@
--- b.c.orig 2007-03-31 15:56:18.000000000 -0500
+++ b.c 2008-07-07 08:44:50.000000000 -0500
@@ -84,8 +84,8 @@
if (setvec == 0) { /* first time through any RE */
maxsetvec = MAXLIN;
- setvec = (int *) malloc(maxsetvec * sizeof(int));
- tmpset = (int *) malloc(maxsetvec * sizeof(int));
+ setvec = (int *) calloc(maxsetvec, sizeof(int));
+ tmpset = (int *) calloc(maxsetvec, sizeof(int));
if (setvec == 0 || tmpset == 0)
overflo("out of space initializing makedfa");
}
@@ -137,7 +137,7 @@
f->accept = poscnt-1; /* penter has computed number of positions in re */
cfoll(f, p1); /* set up follow sets */
freetr(p1);
- if ((f->posns[0] = (int *) calloc(1, *(f->re[0].lfollow)*sizeof(int))) == NULL)
+ if ((f->posns[0] = (int *) calloc(*(f->re[0].lfollow), sizeof(int))) == NULL)
overflo("out of space in makedfa");
if ((f->posns[1] = (int *) calloc(1, sizeof(int))) == NULL)
overflo("out of space in makedfa");
@@ -157,7 +157,7 @@
f->reset = 0;
k = *(f->re[0].lfollow);
xfree(f->posns[2]);
- if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
+ if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL)
overflo("out of space in makeinit");
for (i=0; i <= k; i++) {
(f->posns[2])[i] = (f->re[0].lfollow)[i];
@@ -357,7 +357,7 @@
setvec[i] = 0;
setcnt = 0;
follow(v); /* computes setvec and setcnt */
- if ((p = (int *) calloc(1, (setcnt+1)*sizeof(int))) == NULL)
+ if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL)
overflo("out of space building follow set");
f->re[info(v)].lfollow = p;
*p = setcnt;
@@ -531,7 +531,7 @@
for (i = 2; i <= f->curstat; i++)
xfree(f->posns[i]);
k = *f->posns[0];
- if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
+ if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL)
overflo("out of space in pmatch");
for (i = 0; i <= k; i++)
(f->posns[2])[i] = (f->posns[0])[i];
@@ -588,7 +588,7 @@
for (i = 2; i <= f->curstat; i++)
xfree(f->posns[i]);
k = *f->posns[0];
- if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
+ if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL)
overflo("out of state space");
for (i = 0; i <= k; i++)
(f->posns[2])[i] = (f->posns[0])[i];
@@ -920,7 +920,7 @@
for (i = 0; i < NCHARS; i++)
f->gototab[f->curstat][i] = 0;
xfree(f->posns[f->curstat]);
- if ((p = (int *) calloc(1, (setcnt+1)*sizeof(int))) == NULL)
+ if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL)
overflo("out of space in cgoto");
f->posns[f->curstat] = p;

View file

@ -0,0 +1,39 @@
--- lex.c.orig 2006/04/16 02:10:18 1.9
+++ lex.c 2008/06/04 14:04:42 1.10
@@ -48,9 +48,11 @@
{ "BEGIN", XBEGIN, XBEGIN },
{ "END", XEND, XEND },
{ "NF", VARNF, VARNF },
+ { "and", FAND, BLTIN },
{ "atan2", FATAN, BLTIN },
{ "break", BREAK, BREAK },
{ "close", CLOSE, CLOSE },
+ { "compl", FCOMPL, BLTIN },
{ "continue", CONTINUE, CONTINUE },
{ "cos", FCOS, BLTIN },
{ "delete", DELETE, DELETE },
@@ -70,13 +72,16 @@
{ "int", FINT, BLTIN },
{ "length", FLENGTH, BLTIN },
{ "log", FLOG, BLTIN },
+ { "lshift", FLSHIFT, BLTIN },
{ "match", MATCHFCN, MATCHFCN },
{ "next", NEXT, NEXT },
{ "nextfile", NEXTFILE, NEXTFILE },
+ { "or", FFOR, BLTIN },
{ "print", PRINT, PRINT },
{ "printf", PRINTF, PRINTF },
{ "rand", FRAND, BLTIN },
{ "return", RETURN, RETURN },
+ { "rshift", FRSHIFT, BLTIN },
{ "sin", FSIN, BLTIN },
{ "split", SPLIT, SPLIT },
{ "sprintf", SPRINTF, SPRINTF },
@@ -88,6 +93,7 @@
{ "tolower", FTOLOWER, BLTIN },
{ "toupper", FTOUPPER, BLTIN },
{ "while", WHILE, WHILE },
+ { "xor", FXOR, BLTIN },
};
#define DEBUG

View file

@ -1,29 +0,0 @@
--- lib.c.orig 2007-10-22 18:17:52.000000000 -0500
+++ lib.c 2008-07-07 09:38:58.000000000 -0500
@@ -59,7 +59,7 @@
{
if ( (record = (char *) malloc(n)) == NULL
|| (fields = (char *) malloc(n+1)) == NULL
- || (fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *))) == NULL
+ || (fldtab = (Cell **) calloc((nfields+1), sizeof(Cell *))) == NULL
|| (fldtab[0] = (Cell *) malloc(sizeof(Cell))) == NULL )
FATAL("out of space for $0 and fields");
*fldtab[0] = dollar0;
@@ -78,7 +78,7 @@
if (fldtab[i] == NULL)
FATAL("out of space in makefields %d", i);
*fldtab[i] = dollar1;
- sprintf(temp, "%d", i);
+ snprintf(temp, sizeof temp, "%d", i);
fldtab[i]->nval = tostring(temp);
}
}
@@ -226,7 +226,7 @@
char *s, temp[50];
extern Array *ARGVtab;
- sprintf(temp, "%d", n);
+ snprintf(temp, sizeof temp, "%d", n);
x = setsymtab(temp, "", 0.0, STR, ARGVtab);
s = getsval(x);
dprintf( ("getargv(%d) returns |%s|\n", n, s) );

View file

@ -0,0 +1,10 @@
--- proto.h.orig 2003/10/26 11:34:23 1.5
+++ proto.h 2007/11/06 23:07:52 1.5.22.1
@@ -112,6 +112,7 @@ extern double getfval(Cell *);
extern char *getsval(Cell *);
extern char *getpssval(Cell *); /* for print */
extern char *tostring(const char *);
+extern char *tostringN(const char *, size_t n);
extern char *qstring(const char *, int);
extern void recinit(unsigned int);

View file

@ -1,6 +1,69 @@
--- run.c.orig Mon Dec 6 06:44:42 2004 --- run.c.orig 2009-11-26 23:59:16.000000000 +0000
+++ run.c Sat Feb 26 18:01:46 2005 +++ run.c 2010-04-29 22:50:49.000000000 +0000
@@ -1507,15 +1507,15 @@ @@ -1504,20 +1504,78 @@
nextarg = nextarg->nnext;
}
break;
+ case FCOMPL:
+ u = ~((int)getfval(x));
+ break;
+ case FAND:
+ if (nextarg == 0) {
+ WARNING("and requires two arguments; returning 0");
+ u = 0;
+ break;
+ }
+ y = execute(a[1]->nnext);
+ u = ((int)getfval(x)) & ((int)getfval(y));
+ tempfree(y);
+ nextarg = nextarg->nnext;
+ break;
+ case FFOR:
+ if (nextarg == 0) {
+ WARNING("or requires two arguments; returning 0");
+ u = 0;
+ break;
+ }
+ y = execute(a[1]->nnext);
+ u = ((int)getfval(x)) | ((int)getfval(y));
+ tempfree(y);
+ nextarg = nextarg->nnext;
+ break;
+ case FXOR:
+ if (nextarg == 0) {
+ WARNING("or requires two arguments; returning 0");
+ u = 0;
+ break;
+ }
+ y = execute(a[1]->nnext);
+ u = ((int)getfval(x)) ^ ((int)getfval(y));
+ tempfree(y);
+ nextarg = nextarg->nnext;
+ break;
+ case FLSHIFT:
+ if (nextarg == 0) {
+ WARNING("or requires two arguments; returning 0");
+ u = 0;
+ break;
+ }
+ y = execute(a[1]->nnext);
+ u = ((int)getfval(x)) << ((int)getfval(y));
+ tempfree(y);
+ nextarg = nextarg->nnext;
+ break;
+ case FRSHIFT:
+ if (nextarg == 0) {
+ WARNING("or requires two arguments; returning 0");
+ u = 0;
+ break;
+ }
+ y = execute(a[1]->nnext);
+ u = ((int)getfval(x)) >> ((int)getfval(y));
+ tempfree(y);
+ nextarg = nextarg->nnext;
+ break;
case FSYSTEM:
fflush(stdout); /* in case something is buffered already */
u = (Awkfloat) system(getsval(x)) / 256; /* 256 is unix-dep */ u = (Awkfloat) system(getsval(x)) / 256; /* 256 is unix-dep */
break; break;
case FRAND: case FRAND: