Module Name:    othersrc
Committed By:   agc
Date:           Wed Jun  5 02:59:48 UTC 2013

Modified Files:
        othersrc/external/historical/eawk/dist: b.c eawk.h lib.c run.c tran.c
        othersrc/external/historical/eawk/extend/bzlib: bzlib.c
        othersrc/external/historical/eawk/extend/c: c.c
        othersrc/external/historical/eawk/extend/dirent: dirent.c
        othersrc/external/historical/eawk/extend/zlib: zlib.c

Log Message:
modify the name eawk_lookup to be eawk_array_lookup

change the function's signature so that the array comes first, followed
by the name of the entry.

fix up all uses of eawk_array_lookup()


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/historical/eawk/dist/b.c
cvs rdiff -u -r1.3 -r1.4 othersrc/external/historical/eawk/dist/eawk.h \
    othersrc/external/historical/eawk/dist/lib.c
cvs rdiff -u -r1.5 -r1.6 othersrc/external/historical/eawk/dist/run.c
cvs rdiff -u -r1.4 -r1.5 othersrc/external/historical/eawk/dist/tran.c
cvs rdiff -u -r1.1 -r1.2 \
    othersrc/external/historical/eawk/extend/bzlib/bzlib.c
cvs rdiff -u -r1.1 -r1.2 othersrc/external/historical/eawk/extend/c/c.c
cvs rdiff -u -r1.1 -r1.2 \
    othersrc/external/historical/eawk/extend/dirent/dirent.c
cvs rdiff -u -r1.1 -r1.2 othersrc/external/historical/eawk/extend/zlib/zlib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/historical/eawk/dist/b.c
diff -u othersrc/external/historical/eawk/dist/b.c:1.2 othersrc/external/historical/eawk/dist/b.c:1.3
--- othersrc/external/historical/eawk/dist/b.c:1.2	Fri May 31 05:56:36 2013
+++ othersrc/external/historical/eawk/dist/b.c	Wed Jun  5 02:59:47 2013
@@ -946,7 +946,7 @@ eawk_regcomp(eawk_t *eawk, const char *s
 		}
 	}
 
-	if (strcmp(eawk_getsval(eawk, eawk_lookup("stage", eawk->control)), "compiling") == 0) {
+	if (strcmp(eawk_getsval(eawk, eawk_array_lookup(eawk->control, "stage")), "compiling") == 0) {
 		/* a constant for sure */
 		return mkdfa(eawk, s, anchor);
 	}

Index: othersrc/external/historical/eawk/dist/eawk.h
diff -u othersrc/external/historical/eawk/dist/eawk.h:1.3 othersrc/external/historical/eawk/dist/eawk.h:1.4
--- othersrc/external/historical/eawk/dist/eawk.h:1.3	Wed Jun  5 00:55:25 2013
+++ othersrc/external/historical/eawk/dist/eawk.h	Wed Jun  5 02:59:47 2013
@@ -289,7 +289,7 @@ char	*eawk_setsvalN(eawk_t */*eawk*/, aw
 
 awkarray_t *eawk_asort(eawk_t */*eawk*/, awkarray_t */*array*/, int /*asorti*/, int */*sortc*/);
 awkcell_t	*eawk_new_array(eawk_t */*eawk*/, awkcell_t */*arrayname*/);
-awkcell_t	*eawk_lookup(const char */*name*/, awkarray_t */*array*/);
+awkcell_t	*eawk_array_lookup(awkarray_t */*array*/, const char */*name*/);
 int	eawk_define_constant(eawk_t */*eawk*/, const char */*name*/, int64_t /*valnum*/);
 
 __END_DECLS
Index: othersrc/external/historical/eawk/dist/lib.c
diff -u othersrc/external/historical/eawk/dist/lib.c:1.3 othersrc/external/historical/eawk/dist/lib.c:1.4
--- othersrc/external/historical/eawk/dist/lib.c:1.3	Wed Jun  5 00:55:25 2013
+++ othersrc/external/historical/eawk/dist/lib.c	Wed Jun  5 02:59:47 2013
@@ -59,7 +59,7 @@ initgetrec(eawk_t *eawk)
 
 	for (i = 1; i < *eawk->ARGC; i++) {
 		if (!eawk_isclvar(p = getargv(eawk, i))) {	/* find 1st real filename */
-			eawk_setsval(eawk, eawk_lookup("FILENAME", eawk->symtab), getargv(eawk, i));
+			eawk_setsval(eawk, eawk_array_lookup(eawk->symtab, "FILENAME"), getargv(eawk, i));
 			return;
 		}
 		eawk_setclvar(eawk, p);	/* a commandline assignment before filename */
@@ -181,7 +181,7 @@ eprint(eawk_t *eawk)
 	char	*stage;
 	char *p, *q;
 
-	stage = eawk_getsval(eawk, eawk_lookup("stage", eawk->control));
+	stage = eawk_getsval(eawk, eawk_array_lookup(eawk->control, "stage"));
 	if (strcmp(stage, "error display") == 0 || strcmp(stage, "running") == 0 || eawk->eprintc++ > 0) {
 		return;
 	}
@@ -252,7 +252,7 @@ error(eawk_t *eawk)
 {
 	char	*stage;
 
-	stage = eawk_getsval(eawk, eawk_lookup("stage", eawk->control));
+	stage = eawk_getsval(eawk, eawk_array_lookup(eawk->control, "stage"));
 	(void) fprintf(stderr, "\n");
 	if (strcmp(stage, "error display") == 0 && eawk->NR && *eawk->NR > 0) {
 		(void) fprintf(stderr, " input record number %d", (int) (*eawk->FNR));
@@ -688,14 +688,14 @@ eawk_syntax(eawk_t *eawk, const char *fm
 
 	if (eawk->syntaxc++ > 2)
 		return;
-	(void) fprintf(stderr, "%s: ", eawk_getsval(eawk, eawk_lookup("cmdname", eawk->control)));
+	(void) fprintf(stderr, "%s: ", eawk_getsval(eawk, eawk_array_lookup(eawk->control, "cmdname")));
 	va_start(varg, fmt);
 	vfprintf(stderr, fmt, varg);
 	va_end(varg);
 	(void) fprintf(stderr, " at source line %d", eawk->lineno);
 	if (eawk->curfname != NULL)
 		(void) fprintf(stderr, " in function %s", eawk->curfname);
-	stage = eawk_getsval(eawk, eawk_lookup("stage", eawk->control));
+	stage = eawk_getsval(eawk, eawk_array_lookup(eawk->control, "stage"));
 	if (strcmp(stage, "compiling") == 0 && cursource(eawk) != NULL)
 		(void) fprintf(stderr, " source file %s", cursource(eawk));
 	(void) fprintf(stderr, "\n");
@@ -724,7 +724,7 @@ eawk_warning(eawk_t *eawk, const char *f
 
 	fflush(stdout);
 	(void) fprintf(stderr, "%s: ",
-		eawk_getsval(eawk, eawk_lookup("cmdname", eawk->control)));
+		eawk_getsval(eawk, eawk_array_lookup(eawk->control, "cmdname")));
 	va_start(varg, fmt);
 	vfprintf(stderr, fmt, varg);
 	va_end(varg);

Index: othersrc/external/historical/eawk/dist/run.c
diff -u othersrc/external/historical/eawk/dist/run.c:1.5 othersrc/external/historical/eawk/dist/run.c:1.6
--- othersrc/external/historical/eawk/dist/run.c:1.5	Wed Jun  5 00:55:25 2013
+++ othersrc/external/historical/eawk/dist/run.c	Wed Jun  5 02:59:47 2013
@@ -840,7 +840,7 @@ eawk_intest(eawk_t *eawk, awknode_t **a,
 		if (p->nnext)
 			strcat((char *)buf, *eawk->SUBSEP);
 	}
-	k = eawk_lookup((char *)(void *)buf, ap->str);
+	k = eawk_array_lookup(ap->str, (char *)(void *)buf);
 	TEMPFREE(eawk, ap);
 	free(buf);
 	if (k == NULL)

Index: othersrc/external/historical/eawk/dist/tran.c
diff -u othersrc/external/historical/eawk/dist/tran.c:1.4 othersrc/external/historical/eawk/dist/tran.c:1.5
--- othersrc/external/historical/eawk/dist/tran.c:1.4	Wed Jun  5 00:55:25 2013
+++ othersrc/external/historical/eawk/dist/tran.c	Wed Jun  5 02:59:47 2013
@@ -36,7 +36,7 @@ THIS SOFTWARE.
 #define	FULLTAB	2	/* rehash when table gets this x full */
 #define	GROWTAB 4	/* grow table by this factor */
 
-static void	rehash(awkarray_t *);
+static int	rehash(awkarray_t *);
 
 static awkcell_t	*nullloc;	/* a guaranteed empty cell */
 
@@ -236,13 +236,13 @@ void *
 eawk_ctlvar_get_ptr(eawk_t *eawk, const char *varname)
 {
 	if (strcmp(varname, "cmdname") == 0) {
-		return eawk_getsval(eawk, eawk_lookup("cmdname", eawk->control));
+		return eawk_getsval(eawk, eawk_array_lookup(eawk->control, "cmdname"));
 	}
 	if (strcmp(varname, "winner") == 0) {
 		return eawk->winner;
 	}
 	if (strcmp(varname, "stage") == 0) {
-		return eawk_getsval(eawk, eawk_lookup("stage", eawk->control));
+		return eawk_getsval(eawk, eawk_array_lookup(eawk->control, "stage"));
 	}
 	return NULL;
 }
@@ -331,7 +331,7 @@ eawk_var_set(eawk_t *eawk, const char *n
 	if (name == NULL)
 		name = "";
 
-	if ((p = eawk_lookup(name, arr)) != NULL) {
+	if ((p = eawk_array_lookup(arr, name)) != NULL) {
 		DPRINTF(eawk, ("eawk_var_set found %p: name=%s s=\"%s\" f=%g t=%o\n",
 			p, NN(p->name), (const char *)NN(p->str), p->num, p->type) );
 		return p;
@@ -409,7 +409,7 @@ eawk_define_constant(eawk_t *eawk, const
 {
 	awkcell_t	*cell;
 
-	if ((cell = eawk_lookup(name, eawk->symtab)) == NULL) {
+	if ((cell = eawk_array_lookup(eawk->symtab, name)) == NULL) {
 		eawk_var_set(eawk, name, "", (awknum_t)valnum, EAWK_CONST|EAWK_NUM|EAWK_DONTFREE, eawk->symtab);
 	} else {
 		eawk_setfval(eawk, cell, (awknum_t)valnum);
@@ -429,7 +429,7 @@ eawk_hash(const char *s, int n)
 }
 
 /* rehash items in small table into big one */
-static void
+static int
 rehash(awkarray_t *arr)
 {
 	int i, nh, nsz;
@@ -438,7 +438,7 @@ rehash(awkarray_t *arr)
 	nsz = GROWTAB * arr->size;
 	np = calloc(nsz, sizeof(*np));
 	if (np == NULL)		/* can't do it, but can keep running. */
-		return;		/* someone else will run out later. */
+		return 0;		/* someone else will run out later. */
 	for (i = 0; i < arr->size; i++) {
 		for (cp = arr->tab[i]; cp; cp = op) {
 			op = cp->cnext;
@@ -450,11 +450,12 @@ rehash(awkarray_t *arr)
 	free(arr->tab);
 	arr->tab = np;
 	arr->size = nsz;
+	return 1;
 }
 
 /* look for s in arr */
 awkcell_t *
-eawk_lookup(const char *s, awkarray_t *arr)
+eawk_array_lookup(awkarray_t *arr, const char *s)
 {
 	awkcell_t *p;
 	int h;

Index: othersrc/external/historical/eawk/extend/bzlib/bzlib.c
diff -u othersrc/external/historical/eawk/extend/bzlib/bzlib.c:1.1 othersrc/external/historical/eawk/extend/bzlib/bzlib.c:1.2
--- othersrc/external/historical/eawk/extend/bzlib/bzlib.c:1.1	Wed Jun  5 00:55:26 2013
+++ othersrc/external/historical/eawk/extend/bzlib/bzlib.c	Wed Jun  5 02:59:48 2013
@@ -165,11 +165,11 @@ eawk_bzlib_decompress(void *veawk, char 
 	rc = BZ_PARAM_ERROR;
 	if (argc >= 2 && argc <= 3) {
 		array = a[0];
-		cell = eawk_lookup("data", (awkarray_t *)(void *)array->str);
+		cell = eawk_array_lookup((awkarray_t *)(void *)array->str, "data");
 		src = (char *)eawk_getsval(eawk, cell);
-		cell = eawk_lookup("size", (awkarray_t *)(void *)array->str);
+		cell = eawk_array_lookup((awkarray_t *)(void *)array->str, "size");
 		srclen = (unsigned)eawk_getfval(eawk, cell);
-		cell = eawk_lookup("srcsize", (awkarray_t *)(void *)array->str);
+		cell = eawk_array_lookup((awkarray_t *)(void *)array->str, "srcsize");
 		destlen = (unsigned)eawk_getfval(eawk, cell) + 1024;
 		dest = calloc(1, destlen);
 		verbosity = (argc > 2) ? (int)eawk_getfval(eawk, a[1]) : DEFAULT_BZLIB_VERBOSITY;

Index: othersrc/external/historical/eawk/extend/c/c.c
diff -u othersrc/external/historical/eawk/extend/c/c.c:1.1 othersrc/external/historical/eawk/extend/c/c.c:1.2
--- othersrc/external/historical/eawk/extend/c/c.c:1.1	Fri May 31 05:56:37 2013
+++ othersrc/external/historical/eawk/extend/c/c.c	Wed Jun  5 02:59:47 2013
@@ -432,16 +432,16 @@ eawk_c_getaddrinfo(void *veawk, char *na
 	hostname = eawk_getsval(eawk, a[0]);
 	servname = eawk_getsval(eawk, a[1]);
 	array = (awkarray_t *)(void *)a[2]->str;
-	if ((cell = eawk_lookup("ai_family", array)) != NULL) {
+	if ((cell = eawk_array_lookup(array, "ai_family")) != NULL) {
 		hints.ai_family = (int)eawk_getfval(eawk, cell);
 	}
-	if ((cell = eawk_lookup("ai_socktype", array)) != NULL) {
+	if ((cell = eawk_array_lookup(array, "ai_socktype")) != NULL) {
 		hints.ai_socktype = (int)eawk_getfval(eawk, cell);
 	}
-	if ((cell = eawk_lookup("ai_protocol", array)) != NULL) {
+	if ((cell = eawk_array_lookup(array, "ai_protocol")) != NULL) {
 		hints.ai_protocol = (int)eawk_getfval(eawk, cell);
 	}
-	if ((cell = eawk_lookup("ai_flags", array)) != NULL) {
+	if ((cell = eawk_array_lookup(array, "ai_flags")) != NULL) {
 		hints.ai_flags = (int)eawk_getfval(eawk, cell);
 	}
 	if ((rc = getaddrinfo(hostname, servname, &hints, &res0)) == 0) {

Index: othersrc/external/historical/eawk/extend/dirent/dirent.c
diff -u othersrc/external/historical/eawk/extend/dirent/dirent.c:1.1 othersrc/external/historical/eawk/extend/dirent/dirent.c:1.2
--- othersrc/external/historical/eawk/extend/dirent/dirent.c:1.1	Fri May 31 05:56:37 2013
+++ othersrc/external/historical/eawk/extend/dirent/dirent.c	Wed Jun  5 02:59:48 2013
@@ -102,27 +102,27 @@ eawk_dirent_readdir(void *veawk, char *n
 		dirp = n2ptr((int64_t)eawk_getfval(eawk, a[0]));
 		if ((d = readdir(dirp)) != NULL) {
 			array = (awkarray_t *)(void *)a[1]->str;
-			if ((cell = eawk_lookup("d_fileno", array)) == NULL) {
+			if ((cell = eawk_array_lookup(array, "d_fileno")) == NULL) {
 				eawk_var_set(eawk, "d_fileno", "", (awknum_t)d->d_fileno, EAWK_NUM, (awkarray_t *)(void *)array);
 			} else {
 				eawk_setfval(eawk, cell, (awknum_t)d->d_fileno);
 			}
-			if ((cell = eawk_lookup("d_reclen", array)) == NULL) {
+			if ((cell = eawk_array_lookup(array, "d_reclen")) == NULL) {
 				eawk_var_set(eawk, "d_reclen", "", (awknum_t)d->d_reclen, EAWK_NUM, (awkarray_t *)(void *)array);
 			} else {
 				eawk_setfval(eawk, cell, (awknum_t)d->d_reclen);
 			}
-			if ((cell = eawk_lookup("d_namlen", array)) == NULL) {
+			if ((cell = eawk_array_lookup(array, "d_namlen")) == NULL) {
 				eawk_var_set(eawk, "d_namlen", "", (awknum_t)d->d_namlen, EAWK_NUM, (awkarray_t *)(void *)array);
 			} else {
 				eawk_setfval(eawk, cell, (awknum_t)d->d_namlen);
 			}
-			if ((cell = eawk_lookup("d_type", array)) == NULL) {
+			if ((cell = eawk_array_lookup(array, "d_type")) == NULL) {
 				eawk_var_set(eawk, "d_type", "", (awknum_t)d->d_type, EAWK_NUM, (awkarray_t *)(void *)array);
 			} else {
 				eawk_setfval(eawk, cell, (awknum_t)d->d_type);
 			}
-			if ((cell = eawk_lookup("d_name", array)) == NULL) {
+			if ((cell = eawk_array_lookup(array, "d_name")) == NULL) {
 				eawk_var_set(eawk, "d_name", d->d_name, 0.0, EAWK_STR, (awkarray_t *)(void *)array);
 			} else {
 				eawk_setsval(eawk, cell, d->d_name);

Index: othersrc/external/historical/eawk/extend/zlib/zlib.c
diff -u othersrc/external/historical/eawk/extend/zlib/zlib.c:1.1 othersrc/external/historical/eawk/extend/zlib/zlib.c:1.2
--- othersrc/external/historical/eawk/extend/zlib/zlib.c:1.1	Wed Jun  5 00:55:26 2013
+++ othersrc/external/historical/eawk/extend/zlib/zlib.c	Wed Jun  5 02:59:48 2013
@@ -226,11 +226,11 @@ eawk_zlib_uncompress(void *veawk, char *
 	rc = Z_DATA_ERROR;
 	if (argc == 2) {
 		array = a[0];
-		cell = eawk_lookup("data", (awkarray_t *)(void *)array->str);
+		cell = eawk_array_lookup((awkarray_t *)(void *)array->str, "data");
 		src = (uint8_t *)eawk_getsval(eawk, cell);
-		cell = eawk_lookup("size", (awkarray_t *)(void *)array->str);
+		cell = eawk_array_lookup((awkarray_t *)(void *)array->str, "size");
 		srclen = (size_t)eawk_getfval(eawk, cell);
-		cell = eawk_lookup("srcsize", (awkarray_t *)(void *)array->str);
+		cell = eawk_array_lookup((awkarray_t *)(void *)array->str, "srcsize");
 		destlen = (size_t)eawk_getfval(eawk, cell) + 1024;
 		dest = calloc(1, destlen);
 		if ((rc = uncompress(dest, &destlen, src, srclen)) == Z_OK) {

Reply via email to