CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sun Mar 24 00:03:14 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: main.c make.1 meta.c meta.h Log Message: Merge -r1.210 of main.c, -r1.212 of make.1, -r1.27 of meta.c, and -r1.3 of meta.h from HEAD (committed by sjg): If built with filemon support, set .MAKE.PATH_FILEMON to _PATH_FILEMON so that makefiles can test for it. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 othersrc/usr.bin/dholland-make2/main.c cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/make.1 cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/meta.c cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/meta.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/main.c diff -u othersrc/usr.bin/dholland-make2/main.c:1.11 othersrc/usr.bin/dholland-make2/main.c:1.12 --- othersrc/usr.bin/dholland-make2/main.c:1.11 Sat Mar 23 23:29:04 2013 +++ othersrc/usr.bin/dholland-make2/main.c Sun Mar 24 00:03:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.11 2013/03/23 23:29:04 dholland Exp $ */ +/* $NetBSD: main.c,v 1.12 2013/03/24 00:03:14 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -128,7 +128,7 @@ MAKE_COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ The Regents of the University of California. All rights reserved."); -MAKE_RCSID("$NetBSD: main.c,v 1.11 2013/03/23 23:29:04 dholland Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.12 2013/03/24 00:03:14 dholland Exp $"); #ifndef DEFMAXLOCAL @@ -717,7 +717,7 @@ MakeMode(const char *mode) } #if USE_META if (strstr(mode, "meta")) - meta_init(mode); + meta_mode_init(mode); #endif } if (mp) @@ -929,6 +929,9 @@ main(int argc, char **argv) } Job_SetPrefix(); +#ifdef USE_META + meta_init(); +#endif /* * First snag any flags out of the MAKE environment variable. * (Note this is *not* MAKEFLAGS since /bin/make uses that and it's Index: othersrc/usr.bin/dholland-make2/make.1 diff -u othersrc/usr.bin/dholland-make2/make.1:1.2 othersrc/usr.bin/dholland-make2/make.1:1.3 --- othersrc/usr.bin/dholland-make2/make.1:1.2 Sat Mar 23 23:50:46 2013 +++ othersrc/usr.bin/dholland-make2/make.1 Sun Mar 24 00:03:14 2013 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.2 2013/03/23 23:50:46 dholland Exp $ +.\" $NetBSD: make.1,v 1.3 2013/03/24 00:03:14 dholland Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd March 5, 2013 +.Dd March 22, 2013 .Dt MAKE 1 .Os .Sh NAME @@ -874,6 +874,13 @@ by appending their names to is re-exported whenever .Ql Va .MAKEOVERRIDES is modified. +.It Va .MAKE.PATH_FILEMON +If +.Nm +was built with +.Xr filemon 4 +support, this is set to the path of the device node. +This allows makefiles to test for this support. .It Va .MAKE.PID The process-id of .Nm . Index: othersrc/usr.bin/dholland-make2/meta.c diff -u othersrc/usr.bin/dholland-make2/meta.c:1.3 othersrc/usr.bin/dholland-make2/meta.c:1.4 --- othersrc/usr.bin/dholland-make2/meta.c:1.3 Sat Mar 23 22:00:51 2013 +++ othersrc/usr.bin/dholland-make2/meta.c Sun Mar 24 00:03:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.3 2013/03/23 22:00:51 dholland Exp $ */ +/* $NetBSD: meta.c,v 1.4 2013/03/24 00:03:14 dholland Exp $ */ /* * Implement 'meta' mode. @@ -54,7 +54,7 @@ # define USE_FILEMON #endif -MAKE_RCSID("$NetBSD: meta.c,v 1.3 2013/03/23 22:00:51 dholland Exp $"); +MAKE_RCSID("$NetBSD: meta.c,v 1.4 2013/03/24 00:03:14 dholland Exp $"); static BuildMon Mybm; /* for compat */ static struct stringarray metaBailiwick; /* our scope of control */ @@ -544,8 +544,24 @@ boolValue(char *s) return TRUE; } +/* + * Initialization we need before reading makefiles. + */ +void +meta_init(void) +{ +#ifdef USE_FILEMON + /* this allows makefiles to test if we have filemon support */ + Var_Set(".MAKE.PATH_FILEMON", _PATH_FILEMON, VAR_GLOBAL, 0); +#endif +} + + +/* + * Initialization we need after reading makefiles. + */ void -meta_init(const char *make_mode) +meta_mode_init(const char *make_mode) { static int once = 0; char *cp; Index: othersrc/usr.bin/dholland-make2/meta.h diff -u othersrc/usr.bin/dholland-make2/meta.h:1.1.1.1 othersrc/usr.bin/dholland-make2/meta.h:1.2 --- othersrc/usr.bin/dholland-make2/meta.h:1.1.1.1 Mon Feb 25 01:33:04 2013 +++ othersrc/usr.bin/dholland-make2/meta.h Sun Mar 24 00:03:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: meta.h,v 1.1.1.1 2013/02/25 01:33:04 dholland Exp $ */ +/* $NetBSD: meta.h,v 1.2 2013/03/24 00:03:14 dholland Exp $ */ /* * Things needed for 'meta' mode. @@ -41,7 +41,8 @@ typedef struct BuildMon { extern Boolean useMeta; struct Job;/* not defined yet */ -void meta_init(const char *); +void meta_init(void); +void meta
CVS commit: othersrc/usr.bin/dholland-make2/unit-tests
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 23:59:18 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2/unit-tests: Makefile test.exp Added Files: othersrc/usr.bin/dholland-make2/unit-tests: export-env Log Message: Merge -r1.36 of unit-tests/Makefile, -r1.1 of unit-tests/export-env, and -r1.42 of unit-tests/test.exp from HEAD (committed by sjg): Add unit-test for export-env and gmake export To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 \ othersrc/usr.bin/dholland-make2/unit-tests/Makefile \ othersrc/usr.bin/dholland-make2/unit-tests/test.exp cvs rdiff -u -r0 -r1.1 othersrc/usr.bin/dholland-make2/unit-tests/export-env Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/unit-tests/Makefile diff -u othersrc/usr.bin/dholland-make2/unit-tests/Makefile:1.1.1.1 othersrc/usr.bin/dholland-make2/unit-tests/Makefile:1.2 --- othersrc/usr.bin/dholland-make2/unit-tests/Makefile:1.1.1.1 Mon Feb 25 01:33:22 2013 +++ othersrc/usr.bin/dholland-make2/unit-tests/Makefile Sat Mar 23 23:59:17 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1.1.1 2013/02/25 01:33:22 dholland Exp $ +# $NetBSD: Makefile,v 1.2 2013/03/23 23:59:17 dholland Exp $ # # Unit tests for make(1) # The main targets are: @@ -24,6 +24,7 @@ SUBFILES= \ error \ export \ export-all \ + export-env \ doterror \ dotwait \ forloop \ Index: othersrc/usr.bin/dholland-make2/unit-tests/test.exp diff -u othersrc/usr.bin/dholland-make2/unit-tests/test.exp:1.1.1.1 othersrc/usr.bin/dholland-make2/unit-tests/test.exp:1.2 --- othersrc/usr.bin/dholland-make2/unit-tests/test.exp:1.1.1.1 Mon Feb 25 01:33:23 2013 +++ othersrc/usr.bin/dholland-make2/unit-tests/test.exp Sat Mar 23 23:59:17 2013 @@ -43,6 +43,14 @@ UT_OK=good UT_OKDIR=unit-tests UT_TEST=export-all UT_ZOO=hoopie +make: +UT_TEST=export-env +UT_ENV=not-exported +UT_EXP=not-exported +env: +UT_TEST=export-env +UT_ENV=exported +UT_EXP=exported At first, I am happy and now: sad Added files: Index: othersrc/usr.bin/dholland-make2/unit-tests/export-env diff -u /dev/null othersrc/usr.bin/dholland-make2/unit-tests/export-env:1.1 --- /dev/null Sat Mar 23 23:59:18 2013 +++ othersrc/usr.bin/dholland-make2/unit-tests/export-env Sat Mar 23 23:59:17 2013 @@ -0,0 +1,24 @@ +# $Id: export-env,v 1.1 2013/03/23 23:59:17 dholland Exp $ + +# our normal .export, subsequent changes affect the environment +UT_TEST=this +.export UT_TEST +UT_TEST:= ${.PARSEFILE} + +# not so with .export-env +UT_ENV=exported +.export-env UT_ENV +UT_ENV=not-exported + +# gmake style export goes further; affects nothing but the environment +UT_EXP=before-export +export UT_EXP=exported +UT_EXP=not-exported + +all: + @echo make:; ${UT_TEST UT_ENV UT_EXP:L:@v@echo $v=${$v};@} + @echo env:; ${UT_TEST UT_ENV UT_EXP:L:@v@echo $v=$${$v};@} + + + +
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 23:55:27 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: parse.c Log Message: Merge -r1.188 of parse.c from HEAD (committed by sjg): ParseGmakeExport: terminate variable at '=', or setenv(3) will fail on some systems. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 othersrc/usr.bin/dholland-make2/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/parse.c diff -u othersrc/usr.bin/dholland-make2/parse.c:1.14 othersrc/usr.bin/dholland-make2/parse.c:1.15 --- othersrc/usr.bin/dholland-make2/parse.c:1.14 Sat Mar 23 23:50:46 2013 +++ othersrc/usr.bin/dholland-make2/parse.c Sat Mar 23 23:55:27 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.14 2013/03/23 23:50:46 dholland Exp $ */ +/* $NetBSD: parse.c,v 1.15 2013/03/23 23:55:27 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -137,7 +137,7 @@ #include "buf.h" #include "pathnames.h" -MAKE_RCSID("$NetBSD: parse.c,v 1.14 2013/03/23 23:50:46 dholland Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.15 2013/03/23 23:55:27 dholland Exp $"); //#define CLEANUP @@ -2455,6 +2455,7 @@ ParseGmakeExport(char *line) "Variable/Value missing from \"export\""); return; } +*value++ = '\0'; /* terminate variable */ /* * Expand the value before putting it in the environment.
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 23:50:46 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: dir.c job.c job.h make.1 parse.c Log Message: Merge -r1.67 of dir.c, -r1.172 of job.c, -r1.41 of job.h, -r1.211 of make.1, and -r1.187 of parse.c from HEAD (committed by Christos): Add a .STALE special target that gets invoked when dependency files contain stail entries. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/dholland-make2/dir.c cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/dholland-make2/job.c cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/job.h cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/make.1 cvs rdiff -u -r1.13 -r1.14 othersrc/usr.bin/dholland-make2/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/dir.c diff -u othersrc/usr.bin/dholland-make2/dir.c:1.9 othersrc/usr.bin/dholland-make2/dir.c:1.10 --- othersrc/usr.bin/dholland-make2/dir.c:1.9 Sat Mar 23 23:36:18 2013 +++ othersrc/usr.bin/dholland-make2/dir.c Sat Mar 23 23:50:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.9 2013/03/23 23:36:18 dholland Exp $ */ +/* $NetBSD: dir.c,v 1.10 2013/03/23 23:50:46 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -138,8 +138,9 @@ #include "make.h" #include "hash.h" #include "dir.h" +#include "job.h" -__RCSID("$NetBSD: dir.c,v 1.9 2013/03/23 23:36:18 dholland Exp $"); +__RCSID("$NetBSD: dir.c,v 1.10 2013/03/23 23:50:46 dholland Exp $"); /* * A search path consists of a list of Path structures. A Path structure @@ -1427,10 +1428,11 @@ Dir_MTime(GNode *gn, Boolean recheck) * so that we give that to the compiler. */ gn->path = bmake_strdup(fullName); - fprintf(stdout, - "%s: %s, %d: ignoring stale %s for %s, found %s\n", - progname, gn->fname, gn->lineno, - makeDependfile, gn->name, fullName); + if (!Job_RunTarget(".STALE", gn->fname)) + fprintf(stdout, +"%s: %s, %d: ignoring stale %s for %s, " +"found %s\n", progname, gn->fname, gn->lineno, +makeDependfile, gn->name, fullName); } } } Index: othersrc/usr.bin/dholland-make2/job.c diff -u othersrc/usr.bin/dholland-make2/job.c:1.8 othersrc/usr.bin/dholland-make2/job.c:1.9 --- othersrc/usr.bin/dholland-make2/job.c:1.8 Sat Mar 23 23:36:18 2013 +++ othersrc/usr.bin/dholland-make2/job.c Sat Mar 23 23:50:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.8 2013/03/23 23:36:18 dholland Exp $ */ +/* $NetBSD: job.c,v 1.9 2013/03/23 23:50:46 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -149,7 +149,7 @@ #include "trace.h" # define STATIC static -MAKE_RCSID("$NetBSD: job.c,v 1.8 2013/03/23 23:36:18 dholland Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.9 2013/03/23 23:50:46 dholland Exp $"); /* * error handling variables @@ -1230,8 +1230,10 @@ Job_CheckCommands(GNode *gn, void (*abor static const char msg[] = ": don't know how to make"; if (gn->flags & FROM_DEPEND) { - fprintf(stdout, "%s: %s, %d: ignoring stale %s for %s\n", - progname, gn->fname, gn->lineno, makeDependfile, gn->name); + if (!Job_RunTarget(".STALE", gn->fname)) + fprintf(stdout, "%s: %s, %d: ignoring stale %s for %s\n", + progname, gn->fname, gn->lineno, makeDependfile, + gn->name); return TRUE; } @@ -2193,8 +2195,6 @@ Job_SetPrefix(void) void Job_Init(void) { -GNode *begin; /* node for commands to do at the very start */ - /* Allocate space for all the job info */ job_table = bmake_malloc(maxJobs * sizeof *job_table); memset(job_table, 0, maxJobs * sizeof *job_table); @@ -2270,15 +2270,7 @@ Job_Init(void) ADDSIG(SIGCONT, JobContinueSig) #undef ADDSIG -begin = Targ_FindNode(".BEGIN", TARG_NOCREATE); - -if (begin != NULL) { - JobRun(begin); - if (begin->made == ERROR) { - PrintOnError(begin, "\n\nStop."); - exit(1); - } -} +(void)Job_RunTarget(".BEGIN", NULL); postCommands = Targ_FindNode(".END", TARG_CREATE); } @@ -2944,6 +2936,38 @@ Job_TokenWithdraw(void) return TRUE; } +/*- + *--- + * Job_RunTarget -- + * Run the named target if found. If a filename is specified, then + * set that to the sources. + * + * Results: + * None + * + * Side Effects: + * exits if the target fails. + * + *--- + */ +Boolean +Job_RunTarget(const char *target, const char *fname) { +GNode *gn = Targ_FindNode(target, TARG_NOCREATE); + +if (gn == NULL) + return FALSE; + +if (fname) + Var_Set(ALLSRC, fname, gn, 0); + +JobRun(gn); +if (gn->made == ERROR) { + PrintOnError(gn, "\n\nStop."); + exit(1); +} +return TRUE; +} +
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 23:36:19 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: dir.c job.c parse.c Log Message: Merge -r1.66 of dir.c, -r1.171 of job.c, -r1.186 of parse.c from HEAD (committed by Christos): Keep track of the location where a dependency is defined, so we can report about it. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/dholland-make2/dir.c cvs rdiff -u -r1.7 -r1.8 othersrc/usr.bin/dholland-make2/job.c cvs rdiff -u -r1.12 -r1.13 othersrc/usr.bin/dholland-make2/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/dir.c diff -u othersrc/usr.bin/dholland-make2/dir.c:1.8 othersrc/usr.bin/dholland-make2/dir.c:1.9 --- othersrc/usr.bin/dholland-make2/dir.c:1.8 Sat Mar 23 22:40:36 2013 +++ othersrc/usr.bin/dholland-make2/dir.c Sat Mar 23 23:36:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.8 2013/03/23 22:40:36 dholland Exp $ */ +/* $NetBSD: dir.c,v 1.9 2013/03/23 23:36:18 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -139,7 +139,7 @@ #include "hash.h" #include "dir.h" -__RCSID("$NetBSD: dir.c,v 1.8 2013/03/23 22:40:36 dholland Exp $"); +__RCSID("$NetBSD: dir.c,v 1.9 2013/03/23 23:36:18 dholland Exp $"); /* * A search path consists of a list of Path structures. A Path structure @@ -1428,8 +1428,9 @@ Dir_MTime(GNode *gn, Boolean recheck) */ gn->path = bmake_strdup(fullName); fprintf(stdout, -"%s: ignoring stale %s for %s, found %s\n", -progname, makeDependfile, gn->name, fullName); + "%s: %s, %d: ignoring stale %s for %s, found %s\n", + progname, gn->fname, gn->lineno, + makeDependfile, gn->name, fullName); } } } Index: othersrc/usr.bin/dholland-make2/job.c diff -u othersrc/usr.bin/dholland-make2/job.c:1.7 othersrc/usr.bin/dholland-make2/job.c:1.8 --- othersrc/usr.bin/dholland-make2/job.c:1.7 Sat Mar 23 23:29:04 2013 +++ othersrc/usr.bin/dholland-make2/job.c Sat Mar 23 23:36:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.7 2013/03/23 23:29:04 dholland Exp $ */ +/* $NetBSD: job.c,v 1.8 2013/03/23 23:36:18 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -149,7 +149,7 @@ #include "trace.h" # define STATIC static -MAKE_RCSID("$NetBSD: job.c,v 1.7 2013/03/23 23:29:04 dholland Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.8 2013/03/23 23:36:18 dholland Exp $"); /* * error handling variables @@ -1230,8 +1230,8 @@ Job_CheckCommands(GNode *gn, void (*abor static const char msg[] = ": don't know how to make"; if (gn->flags & FROM_DEPEND) { - fprintf(stdout, "%s: ignoring stale %s for %s\n", - progname, makeDependfile, gn->name); + fprintf(stdout, "%s: %s, %d: ignoring stale %s for %s\n", + progname, gn->fname, gn->lineno, makeDependfile, gn->name); return TRUE; } Index: othersrc/usr.bin/dholland-make2/parse.c diff -u othersrc/usr.bin/dholland-make2/parse.c:1.12 othersrc/usr.bin/dholland-make2/parse.c:1.13 --- othersrc/usr.bin/dholland-make2/parse.c:1.12 Sat Mar 23 22:17:51 2013 +++ othersrc/usr.bin/dholland-make2/parse.c Sat Mar 23 23:36:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.12 2013/03/23 22:17:51 dholland Exp $ */ +/* $NetBSD: parse.c,v 1.13 2013/03/23 23:36:18 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -137,7 +137,7 @@ #include "buf.h" #include "pathnames.h" -MAKE_RCSID("$NetBSD: parse.c,v 1.12 2013/03/23 22:17:51 dholland Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.13 2013/03/23 23:36:18 dholland Exp $"); //#define CLEANUP @@ -913,6 +913,8 @@ ParseDoOp(GNode *gn, int op) gn->type |= op & ~OP_OPMASK; cohort = Targ_FindNode(gn->name, TARG_NOHASH); + if (doing_depend) + ParseMark(cohort); /* * Make the cohort invisible as well to avoid duplicating it into * other variables. True, parents of this target won't tend to do @@ -986,6 +988,8 @@ ParseDoSrc(int tOp, const char *src) */ snprintf(wait_src, sizeof wait_src, ".WAIT_%u", ++wait_number); gn = Targ_FindNode(wait_src, TARG_NOHASH); + if (doing_depend) + ParseMark(gn); gn->type = OP_WAIT | OP_PHONY | OP_DEPENDS | OP_NOTMAIN; for (i=0; iorder_succ, gn, NULL); glist_add(&gn->order_pred, predecessor, NULL); @@ -1050,6 +1056,8 @@ ParseDoSrc(int tOp, const char *src) /* Find/create the 'src' node and attach to all targets */ gn = Targ_FindNode(src, TARG_CREATE); + if (doing_depend) + ParseMark(gn); if (tOp) { gn->type |= tOp; } else { @@ -1280,6 +1288,8 @@ ParseDoDependency(char *line) case dotError: case Interrupt: gn = Targ_FindNode(line, TARG_CREATE); + if (doing_depend) + ParseMark(gn); gn->type |= OP_NOTMAIN|OP_SPECIAL; glist_add(&targets, gn, NULL); break; @@ -1358
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 23:29:04 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: job.c main.c portable.h Log Message: Merge -r1.170 of job.c and -r1.209 of main.c from HEAD (committed by Christos): PR/45042: Thomas Cort: HAVE_foo for setrlimit(2) and setpgid(2) To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 othersrc/usr.bin/dholland-make2/job.c \ othersrc/usr.bin/dholland-make2/portable.h cvs rdiff -u -r1.10 -r1.11 othersrc/usr.bin/dholland-make2/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/job.c diff -u othersrc/usr.bin/dholland-make2/job.c:1.6 othersrc/usr.bin/dholland-make2/job.c:1.7 --- othersrc/usr.bin/dholland-make2/job.c:1.6 Sat Mar 23 22:08:21 2013 +++ othersrc/usr.bin/dholland-make2/job.c Sat Mar 23 23:29:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.6 2013/03/23 22:08:21 dholland Exp $ */ +/* $NetBSD: job.c,v 1.7 2013/03/23 23:29:04 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -149,7 +149,7 @@ #include "trace.h" # define STATIC static -MAKE_RCSID("$NetBSD: job.c,v 1.6 2013/03/23 22:08:21 dholland Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.7 2013/03/23 23:29:04 dholland Exp $"); /* * error handling variables @@ -1374,12 +1374,14 @@ JobExec(Job *job, char **argv) * we can kill it and all its descendants in one fell swoop, * by killing its process family, but not commit suicide. */ +#if defined(MAKE_NATIVE) || defined(HAVE_SETPGID) #if defined(SYSV) /* XXX: dsl - I'm sure this should be setpgrp()... */ (void)setsid(); #else (void)setpgid(0, getpid()); #endif +#endif Var_ExportVars(); Index: othersrc/usr.bin/dholland-make2/portable.h diff -u othersrc/usr.bin/dholland-make2/portable.h:1.6 othersrc/usr.bin/dholland-make2/portable.h:1.7 --- othersrc/usr.bin/dholland-make2/portable.h:1.6 Mon Mar 4 05:47:15 2013 +++ othersrc/usr.bin/dholland-make2/portable.h Sat Mar 23 23:29:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: portable.h,v 1.6 2013/03/04 05:47:15 dholland Exp $ */ +/* $NetBSD: portable.h,v 1.7 2013/03/23 23:29:04 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -119,6 +119,8 @@ *MAKE_NATIVE should be set if building native w/o autoconf * * If MAKE_NATIVE isn't set: + *HAVE_SETPGID set if build platform has setpgid() + *HAVE_SETRLIMIT set if build platform has setrlimit() *HAVE_STRERROR set if build platform has strerror() *HAVE_STRFTIME set if build platform has strftime() *HAVE_VSNPRINTF set if build platform has (v)snprintf() Index: othersrc/usr.bin/dholland-make2/main.c diff -u othersrc/usr.bin/dholland-make2/main.c:1.10 othersrc/usr.bin/dholland-make2/main.c:1.11 --- othersrc/usr.bin/dholland-make2/main.c:1.10 Sat Mar 23 19:57:44 2013 +++ othersrc/usr.bin/dholland-make2/main.c Sat Mar 23 23:29:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.10 2013/03/23 19:57:44 dholland Exp $ */ +/* $NetBSD: main.c,v 1.11 2013/03/23 23:29:04 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -128,7 +128,7 @@ MAKE_COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ The Regents of the University of California. All rights reserved."); -MAKE_RCSID("$NetBSD: main.c,v 1.10 2013/03/23 19:57:44 dholland Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.11 2013/03/23 23:29:04 dholland Exp $"); #ifndef DEFMAXLOCAL @@ -777,7 +777,7 @@ main(int argc, char **argv) progname++; else progname = argv[0]; -#ifdef RLIMIT_NOFILE +#if defined(MAKE_NATIVE) || (defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)) /* * get rid of resource limit on file descriptors */
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 22:45:02 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: compat.c nonints.h Log Message: Use real types. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 othersrc/usr.bin/dholland-make2/compat.c cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/dholland-make2/nonints.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/compat.c diff -u othersrc/usr.bin/dholland-make2/compat.c:1.7 othersrc/usr.bin/dholland-make2/compat.c:1.8 --- othersrc/usr.bin/dholland-make2/compat.c:1.7 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/compat.c Sat Mar 23 22:45:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.7 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: compat.c,v 1.8 2013/03/23 22:45:02 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -101,7 +101,7 @@ #include"job.h" #include"pathnames.h" -MAKE_RCSID("$NetBSD: compat.c,v 1.7 2013/03/05 04:27:27 dholland Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.8 2013/03/23 22:45:02 dholland Exp $"); /* * The following array is used to make a fast determination of which @@ -491,10 +491,8 @@ again: *--- */ int -Compat_Make(void *gnp, void *pgnp) +Compat_Make(GNode *gn, GNode *pgn) { -GNode *gn = (GNode *)gnp; -GNode *pgn = (GNode *)pgnp; unsigned i; char *cmd; @@ -668,7 +666,7 @@ cohorts: unsigned i; for (i=0; icohorts); i++) { - Compat_Make(glist_get(&gn->cohorts, i), pgnp); + Compat_Make(glist_get(&gn->cohorts, i), pgn); } } return (0); Index: othersrc/usr.bin/dholland-make2/nonints.h diff -u othersrc/usr.bin/dholland-make2/nonints.h:1.8 othersrc/usr.bin/dholland-make2/nonints.h:1.9 --- othersrc/usr.bin/dholland-make2/nonints.h:1.8 Sat Mar 23 18:35:31 2013 +++ othersrc/usr.bin/dholland-make2/nonints.h Sat Mar 23 22:45:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.8 2013/03/23 18:35:31 dholland Exp $ */ +/* $NetBSD: nonints.h,v 1.9 2013/03/23 22:45:02 dholland Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -87,7 +87,7 @@ int Arch_IsLib(GNode *); /* compat.c */ int CompatRunCommand(char *, unsigned, GNode *); void Compat_Run(GList *); -int Compat_Make(void *, void *); +int Compat_Make(GNode *, GNode *); /* cond.c */ struct If;
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 22:40:37 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: dir.c dir.h graph.h make.c Log Message: Fix inlining again, more forcibly this time. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 othersrc/usr.bin/dholland-make2/dir.c \ othersrc/usr.bin/dholland-make2/graph.h cvs rdiff -u -r1.4 -r1.5 othersrc/usr.bin/dholland-make2/dir.h cvs rdiff -u -r1.14 -r1.15 othersrc/usr.bin/dholland-make2/make.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/dir.c diff -u othersrc/usr.bin/dholland-make2/dir.c:1.7 othersrc/usr.bin/dholland-make2/dir.c:1.8 --- othersrc/usr.bin/dholland-make2/dir.c:1.7 Sat Mar 23 22:03:11 2013 +++ othersrc/usr.bin/dholland-make2/dir.c Sat Mar 23 22:40:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.7 2013/03/23 22:03:11 dholland Exp $ */ +/* $NetBSD: dir.c,v 1.8 2013/03/23 22:40:36 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -133,11 +133,13 @@ #include #include +#define DIRINLINE /* empty */ + #include "make.h" #include "hash.h" #include "dir.h" -__RCSID("$NetBSD: dir.c,v 1.7 2013/03/23 22:03:11 dholland Exp $"); +__RCSID("$NetBSD: dir.c,v 1.8 2013/03/23 22:40:36 dholland Exp $"); /* * A search path consists of a list of Path structures. A Path structure Index: othersrc/usr.bin/dholland-make2/graph.h diff -u othersrc/usr.bin/dholland-make2/graph.h:1.7 othersrc/usr.bin/dholland-make2/graph.h:1.8 --- othersrc/usr.bin/dholland-make2/graph.h:1.7 Sat Mar 23 17:09:40 2013 +++ othersrc/usr.bin/dholland-make2/graph.h Sat Mar 23 22:40:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: graph.h,v 1.7 2013/03/23 17:09:40 dholland Exp $ */ +/* $NetBSD: graph.h,v 1.8 2013/03/23 22:40:36 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -77,13 +77,17 @@ #include "array.h" +#ifndef GRAPHINLINE +#define GRAPHINLINE MAKE_INLINE +#endif + /* * Array of gnodes - the type will be "GList" and the operations will * be glist_create(), glist_add(), etc. */ struct GNode; -DECLARRAY_BYTYPE(glist, struct GNode, MAKE_INLINE); -DEFARRAY_BYTYPE(glist, struct GNode, MAKE_INLINE); +DECLARRAY_BYTYPE(glist, struct GNode, GRAPHINLINE); +DEFARRAY_BYTYPE(glist, struct GNode, GRAPHINLINE); typedef struct glist GList; /* Index: othersrc/usr.bin/dholland-make2/dir.h diff -u othersrc/usr.bin/dholland-make2/dir.h:1.4 othersrc/usr.bin/dholland-make2/dir.h:1.5 --- othersrc/usr.bin/dholland-make2/dir.h:1.4 Sat Mar 23 22:03:11 2013 +++ othersrc/usr.bin/dholland-make2/dir.h Sat Mar 23 22:40:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.h,v 1.4 2013/03/23 22:03:11 dholland Exp $ */ +/* $NetBSD: dir.h,v 1.5 2013/03/23 22:40:36 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -80,6 +80,10 @@ #include "array.h" +#ifndef DIRINLINE +#define DIRINLINE MAKE_INLINE +#endif + typedef struct Path { char *name; /* Name of directory */ int refCount; /* Number of paths with this directory */ @@ -89,11 +93,11 @@ typedef struct Path { } Path; /* struct patharray -> array of Path */ -DECLARRAY_BYTYPE(patharray, struct Path, MAKE_INLINE); -DEFARRAY_BYTYPE(patharray, struct Path, MAKE_INLINE); +DECLARRAY_BYTYPE(patharray, struct Path, DIRINLINE); +DEFARRAY_BYTYPE(patharray, struct Path, DIRINLINE); /* struct patharrayarray -> array of patharray (used in parse.c) */ -DECLARRAY(patharray, MAKE_INLINE); -DEFARRAY(patharray, MAKE_INLINE); +DECLARRAY(patharray, DIRINLINE); +DEFARRAY(patharray, DIRINLINE); void Dir_Init(const char *); void Dir_InitCur(const char *); Index: othersrc/usr.bin/dholland-make2/make.c diff -u othersrc/usr.bin/dholland-make2/make.c:1.14 othersrc/usr.bin/dholland-make2/make.c:1.15 --- othersrc/usr.bin/dholland-make2/make.c:1.14 Sat Mar 23 22:17:51 2013 +++ othersrc/usr.bin/dholland-make2/make.c Sat Mar 23 22:40:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.14 2013/03/23 22:17:51 dholland Exp $ */ +/* $NetBSD: make.c,v 1.15 2013/03/23 22:40:36 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -106,12 +106,14 @@ * Make_ExpandUse Expand .USE nodes */ +#define GRAPHINLINE /* empty */ + #include"make.h" #include"hash.h" #include"dir.h" #include"job.h" -MAKE_RCSID("$NetBSD: make.c,v 1.14 2013/03/23 22:17:51 dholland Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.15 2013/03/23 22:40:36 dholland Exp $"); typedef struct { GList nodes;
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 22:23:04 UTC 2013 Removed Files: othersrc/usr.bin/dholland-make2: lst.h othersrc/usr.bin/dholland-make2/lst.lib: Makefile lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c lstFind.c lstFindFrom.c lstFirst.c lstForEach.c lstForEachFrom.c lstInit.c lstInsert.c lstInt.h lstIsAtEnd.c lstIsEmpty.c lstLast.c lstMember.c lstNext.c lstOpen.c lstPrev.c lstRemove.c lstReplace.c lstSucc.c Log Message: Buhbye. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r0 othersrc/usr.bin/dholland-make2/lst.h cvs rdiff -u -r1.1.1.1 -r0 othersrc/usr.bin/dholland-make2/lst.lib/Makefile cvs rdiff -u -r1.2 -r0 othersrc/usr.bin/dholland-make2/lst.lib/lstAppend.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstAtEnd.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstAtFront.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstClose.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstConcat.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstDatum.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstDeQueue.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstDestroy.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstDupl.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstEnQueue.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstFind.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstFindFrom.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstFirst.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstForEach.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstForEachFrom.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstInit.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstInsert.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstInt.h \ othersrc/usr.bin/dholland-make2/lst.lib/lstIsAtEnd.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstIsEmpty.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstLast.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstMember.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstNext.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstOpen.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstPrev.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstRemove.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstReplace.c \ othersrc/usr.bin/dholland-make2/lst.lib/lstSucc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 22:22:51 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: make.h Log Message: Drop the list library's header. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 othersrc/usr.bin/dholland-make2/make.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/make.h diff -u othersrc/usr.bin/dholland-make2/make.h:1.10 othersrc/usr.bin/dholland-make2/make.h:1.11 --- othersrc/usr.bin/dholland-make2/make.h:1.10 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/make.h Sat Mar 23 22:22:51 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.10 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: make.h,v 1.11 2013/03/23 22:22:51 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -92,7 +92,6 @@ #include "portable.h" #include "sprite.h" -#include "lst.h" #include "hash.h" #include "config.h" #include "buf.h"
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 22:21:13 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: Makefile Makefile.boot Log Message: Switch off the list library. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/Makefile cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/Makefile.boot Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/Makefile diff -u othersrc/usr.bin/dholland-make2/Makefile:1.3 othersrc/usr.bin/dholland-make2/Makefile:1.4 --- othersrc/usr.bin/dholland-make2/Makefile:1.3 Mon Mar 4 05:47:15 2013 +++ othersrc/usr.bin/dholland-make2/Makefile Sat Mar 23 22:21:13 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2013/03/04 05:47:15 dholland Exp $ +# $NetBSD: Makefile,v 1.4 2013/03/23 22:21:13 dholland Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 PROG= make @@ -6,12 +6,6 @@ SRCS= arch.c buf.c compat.c cond.c dir.c make.c parse.c str.c suff.c targ.c trace.c var.c util.c SRCS+= array.c strlist.c SRCS+= portable.c -SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \ - lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \ - lstFind.c lstFindFrom.c lstFirst.c lstForEach.c lstForEachFrom.c \ - lstInit.c lstInsert.c lstIsAtEnd.c lstIsEmpty.c lstLast.c \ - lstMember.c lstNext.c lstOpen.c lstRemove.c lstReplace.c lstSucc.c -SRCS += lstPrev.c # let people experiment for a bit USE_META ?= no @@ -24,7 +18,6 @@ COPTS.meta.c += -DHAVE_FILEMON_H -I${FIL .endif .endif -.PATH: ${.CURDIR}/lst.lib .if make(install) SUBDIR= PSD.doc .endif Index: othersrc/usr.bin/dholland-make2/Makefile.boot diff -u othersrc/usr.bin/dholland-make2/Makefile.boot:1.1.1.1 othersrc/usr.bin/dholland-make2/Makefile.boot:1.2 --- othersrc/usr.bin/dholland-make2/Makefile.boot:1.1.1.1 Mon Feb 25 01:32:48 2013 +++ othersrc/usr.bin/dholland-make2/Makefile.boot Sat Mar 23 22:21:13 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.boot,v 1.1.1.1 2013/02/25 01:32:48 dholland Exp $ +# $NetBSD: Makefile.boot,v 1.2 2013/03/23 22:21:13 dholland Exp $ # # a very simple makefile... # @@ -24,22 +24,12 @@ LIBS= OBJ=arch.o buf.o compat.o cond.o dir.o for.o hash.o job.o main.o make.o \ make_malloc.o parse.o str.o strlist.o suff.o targ.o trace.o var.o util.o -LIBOBJ= lst.lib/lstAppend.o lst.lib/lstAtEnd.o lst.lib/lstAtFront.o \ - lst.lib/lstClose.o lst.lib/lstConcat.o lst.lib/lstDatum.o \ - lst.lib/lstDeQueue.o lst.lib/lstDestroy.o lst.lib/lstDupl.o \ - lst.lib/lstEnQueue.o lst.lib/lstFind.o lst.lib/lstFindFrom.o \ - lst.lib/lstFirst.o lst.lib/lstForEach.o lst.lib/lstForEachFrom.o \ - lst.lib/lstInit.o lst.lib/lstInsert.o lst.lib/lstIsAtEnd.o \ - lst.lib/lstIsEmpty.o lst.lib/lstLast.o lst.lib/lstMember.o \ - lst.lib/lstNext.o lst.lib/lstOpen.o lst.lib/lstRemove.o \ - lst.lib/lstReplace.o lst.lib/lstSucc.o lst.lib/lstPrev.o - -bmake: ${OBJ} ${LIBOBJ} +bmake: ${OBJ} # @echo 'make of make and make.0 started.' - ${CC} ${CFLAGS} ${OBJ} ${LIBOBJ} -o bmake ${LIBS} + ${CC} ${CFLAGS} ${OBJ} -o bmake ${LIBS} @ls -l $@ # nroff -h -man make.1 > make.0 # @echo 'make of make and make.0 completed.' clean: - rm -f ${OBJ} ${LIBOBJ} ${PORTOBJ} bmake + rm -f ${OBJ} ${PORTOBJ} bmake
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 22:17:51 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: make.c parse.c Log Message: Remove remaining references to the linked list library. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 othersrc/usr.bin/dholland-make2/make.c cvs rdiff -u -r1.11 -r1.12 othersrc/usr.bin/dholland-make2/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/make.c diff -u othersrc/usr.bin/dholland-make2/make.c:1.13 othersrc/usr.bin/dholland-make2/make.c:1.14 --- othersrc/usr.bin/dholland-make2/make.c:1.13 Sat Mar 23 21:33:28 2013 +++ othersrc/usr.bin/dholland-make2/make.c Sat Mar 23 22:17:51 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.13 2013/03/23 21:33:28 dholland Exp $ */ +/* $NetBSD: make.c,v 1.14 2013/03/23 22:17:51 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include"dir.h" #include"job.h" -MAKE_RCSID("$NetBSD: make.c,v 1.13 2013/03/23 21:33:28 dholland Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.14 2013/03/23 22:17:51 dholland Exp $"); typedef struct { GList nodes; @@ -284,7 +284,7 @@ make_abort(GNode *gn, int line) *--- * Make_TimeStamp -- * Set the cmgn field of a parent node based on the mtime stamp in its - * child. Called from MakeOODate via Lst_ForEach. + * child. * * Input: * pgn the current parent @@ -635,15 +635,15 @@ Make_HandleUse(GNode *cgn, GNode *pgn) /*- *--- * MakeHandleUse -- - * Callback function for Lst_ForEach, used by Make_Run on the downward + * Used by Make_Run (via Make_ExpandUse) on the downward * pass to handle .USE nodes. Should be called before the children * are enqueued to be looked at by MakeAddChild. * This function calls Make_HandleUse to copy the .USE node's commands, * type flags and children to the parent node. * * Input: - * cgnp the child we've just examined - * pgnp the current parent + * cgn the child we've just examined + * pgn the current parent * * Results: * None @@ -726,7 +726,7 @@ Make_Recheck(GNode *gn) * To force things that depend on FRC to be made, so we have to * check for gn->children being empty as well... */ -if (!Lst_IsEmpty(gn->commands) || Lst_IsEmpty(gn->children)) { +if (stringarray_num(&gn->commands) > 0 || glist_num(gn->children) == 0) { gn->mtime = now; } #else @@ -961,7 +961,7 @@ Make_Update(GNode *cgn) * Set the .PREFIX and .IMPSRC variables for all the implied parents * of this node. */ -/*if (Lst_Open(cgn->iParents) == SUCCESS)*/ { +{ char *cpref = Var_Value(PREFIX, cgn, &p1); unsigned i; @@ -975,7 +975,6 @@ Make_Update(GNode *cgn) } if (p1) free(p1); - /*Lst_Close(cgn->iParents);*/ } } @@ -983,7 +982,7 @@ Make_Update(GNode *cgn) *--- * MakeAddAllSrc -- * Add a child's name to the ALLSRC and OODATE variables of the given - * node. Called from Make_DoAllVar via Lst_ForEach. A child is added only + * node. Called from Make_DoAllVar. A child is added only * if it has not been given the .EXEC, .USE or .INVISIBLE attributes. * .EXEC and .USE children are very rarely going to be files, so... * If the child is a .JOIN node, its ALLSRC is propagated to the parent. @@ -1322,7 +1321,7 @@ MakeStartJobs(void) * MakePrintStatus -- * Print the status of a top-level node, viz. it being up-to-date * already or not created due to an error in a lower level. - * Callback function for Make_Run via Lst_ForEach. + * Callback function for Make_Run. * * Input: * gnp Node to examine Index: othersrc/usr.bin/dholland-make2/parse.c diff -u othersrc/usr.bin/dholland-make2/parse.c:1.11 othersrc/usr.bin/dholland-make2/parse.c:1.12 --- othersrc/usr.bin/dholland-make2/parse.c:1.11 Sat Mar 23 19:15:40 2013 +++ othersrc/usr.bin/dholland-make2/parse.c Sat Mar 23 22:17:51 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.11 2013/03/23 19:15:40 dholland Exp $ */ +/* $NetBSD: parse.c,v 1.12 2013/03/23 22:17:51 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -137,7 +137,7 @@ #include "buf.h" #include "pathnames.h" -MAKE_RCSID("$NetBSD: parse.c,v 1.11 2013/03/23 19:15:40 dholland Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.12 2013/03/23 22:17:51 dholland Exp $"); //#define CLEANUP @@ -826,8 +826,8 @@ ParseMessage(char *line) /*- *- * ParseLinkSrc -- - * Link the parent node to its new child. Used in a Lst_ForEach by - * ParseDoDependency. If the specType isn't 'Not', the parent + * Link the parent node to its new child. Used by + * ParseDoSrc. If the specType is
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 22:08:21 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: job.c Log Message: Use real types. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 othersrc/usr.bin/dholland-make2/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/job.c diff -u othersrc/usr.bin/dholland-make2/job.c:1.5 othersrc/usr.bin/dholland-make2/job.c:1.6 --- othersrc/usr.bin/dholland-make2/job.c:1.5 Sat Mar 23 21:35:44 2013 +++ othersrc/usr.bin/dholland-make2/job.c Sat Mar 23 22:08:21 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.5 2013/03/23 21:35:44 dholland Exp $ */ +/* $NetBSD: job.c,v 1.6 2013/03/23 22:08:21 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -149,7 +149,7 @@ #include "trace.h" # define STATIC static -MAKE_RCSID("$NetBSD: job.c,v 1.5 2013/03/23 21:35:44 dholland Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.6 2013/03/23 22:08:21 dholland Exp $"); /* * error handling variables @@ -337,7 +337,7 @@ static sigset_t caught_signals; /* Set o static void JobChildSig(int); static void JobContinueSig(int); static Job *JobFindPid(int, int, Boolean); -static int JobPrintCommand(void *, void *); +static int JobPrintCommand(char *, Job *); static void JobClose(Job *); static void JobExec(Job *, char **); static void JobMakeArgv(Job *, char **); @@ -637,7 +637,7 @@ JobFindPid(int pid, int status, Boolean * made and return non-zero to signal that the end of the commands * was reached. These commands are later attached to the postCommands * node and executed by Job_End when all things are done. - * This function is called from JobStart via Lst_ForEach. + * This function is called from JobStart. * * Input: * cmdp command string to print @@ -655,7 +655,7 @@ JobFindPid(int pid, int status, Boolean *--- */ static int -JobPrintCommand(void *cmdp, void *jobp) +JobPrintCommand(char *cmd, Job *job) { Boolean noSpecials; /* true if we shouldn't worry about * inserting special commands into @@ -669,9 +669,10 @@ JobPrintCommand(void *cmdp, void *jobp) * command */ char *cmdStart; /* Start of expanded command */ char *escCmd = NULL;/* Command with quotes/backticks escaped */ -char *cmd = (char *)cmdp; -Job *job = (Job *)jobp; int i, j; +char *origcmd; + +origcmd = cmd; noSpecials = NoExecute(job->node); @@ -716,8 +717,8 @@ JobPrintCommand(void *cmdp, void *jobp) */ unsigned cmdindex; - cmdindex = stringarray_find(&job->node->commands, cmdp); - CompatRunCommand(cmdp, cmdindex, job->node); + cmdindex = stringarray_find(&job->node->commands, origcmd); + CompatRunCommand(origcmd, cmdindex, job->node); return 0; } break;
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 22:03:11 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: dir.c dir.h Log Message: G/C Dir_CopyDir(), which is no longer used. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 othersrc/usr.bin/dholland-make2/dir.c cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/dir.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/dir.c diff -u othersrc/usr.bin/dholland-make2/dir.c:1.6 othersrc/usr.bin/dholland-make2/dir.c:1.7 --- othersrc/usr.bin/dholland-make2/dir.c:1.6 Sat Mar 23 19:29:30 2013 +++ othersrc/usr.bin/dholland-make2/dir.c Sat Mar 23 22:03:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.6 2013/03/23 19:29:30 dholland Exp $ */ +/* $NetBSD: dir.c,v 1.7 2013/03/23 22:03:11 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -137,7 +137,7 @@ #include "hash.h" #include "dir.h" -__RCSID("$NetBSD: dir.c,v 1.6 2013/03/23 19:29:30 dholland Exp $"); +__RCSID("$NetBSD: dir.c,v 1.7 2013/03/23 22:03:11 dholland Exp $"); /* * A search path consists of a list of Path structures. A Path structure @@ -1563,27 +1563,6 @@ Dir_AddDir(struct patharray *path, const /*- *--- - * Dir_CopyDir -- - * Callback function for duplicating a search path via Lst_Duplicate. - * Ups the reference count for the directory. - * - * Results: - * Returns the Path it was given. - * - * Side Effects: - * The refCount of the path is incremented. - * - *--- - */ -Path * -Dir_CopyDir(Path *p) -{ -p->refCount += 1; -return (p); -} - -/*- - *--- * Dir_MakeFlags -- * Make a string by taking all the directories in the given search * path and preceding them by the given flag. Used by the suffix Index: othersrc/usr.bin/dholland-make2/dir.h diff -u othersrc/usr.bin/dholland-make2/dir.h:1.3 othersrc/usr.bin/dholland-make2/dir.h:1.4 --- othersrc/usr.bin/dholland-make2/dir.h:1.3 Tue Mar 5 03:32:08 2013 +++ othersrc/usr.bin/dholland-make2/dir.h Sat Mar 23 22:03:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.h,v 1.3 2013/03/05 03:32:08 dholland Exp $ */ +/* $NetBSD: dir.h,v 1.4 2013/03/23 22:03:11 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -112,6 +112,5 @@ void Dir_Concat(struct patharray *, cons void Dir_PrintDirectories(void); void Dir_PrintPath(const struct patharray *); void Dir_Destroy(Path *); -Path *Dir_CopyDir(Path *); #endif /* _DIR */
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 22:00:51 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: meta.c Log Message: Rip the linked lists out of here and make it build again. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/meta.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/meta.c diff -u othersrc/usr.bin/dholland-make2/meta.c:1.2 othersrc/usr.bin/dholland-make2/meta.c:1.3 --- othersrc/usr.bin/dholland-make2/meta.c:1.2 Mon Feb 25 03:39:28 2013 +++ othersrc/usr.bin/dholland-make2/meta.c Sat Mar 23 22:00:51 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.2 2013/02/25 03:39:28 dholland Exp $ */ +/* $NetBSD: meta.c,v 1.3 2013/03/23 22:00:51 dholland Exp $ */ /* * Implement 'meta' mode. @@ -54,10 +54,10 @@ # define USE_FILEMON #endif -MAKE_RCSID("$NetBSD: meta.c,v 1.2 2013/02/25 03:39:28 dholland Exp $"); +MAKE_RCSID("$NetBSD: meta.c,v 1.3 2013/03/23 22:00:51 dholland Exp $"); static BuildMon Mybm; /* for compat */ -static Lst metaBailiwick; /* our scope of control */ +static struct stringarray metaBailiwick; /* our scope of control */ Boolean useMeta = FALSE; static Boolean useFilemon = FALSE; @@ -307,12 +307,10 @@ meta_name(struct GNode *gn, char *mname, * Bypassed if target is flagged .MAKE */ static int -is_submake(void *cmdp, void *gnp) +is_submake(const char *cmd, GNode *gn) { static char *p_make = NULL; static int p_len; -char *cmd = cmdp; -GNode *gn = gnp; char *mp = NULL; char *cp; char *cp2; @@ -360,10 +358,8 @@ typedef struct meta_file_s { } meta_file_t; static int -printCMD(void *cmdp, void *mfpp) +printCMD(const char *cmd, meta_file_t *mfp) { -meta_file_t *mfp = mfpp; -char *cmd = cmdp; char *cp = NULL; if (strchr(cmd, '$')) { @@ -400,8 +396,9 @@ meta_create(BuildMon *pbm, GNode *gn) char *fname; const char *cp; char *p[4];/* >= possible uses */ -int i; +int ii; struct stat fs; +unsigned j, num; /* This may be a phony node which we don't want meta data for... */ @@ -417,10 +414,10 @@ meta_create(BuildMon *pbm, GNode *gn) mf.fp = NULL; -i = 0; +ii = 0; -dname = Var_Value(".OBJDIR", gn, &p[i++]); -tname = Var_Value(TARGET, gn, &p[i++]); +dname = Var_Value(".OBJDIR", gn, &p[ii++]); +tname = Var_Value(TARGET, gn, &p[ii++]); /* The object directory may not exist. Check it.. */ if (stat(dname, &fs) != 0) { @@ -430,7 +427,7 @@ meta_create(BuildMon *pbm, GNode *gn) goto out; } /* Check if there are no commands to execute. */ -if (Lst_IsEmpty(gn->commands)) { +if (stringarray_num(&gn->commands) == 0) { if (DEBUG(META)) fprintf(debug_file, "Skipping meta for %s: no commands\n", gn->name); @@ -450,11 +447,14 @@ meta_create(BuildMon *pbm, GNode *gn) } if (!(gn->type & OP_META)) { /* We do not generate .meta files for sub-makes */ - if (Lst_ForEach(gn->commands, is_submake, gn)) { - if (DEBUG(META)) - fprintf(debug_file, "Skipping meta for %s: .MAKE\n", + num = stringarray_num(&gn->commands); + for (j=0; jcommands, j), gn)) { + if (DEBUG(META)) + fprintf(debug_file, "Skipping meta for %s: .MAKE\n", gn->name); - goto out; + goto out; + } } } @@ -498,7 +498,10 @@ meta_create(BuildMon *pbm, GNode *gn) mf.gn = gn; -Lst_ForEach(gn->commands, printCMD, &mf); +num = stringarray_num(&gn->commands); +for (j=0; jcommands, j), &mf); +} fprintf(mf.fp, "CWD %s\n", getcwd(buf, sizeof(buf))); fprintf(mf.fp, "TARGET %s\n", tname); @@ -519,9 +522,9 @@ meta_create(BuildMon *pbm, GNode *gn) gn->type |= OP_SILENT; } out: -for (i--; i >= 0; i--) { - if (p[i]) - free(p[i]); +for (ii--; ii >= 0; ii--) { + if (p[ii]) + free(p[ii]); } return (mf.fp); @@ -588,10 +591,10 @@ meta_init(const char *make_mode) /* * We consider ourselves master of all within ${.MAKE.META.BAILIWICK} */ -metaBailiwick = Lst_Init(FALSE); +stringarray_init(&metaBailiwick); cp = Var_Subst(NULL, "${.MAKE.META.BAILIWICK:O:u:tA}", VAR_GLOBAL, 0); if (cp) { - str2Lst_Append(metaBailiwick, cp, NULL); + str2Lst_Append(&metaBailiwick, cp, NULL); } } @@ -793,15 +796,28 @@ fgetLine(char **bufp, size_t *szp, int o } static int -prefix_match(void *p, void *q) +prefix_match(const char *prefix, const char *path) { -const char *prefix = p; -const char *path = q; size_t n = strlen(prefix); return (0 == strncmp(path, prefix, n)); } +static Boolean +path_in_bailiwick(const char *path) +{ +unsigned i, num; + +num = stringarray_num(&metaBailiwick); +for (i=0; icommands); + num = stringarray_num(&gn->commands); + pos = 0; + wh
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 21:35:44 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: job.c Log Message: Update some #if 0'd code to still compile. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 othersrc/usr.bin/dholland-make2/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/job.c diff -u othersrc/usr.bin/dholland-make2/job.c:1.4 othersrc/usr.bin/dholland-make2/job.c:1.5 --- othersrc/usr.bin/dholland-make2/job.c:1.4 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/job.c Sat Mar 23 21:35:44 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.4 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: job.c,v 1.5 2013/03/23 21:35:44 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -149,7 +149,7 @@ #include "trace.h" # define STATIC static -MAKE_RCSID("$NetBSD: job.c,v 1.4 2013/03/05 04:27:27 dholland Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.5 2013/03/23 21:35:44 dholland Exp $"); /* * error handling variables @@ -1920,10 +1920,13 @@ JobRun(GNode *targ) * and .INTERRUPT job in the parallel job module. This has * the nice side effect that it avoids a lot of other problems. */ -Lst lst = Lst_Init(FALSE); -Lst_AtEnd(lst, targ); -(void)Make_Run(lst); -Lst_Destroy(lst, NULL); +GList list; + +glist_init(&list); +glist_add(&list, targ, NULL); +(void)Make_Run(&list); +glist_setsize(&list, 0); +glist_cleanup(&list); JobStart(targ, JOB_SPECIAL); while (jobTokensRunning) { Job_CatchOutput();
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 21:33:28 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: make.c Log Message: Improve the toBeMade queue code so it doesn't do bulk array shifts every time you remove something from the queue head. If this turns out not to be good enough it can be tuned and/or made into a circular queue later. (Also, in the long run, the non-tail insertions may go away; they seem to chiefly be associated with the .ORDER implementation and may not be needed after the primary graph structure gets some strengthening.) To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 othersrc/usr.bin/dholland-make2/make.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/make.c diff -u othersrc/usr.bin/dholland-make2/make.c:1.12 othersrc/usr.bin/dholland-make2/make.c:1.13 --- othersrc/usr.bin/dholland-make2/make.c:1.12 Sat Mar 23 21:29:11 2013 +++ othersrc/usr.bin/dholland-make2/make.c Sat Mar 23 21:33:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.12 2013/03/23 21:29:11 dholland Exp $ */ +/* $NetBSD: make.c,v 1.13 2013/03/23 21:33:28 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,11 +111,12 @@ #include"dir.h" #include"job.h" -MAKE_RCSID("$NetBSD: make.c,v 1.12 2013/03/23 21:29:11 dholland Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.13 2013/03/23 21:33:28 dholland Exp $"); typedef struct { GList nodes; GList insertions; + unsigned firstnode; Boolean inserting; } MakeQ; @@ -148,13 +149,15 @@ MakeQ_Init(MakeQ *q) { glist_init(&q->nodes); glist_init(&q->insertions); + q->firstnode = 0; q->inserting = FALSE; } static Boolean MakeQ_IsEmpty(MakeQ *q) { - return glist_num(&q->nodes) == 0 && glist_num(&q->insertions) == 0; + assert(q->inserting == FALSE); + return glist_num(&q->nodes) == 0; } static void @@ -181,7 +184,8 @@ MakeQ_BeginInsertions(MakeQ *q) static void MakeQ_EndInsertions(MakeQ *q) { - unsigned i, num, ninsertions; + unsigned i, num, ninsertions, growth; + GNode *gn; assert(q->inserting); q->inserting = FALSE; @@ -191,13 +195,25 @@ MakeQ_EndInsertions(MakeQ *q) num = glist_num(&q->nodes); ninsertions = glist_num(&q->insertions); - glist_setsize(&q->nodes, ninsertions + num); - /* must run this loop backwards */ - for (i=num; i-- > 0; ) { - glist_set(&q->nodes, ninsertions + i, glist_get(&q->nodes, i)); + if (ninsertions <= q->firstnode) { + /* do not need to move the existing elements */ + q->firstnode -= ninsertions; + } else { + /* need to shift the existing elements up */ + + growth = ninsertions - q->firstnode; + glist_setsize(&q->nodes, growth + num); + + /* ranges may overlap, so run this loop backwards */ + for (i=num; i-- > 0; ) { + gn = glist_get(&q->nodes, q->firstnode + i); + glist_set(&q->nodes, ninsertions + i, gn); + } + q->firstnode = 0; } for (i=0; inodes, i, glist_get(&q->insertions, i)); + gn = glist_get(&q->insertions, i); + glist_set(&q->nodes, q->firstnode + i, gn); } glist_setsize(&q->insertions, 0); } @@ -205,15 +221,26 @@ MakeQ_EndInsertions(MakeQ *q) static GNode * MakeQ_PopHead(MakeQ *q) { + unsigned num; GNode *ret; assert(q->inserting == FALSE); - if (glist_num(&q->nodes) == 0) { + num = glist_num(&q->nodes); + assert(q->firstnode <= num); + + if (q->firstnode == num) { + assert(num == 0); return NULL; } - ret = glist_get(&q->nodes, 0); - glist_remove(&q->nodes, 0); + + ret = glist_get(&q->nodes, q->firstnode); + q->firstnode++; + if (q->firstnode == num) { + /* we've taken everything out, slide back to the beginning */ + glist_setsize(&q->nodes, 0); + q->firstnode = 0; + } return ret; }
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 21:29:11 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: make.c Log Message: Improve the toBeMade logic: collect the non-tail insertions in a separate array and stuff them into the main queue all at once. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 othersrc/usr.bin/dholland-make2/make.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/make.c diff -u othersrc/usr.bin/dholland-make2/make.c:1.11 othersrc/usr.bin/dholland-make2/make.c:1.12 --- othersrc/usr.bin/dholland-make2/make.c:1.11 Sat Mar 23 21:28:04 2013 +++ othersrc/usr.bin/dholland-make2/make.c Sat Mar 23 21:29:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.11 2013/03/23 21:28:04 dholland Exp $ */ +/* $NetBSD: make.c,v 1.12 2013/03/23 21:29:11 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,12 +111,12 @@ #include"dir.h" #include"job.h" -MAKE_RCSID("$NetBSD: make.c,v 1.11 2013/03/23 21:28:04 dholland Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.12 2013/03/23 21:29:11 dholland Exp $"); typedef struct { - GList data; - Boolean hasmark; - unsigned markpos; + GList nodes; + GList insertions; + Boolean inserting; } MakeQ; static unsigned int checked = 1;/* Sequence # to detect recursion */ @@ -146,54 +146,60 @@ static void MakeBuildParent(GNode *, Boo static void MakeQ_Init(MakeQ *q) { - glist_init(&q->data); - q->hasmark = FALSE; - q->markpos = 0; + glist_init(&q->nodes); + glist_init(&q->insertions); + q->inserting = FALSE; } static Boolean MakeQ_IsEmpty(MakeQ *q) { - return glist_num(&q->data) == 0; + return glist_num(&q->nodes) == 0 && glist_num(&q->insertions) == 0; } static void MakeQ_AddTail(MakeQ *q, GNode *gn) { - if (q->hasmark && q->markpos >= glist_num(&q->data)) { - q->markpos++; - } - glist_add(&q->data, gn, NULL); + glist_add(&q->nodes, gn, NULL); } static void -MakeQ_AddBeforeMark(MakeQ *q, GNode *gn) +MakeQ_Insert(MakeQ *q, GNode *gn) { - assert(q->hasmark); - if (q->markpos >= glist_num(&q->data)) { - glist_add(&q->data, gn, NULL); - q->markpos++; - } else { - glist_insert(&q->data, q->markpos); - glist_set(&q->data, q->markpos, gn); - q->markpos++; - } + assert(q->inserting); + glist_add(&q->insertions, gn, NULL); } static void -MakeQ_SetMark(MakeQ *q) +MakeQ_BeginInsertions(MakeQ *q) { - assert(!q->hasmark); - q->hasmark = TRUE; - q->markpos = 0; + assert(!q->inserting); + assert(glist_num(&q->insertions) == 0); + q->inserting = TRUE; } static void -MakeQ_ClearMark(MakeQ *q) +MakeQ_EndInsertions(MakeQ *q) { - assert(q->hasmark); - q->hasmark = FALSE; - q->markpos = 0; + unsigned i, num, ninsertions; + + assert(q->inserting); + q->inserting = FALSE; + + /* prepend insertions[] to nodes[] */ + + num = glist_num(&q->nodes); + ninsertions = glist_num(&q->insertions); + + glist_setsize(&q->nodes, ninsertions + num); + /* must run this loop backwards */ + for (i=num; i-- > 0; ) { + glist_set(&q->nodes, ninsertions + i, glist_get(&q->nodes, i)); + } + for (i=0; inodes, i, glist_get(&q->insertions, i)); + } + glist_setsize(&q->insertions, 0); } static GNode * @@ -201,11 +207,13 @@ MakeQ_PopHead(MakeQ *q) { GNode *ret; - if (glist_num(&q->data) == 0) { + assert(q->inserting == FALSE); + + if (glist_num(&q->nodes) == 0) { return NULL; } - ret = glist_get(&q->data, 0); - glist_remove(&q->data, 0); + ret = glist_get(&q->nodes, 0); + glist_remove(&q->nodes, 0); return ret; } @@ -214,9 +222,11 @@ MakeQ_ForEach(MakeQ *q, int (*func)(void { unsigned i, num; - num = glist_num(&q->data); + assert(q->inserting == FALSE); + + num = glist_num(&q->nodes); for (i=0; idata, i), ptr); + func(glist_get(&q->nodes, i), ptr); } } @@ -816,9 +826,9 @@ Make_Update(GNode *cgn) for (i=0; iorder_succ); i++) { succ = glist_get(¢urion->order_succ, i); - MakeQ_SetMark(&toBeMade); + MakeQ_BeginInsertions(&toBeMade); MakeBuildParent(succ, TRUE); - MakeQ_ClearMark(&toBeMade); + MakeQ_EndInsertions(&toBeMade); } } @@ -1135,7 +1145,7 @@ DoMakeCheckOrder(GList *order_pred) } static int -MakeBuildChild(GNode *cn, Boolean usemark) +MakeBuildChild(GNode *cn, Boolean doinsert) { if (DEBUG(MAKE)) fprintf(debug_file, "MakeBuildChild: inspect %s%s, made %d, type %x\n", @@ -1155,16 +1165,16 @@ MakeBuildChild(GNode *cn, Boolean usemar cn->name, cn->cohort_num); cn->made = REQUESTED; -if (usemark == FALSE) - MakeQ_AddTail(&toBeMade, cn); +if (doinsert) + MakeQ_Insert(&toBeMade, cn); else - MakeQ_AddBeforeMark(&toBeMade, cn); + MakeQ_AddTail(&toBeMade, cn); if (cn->unmade_cohorts != 0) { unsigned i; for (i=0; icohorts); i++) { - if (MakeBuildChild(glist_get(&cn->cohorts, i), usemark)) { + if (MakeBuildChild(glist_get(&cn->cohorts, i), doinsert)) { brea
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 21:28:04 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: make.c Log Message: Switch the toBeMade logic to an array instead of a linked list. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 othersrc/usr.bin/dholland-make2/make.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/make.c diff -u othersrc/usr.bin/dholland-make2/make.c:1.10 othersrc/usr.bin/dholland-make2/make.c:1.11 --- othersrc/usr.bin/dholland-make2/make.c:1.10 Sat Mar 23 21:27:23 2013 +++ othersrc/usr.bin/dholland-make2/make.c Sat Mar 23 21:28:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.10 2013/03/23 21:27:23 dholland Exp $ */ +/* $NetBSD: make.c,v 1.11 2013/03/23 21:28:04 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,12 +111,12 @@ #include"dir.h" #include"job.h" -MAKE_RCSID("$NetBSD: make.c,v 1.10 2013/03/23 21:27:23 dholland Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.11 2013/03/23 21:28:04 dholland Exp $"); typedef struct { - Lst data; + GList data; Boolean hasmark; - LstNode mark; + unsigned markpos; } MakeQ; static unsigned int checked = 1;/* Sequence # to detect recursion */ @@ -146,31 +146,37 @@ static void MakeBuildParent(GNode *, Boo static void MakeQ_Init(MakeQ *q) { -q->data = Lst_Init(FALSE); -q->hasmark = FALSE; -q->mark = NULL; + glist_init(&q->data); + q->hasmark = FALSE; + q->markpos = 0; } static Boolean MakeQ_IsEmpty(MakeQ *q) { - return Lst_IsEmpty(q->data); + return glist_num(&q->data) == 0; } static void MakeQ_AddTail(MakeQ *q, GNode *gn) { - (void)Lst_EnQueue(q->data, gn); + if (q->hasmark && q->markpos >= glist_num(&q->data)) { + q->markpos++; + } + glist_add(&q->data, gn, NULL); } static void MakeQ_AddBeforeMark(MakeQ *q, GNode *gn) { assert(q->hasmark); - if (q->mark == NULL) { - Lst_AtEnd(q->data, gn); + if (q->markpos >= glist_num(&q->data)) { + glist_add(&q->data, gn, NULL); + q->markpos++; } else { - Lst_InsertBefore(q->data, q->mark, gn); + glist_insert(&q->data, q->markpos); + glist_set(&q->data, q->markpos, gn); + q->markpos++; } } @@ -179,11 +185,7 @@ MakeQ_SetMark(MakeQ *q) { assert(!q->hasmark); q->hasmark = TRUE; - if (Lst_IsEmpty(q->data)) { - q->mark = NULL; - } else { - q->mark = Lst_First(q->data); - } + q->markpos = 0; } static void @@ -191,19 +193,31 @@ MakeQ_ClearMark(MakeQ *q) { assert(q->hasmark); q->hasmark = FALSE; - q->mark = NULL; + q->markpos = 0; } static GNode * MakeQ_PopHead(MakeQ *q) { - return (GNode *)Lst_DeQueue(q->data); + GNode *ret; + + if (glist_num(&q->data) == 0) { + return NULL; + } + ret = glist_get(&q->data, 0); + glist_remove(&q->data, 0); + return ret; } static void MakeQ_ForEach(MakeQ *q, int (*func)(void *, void *), void *ptr) { - Lst_ForEach(q->data, func, ptr); + unsigned i, num; + + num = glist_num(&q->data); + for (i=0; idata, i), ptr); + } }
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 21:27:23 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: make.c Log Message: Simplify the toBeMade logic based on the fact that only one group of non-tail insertions is done at a time, so the insertion point can be tracked by the queue. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/dholland-make2/make.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/make.c diff -u othersrc/usr.bin/dholland-make2/make.c:1.9 othersrc/usr.bin/dholland-make2/make.c:1.10 --- othersrc/usr.bin/dholland-make2/make.c:1.9 Sat Mar 23 21:25:31 2013 +++ othersrc/usr.bin/dholland-make2/make.c Sat Mar 23 21:27:23 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.9 2013/03/23 21:25:31 dholland Exp $ */ +/* $NetBSD: make.c,v 1.10 2013/03/23 21:27:23 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,14 +111,12 @@ #include"dir.h" #include"job.h" -MAKE_RCSID("$NetBSD: make.c,v 1.9 2013/03/23 21:25:31 dholland Exp $"); - -typedef struct { - LstNode elem; -} QPos; +MAKE_RCSID("$NetBSD: make.c,v 1.10 2013/03/23 21:27:23 dholland Exp $"); typedef struct { Lst data; + Boolean hasmark; + LstNode mark; } MakeQ; static unsigned int checked = 1;/* Sequence # to detect recursion */ @@ -139,8 +137,8 @@ static Boolean MakeStartJobs(void); static int MakePrintStatus(GNode *, int *); static int MakeCheckOrder(GNode *); static int DoMakeCheckOrder(GList *); -static int MakeBuildChild(GNode *, QPos *); -static void MakeBuildParent(GNode *, QPos *); +static int MakeBuildChild(GNode *, Boolean); +static void MakeBuildParent(GNode *, Boolean); // MakeQ @@ -149,6 +147,8 @@ static void MakeQ_Init(MakeQ *q) { q->data = Lst_Init(FALSE); +q->hasmark = FALSE; +q->mark = NULL; } static Boolean @@ -164,41 +164,46 @@ MakeQ_AddTail(MakeQ *q, GNode *gn) } static void -MakeQ_Insert(MakeQ *q, QPos *before, GNode *gn) -{ - Lst_InsertBefore(q->data, before->elem, gn); +MakeQ_AddBeforeMark(MakeQ *q, GNode *gn) +{ + assert(q->hasmark); + if (q->mark == NULL) { + Lst_AtEnd(q->data, gn); + } else { + Lst_InsertBefore(q->data, q->mark, gn); + } } -static GNode * -MakeQ_PopHead(MakeQ *q) +static void +MakeQ_SetMark(MakeQ *q) { - return (GNode *)Lst_DeQueue(q->data); + assert(!q->hasmark); + q->hasmark = TRUE; + if (Lst_IsEmpty(q->data)) { + q->mark = NULL; + } else { + q->mark = Lst_First(q->data); + } } static void -MakeQ_ForEach(MakeQ *q, int (*func)(void *, void *), void *ptr) +MakeQ_ClearMark(MakeQ *q) { - Lst_ForEach(q->data, func, ptr); + assert(q->hasmark); + q->hasmark = FALSE; + q->mark = NULL; } -static QPos * -QPos_Create(LstNode elem) +static GNode * +MakeQ_PopHead(MakeQ *q) { - QPos *ret; - - ret = bmake_malloc(sizeof(*ret)); - ret->elem = elem; - return ret; + return (GNode *)Lst_DeQueue(q->data); } -static QPos * -MakeQ_First(MakeQ *q) +static void +MakeQ_ForEach(MakeQ *q, int (*func)(void *, void *), void *ptr) { - QPos *ret; - - // XXX this leaks memory - ret = QPos_Create(Lst_First(q->data)); - return ret; + Lst_ForEach(q->data, func, ptr); } @@ -797,7 +802,9 @@ Make_Update(GNode *cgn) for (i=0; iorder_succ); i++) { succ = glist_get(¢urion->order_succ, i); - MakeBuildParent(succ, MakeQ_First(&toBeMade)); + MakeQ_SetMark(&toBeMade); + MakeBuildParent(succ, TRUE); + MakeQ_ClearMark(&toBeMade); } } @@ -1114,7 +1121,7 @@ DoMakeCheckOrder(GList *order_pred) } static int -MakeBuildChild(GNode *cn, QPos *toBeMade_next) +MakeBuildChild(GNode *cn, Boolean usemark) { if (DEBUG(MAKE)) fprintf(debug_file, "MakeBuildChild: inspect %s%s, made %d, type %x\n", @@ -1134,16 +1141,16 @@ MakeBuildChild(GNode *cn, QPos *toBeMade cn->name, cn->cohort_num); cn->made = REQUESTED; -if (toBeMade_next == NULL) +if (usemark == FALSE) MakeQ_AddTail(&toBeMade, cn); else - MakeQ_Insert(&toBeMade, toBeMade_next, cn); + MakeQ_AddBeforeMark(&toBeMade, cn); if (cn->unmade_cohorts != 0) { unsigned i; for (i=0; icohorts); i++) { - if (MakeBuildChild(glist_get(&cn->cohorts, i), toBeMade_next)) { + if (MakeBuildChild(glist_get(&cn->cohorts, i), usemark)) { break; } } @@ -1158,12 +1165,12 @@ MakeBuildChild(GNode *cn, QPos *toBeMade /* When a .ORDER LHS node completes we do this on each RHS */ static void -MakeBuildParent(GNode *pn, QPos *toBeMade_next) +MakeBuildParent(GNode *pn, Boolean usemark) { if (pn->made != DEFERRED) return; -if (MakeBuildChild(pn, toBeMade_next) == 0) { +if (MakeBuildChild(pn, usemark) == 0) { /* Mark so that when this node is built we reschedule its parents */ pn->flags |= DONE_ORDER;
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 21:25:31 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: make.c Log Message: Wrap the toBeMade list code in a queue abstraction. Use the same list code on the inside for now. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/dholland-make2/make.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/make.c diff -u othersrc/usr.bin/dholland-make2/make.c:1.8 othersrc/usr.bin/dholland-make2/make.c:1.9 --- othersrc/usr.bin/dholland-make2/make.c:1.8 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/make.c Sat Mar 23 21:25:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.8 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: make.c,v 1.9 2013/03/23 21:25:31 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,14 +111,24 @@ #include"dir.h" #include"job.h" -MAKE_RCSID("$NetBSD: make.c,v 1.8 2013/03/05 04:27:27 dholland Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.9 2013/03/23 21:25:31 dholland Exp $"); + +typedef struct { + LstNode elem; +} QPos; + +typedef struct { + Lst data; +} MakeQ; static unsigned int checked = 1;/* Sequence # to detect recursion */ -static Lst toBeMade; /* The current fringe of the graph. These - * are nodes which await examination by - * MakeOODate. It is added to by - * Make_Update and subtracted from by - * MakeStartJobs */ + +/* + * The current fringe of the graph. These are nodes which await + * examination by MakeOODate. It is added to by Make_Update and + * subtracted from by MakeStartJobs. + */ +static MakeQ toBeMade; static void MakeAddChild(GNode *, GList *); static void MakeFindChild(GNode *, GNode *); @@ -129,8 +139,70 @@ static Boolean MakeStartJobs(void); static int MakePrintStatus(GNode *, int *); static int MakeCheckOrder(GNode *); static int DoMakeCheckOrder(GList *); -static int MakeBuildChild(GNode *, LstNode); -static void MakeBuildParent(GNode *, LstNode); +static int MakeBuildChild(GNode *, QPos *); +static void MakeBuildParent(GNode *, QPos *); + + +// MakeQ + +static void +MakeQ_Init(MakeQ *q) +{ +q->data = Lst_Init(FALSE); +} + +static Boolean +MakeQ_IsEmpty(MakeQ *q) +{ + return Lst_IsEmpty(q->data); +} + +static void +MakeQ_AddTail(MakeQ *q, GNode *gn) +{ + (void)Lst_EnQueue(q->data, gn); +} + +static void +MakeQ_Insert(MakeQ *q, QPos *before, GNode *gn) +{ + Lst_InsertBefore(q->data, before->elem, gn); +} + +static GNode * +MakeQ_PopHead(MakeQ *q) +{ + return (GNode *)Lst_DeQueue(q->data); +} + +static void +MakeQ_ForEach(MakeQ *q, int (*func)(void *, void *), void *ptr) +{ + Lst_ForEach(q->data, func, ptr); +} + +static QPos * +QPos_Create(LstNode elem) +{ + QPos *ret; + + ret = bmake_malloc(sizeof(*ret)); + ret->elem = elem; + return ret; +} + +static QPos * +MakeQ_First(MakeQ *q) +{ + QPos *ret; + + // XXX this leaks memory + ret = QPos_Create(Lst_First(q->data)); + return ret; +} + + +// unsorted code /* XXX: non-typesafe wrapper for list code; remove when possible */ static int @@ -147,7 +219,7 @@ make_abort(GNode *gn, int line) fprintf(debug_file, "make_abort from line %d\n", line); Targ_PrintNode(gn, &two); -Lst_ForEach(toBeMade, doTarg_PrintNode, &two); +MakeQ_ForEach(&toBeMade, doTarg_PrintNode, &two); Targ_PrintGraph(3); abort(); } @@ -725,7 +797,7 @@ Make_Update(GNode *cgn) for (i=0; iorder_succ); i++) { succ = glist_get(¢urion->order_succ, i); - MakeBuildParent(succ, Lst_First(toBeMade)); + MakeBuildParent(succ, MakeQ_First(&toBeMade)); } } @@ -823,7 +895,7 @@ Make_Update(GNode *cgn) } /* Ok, we can schedule the parent again */ pgn->made = REQUESTED; - (void)Lst_EnQueue(toBeMade, pgn); + MakeQ_AddTail(&toBeMade, pgn); } } @@ -1042,7 +1114,7 @@ DoMakeCheckOrder(GList *order_pred) } static int -MakeBuildChild(GNode *cn, LstNode toBeMade_next) +MakeBuildChild(GNode *cn, QPos *toBeMade_next) { if (DEBUG(MAKE)) fprintf(debug_file, "MakeBuildChild: inspect %s%s, made %d, type %x\n", @@ -1063,9 +1135,9 @@ MakeBuildChild(GNode *cn, LstNode toBeMa cn->made = REQUESTED; if (toBeMade_next == NULL) - Lst_AtEnd(toBeMade, cn); + MakeQ_AddTail(&toBeMade, cn); else - Lst_InsertBefore(toBeMade, toBeMade_next, cn); + MakeQ_Insert(&toBeMade, toBeMade_next, cn); if (cn->unmade_cohorts != 0) { unsigned i; @@ -1086,7 +1158,7 @@ MakeBuildChild(GNode *cn, LstNode toBeMa /* When a .ORDER LHS node completes we do this on each RHS */ static void -MakeBuildParent(GNode *pn, LstNode toBeMade_next) +MakeBuildParent(GNode *pn, QPos *toBeMade_next) { if (pn->made != DEFERRED) return; @@ -1104,13 +1176,13 @@ Mak
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 19:57:44 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: main.c Log Message: Remove another linked list. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/dholland-make2/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/main.c diff -u othersrc/usr.bin/dholland-make2/main.c:1.9 othersrc/usr.bin/dholland-make2/main.c:1.10 --- othersrc/usr.bin/dholland-make2/main.c:1.9 Sat Mar 23 17:47:11 2013 +++ othersrc/usr.bin/dholland-make2/main.c Sat Mar 23 19:57:44 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.9 2013/03/23 17:47:11 dholland Exp $ */ +/* $NetBSD: main.c,v 1.10 2013/03/23 19:57:44 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -128,7 +128,7 @@ MAKE_COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ The Regents of the University of California. All rights reserved."); -MAKE_RCSID("$NetBSD: main.c,v 1.9 2013/03/23 17:47:11 dholland Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.10 2013/03/23 19:57:44 dholland Exp $"); #ifndef DEFMAXLOCAL @@ -143,7 +143,7 @@ Boolean allPrecious; /* .PRECIOUS give static Boolean noBuiltins; /* -r flag */ static struct stringarray makefiles; /* ordered list of makefiles to read */ static Boolean printVars; /* print value of one or more vars */ -static Lst variables; /* list of variables to print */ +static struct stringarray variables; /* list of variables to print */ int maxJobs; /* -j argument */ static int maxJobTokens; /* -j argument */ Boolean compatMake; /* -B argument */ @@ -451,7 +451,7 @@ rearg: case 'V': if (argvalue == NULL) goto noarg; printVars = TRUE; - (void)Lst_AtEnd(variables, argvalue); + stringarray_add(&variables, argvalue, NULL); Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL); Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL); break; @@ -857,7 +857,7 @@ main(int argc, char **argv) stringarray_init(&makefiles); printVars = FALSE; debugVflag = FALSE; - variables = Lst_Init(FALSE); + stringarray_init(&variables); beSilent = FALSE; /* Print commands as executed */ ignoreErrors = FALSE; /* Pay attention to non-zero returns */ noExecute = FALSE; /* Execute all commands */ @@ -1215,16 +1215,16 @@ main(int argc, char **argv) /* print the values of any variables requested by the user */ if (printVars) { - LstNode ln; + unsigned i, num; Boolean expandVars; if (debugVflag) expandVars = FALSE; else expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE); - for (ln = Lst_First(variables); ln != NULL; - ln = Lst_Succ(ln)) { - char *var = (char *)Lst_Datum(ln); + num = stringarray_num(&variables); + for (i=0; i
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 19:29:31 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: dir.c Log Message: Remove another linked list. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 othersrc/usr.bin/dholland-make2/dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/dir.c diff -u othersrc/usr.bin/dholland-make2/dir.c:1.5 othersrc/usr.bin/dholland-make2/dir.c:1.6 --- othersrc/usr.bin/dholland-make2/dir.c:1.5 Tue Mar 5 03:32:08 2013 +++ othersrc/usr.bin/dholland-make2/dir.c Sat Mar 23 19:29:30 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.5 2013/03/05 03:32:08 dholland Exp $ */ +/* $NetBSD: dir.c,v 1.6 2013/03/23 19:29:30 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -137,7 +137,7 @@ #include "hash.h" #include "dir.h" -__RCSID("$NetBSD: dir.c,v 1.5 2013/03/05 03:32:08 dholland Exp $"); +__RCSID("$NetBSD: dir.c,v 1.6 2013/03/23 19:29:30 dholland Exp $"); /* * A search path consists of a list of Path structures. A Path structure @@ -209,9 +209,11 @@ __RCSID("$NetBSD: dir.c,v 1.5 2013/03/05 * in a cache for when Dir_MTime was actually called. */ -struct patharray dirSearchPath; /* main search path */ +/* main search path */ +struct patharray dirSearchPath; -static Lst openDirectories; /* the list of all open directories */ +/* all open directories */ +static struct patharray openDirectories; /* * Variables for gathering statistics on the efficiency of the hashing @@ -258,7 +260,7 @@ void Dir_Init(const char *cdname) { patharray_init(&dirSearchPath); -openDirectories = Lst_Init(FALSE); +patharray_init(&openDirectories); Hash_InitTable(&mtimes, 0); Dir_InitCur(cdname); @@ -313,11 +315,8 @@ void Dir_InitDot(void) { if (dot != NULL) { - LstNode ln; - /* Remove old entry from openDirectories, but do not destroy. */ - ln = Lst_Member(openDirectories, dot); - (void)Lst_Remove(openDirectories, ln); + patharray_removeval(&openDirectories, dot); } dot = Dir_AddDir(NULL, "."); @@ -359,10 +358,10 @@ Dir_End(void) dotLast->refCount -= 1; Dir_Destroy(dotLast); Dir_Destroy(dot); -Dir_ClearPath(dirSearchPath); -Lst_Destroy(dirSearchPath, NULL); -Dir_ClearPath(openDirectories); -Lst_Destroy(openDirectories, NULL); +Dir_ClearPath(&dirSearchPath); +patharray_cleanup(&dirSearchPath); +Dir_ClearPath(&openDirectories); +patharray_cleanup(&openDirectories); Hash_DeleteTable(&mtimes); #endif } @@ -415,30 +414,9 @@ Dir_SetPATH(void) } } -/*- - *--- - * DirFindName -- - * See if the Path structure describes the same directory as the - * given one by comparing their names. Called from Dir_AddDir via - * Lst_Find when searching the list of open directories. - * - * Input: - * p Current name - * dname Desired name - * - * Results: - * 0 if it is the same. Non-zero otherwise - * - * Side Effects: - * None - *--- +/* + * Look up a Path structure by name in an array of them. */ -static int -DirFindName(const void *p, const void *dname) -{ -return (strcmp(((const Path *)p)->name, dname)); -} - static Path * DirFind(const struct patharray *path, const char *name) { @@ -1506,9 +1484,7 @@ Dir_MTime(GNode *gn, Boolean recheck) /*- *--- * Dir_AddDir -- - * Add the given name to the end of the given path. The order of - * the arguments is backwards so ParseDoDependency can do a - * Lst_ForEach of its list of paths... + * Add the given name to the end of the given path. * * Input: * path the path to which the directory should be @@ -1526,7 +1502,6 @@ Dir_MTime(GNode *gn, Boolean recheck) Path * Dir_AddDir(struct patharray *path, const char *name) { -LstNode ln = NULL; /* node in case Path structure is found */ Path *p;/* pointer to new Path structure */ DIR *d; /* for reading directory */ struct dirent *dp; /* entry in directory */ @@ -1542,12 +1517,9 @@ Dir_AddDir(struct patharray *path, const } } -p = NULL; +p = (path == NULL) ? NULL : DirFind(&openDirectories, name); -if (path) - ln = Lst_Find(openDirectories, name, DirFindName); -if (ln != NULL) { - p = (Path *)Lst_Datum(ln); +if (p != NULL) { if (path && !patharray_contains(path, p)) { p->refCount += 1; patharray_add(path, p, NULL); @@ -1578,7 +1550,7 @@ Dir_AddDir(struct patharray *path, const (void)Hash_CreateEntry(&p->files, dp->d_name, NULL); } (void)closedir(d); - (void)Lst_AtEnd(openDirectories, p); + patharray_add(&openDirectories, p, NULL); if (pa
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 19:16:24 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: arch.c Log Message: Update comment. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 othersrc/usr.bin/dholland-make2/arch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/arch.c diff -u othersrc/usr.bin/dholland-make2/arch.c:1.6 othersrc/usr.bin/dholland-make2/arch.c:1.7 --- othersrc/usr.bin/dholland-make2/arch.c:1.6 Tue Mar 5 03:32:08 2013 +++ othersrc/usr.bin/dholland-make2/arch.c Sat Mar 23 19:16:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.6 2013/03/05 03:32:08 dholland Exp $ */ +/* $NetBSD: arch.c,v 1.7 2013/03/23 19:16:24 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -137,7 +137,7 @@ #include"dir.h" #include"config.h" -MAKE_RCSID("$NetBSD: arch.c,v 1.6 2013/03/05 03:32:08 dholland Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.7 2013/03/23 19:16:24 dholland Exp $"); #ifdef TARGET_MACHINE #undef MAKE_MACHINE @@ -214,7 +214,7 @@ ArchFree(Arch *a) * * Input: * linePtr Pointer to start of specification - * nodeLst Lst on which to place the nodes + * nodeList Array in which to place the nodes * ctxt Context in which to expand variables * * Results:
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 19:15:40 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: parse.c Log Message: Remove the last linked list. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 othersrc/usr.bin/dholland-make2/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/parse.c diff -u othersrc/usr.bin/dholland-make2/parse.c:1.10 othersrc/usr.bin/dholland-make2/parse.c:1.11 --- othersrc/usr.bin/dholland-make2/parse.c:1.10 Sat Mar 23 19:06:42 2013 +++ othersrc/usr.bin/dholland-make2/parse.c Sat Mar 23 19:15:40 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.10 2013/03/23 19:06:42 dholland Exp $ */ +/* $NetBSD: parse.c,v 1.11 2013/03/23 19:15:40 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -137,7 +137,7 @@ #include "buf.h" #include "pathnames.h" -MAKE_RCSID("$NetBSD: parse.c,v 1.10 2013/03/23 19:06:42 dholland Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.11 2013/03/23 19:15:40 dholland Exp $"); //#define CLEANUP @@ -160,8 +160,8 @@ typedef struct IFile { struct loadedfile *lf; /* loadedfile object, if any */ } IFile; -DECLARRAY_BYTYPE(ifilearray, struct IFile, static); -DEFARRAY_BYTYPE(ifilearray, struct IFile, MAKE_ATTR_UNUSED static); +DECLARRAY_BYTYPE(ifilestack, struct IFile, static); +DEFARRAY_BYTYPE(ifilestack, struct IFile, MAKE_ATTR_UNUSED static); /* * These values are returned by ParseEOF to tell Parse_File whether to @@ -269,7 +269,7 @@ static int fatals = 0; static IFile *curFile; /* stack of IFiles generated by .includes */ -static Lst includes; +static struct ifilestack includes; /* include paths (lists of directories) */ struct patharray parseIncPath; /* dirs for "..." includes */ @@ -561,6 +561,30 @@ done: } +// stack ops for the array-as-stack + +static void +ifilestack_push(struct ifilestack *arr, IFile *f) +{ + ifilestack_add(arr, f, NULL); +} + +static IFile * +ifilestack_pop(struct ifilestack *arr) +{ + unsigned num; + IFile *ret; + + num = ifilestack_num(arr); + if (num == 0) { + return NULL; + } + ret = ifilestack_get(arr, num - 1); + ifilestack_setsize(arr, num - 1); + return ret; +} + + // old code /*- @@ -2274,7 +2298,7 @@ Parse_SetInput(const char *name, int lin if (curFile != NULL) { /* Save exiting file info */ - Lst_AtFront(includes, curFile); + ifilestack_push(&includes, curFile); } /* Allocate and fill in new structure */ @@ -2469,7 +2493,7 @@ ParseEOF(void) free(curFile->P_str); free(curFile); -curFile = Lst_DeQueue(includes); +curFile = ifilestack_pop(&includes); if (curFile == NULL) { /* We've run out of input */ @@ -3013,7 +3037,7 @@ Parse_Init(void) patharray_init(&parseIncPath); patharray_init(&sysIncPath); patharray_init(&defIncPath); -includes = Lst_Init(FALSE); +ifilestack_init(&includes); glist_init(&targets); #ifdef CLEANUP stringarray_init(&targCmds); @@ -3041,7 +3065,7 @@ Parse_End(void) patharray_cleanup(&sysIncPath); patharray_cleanup(&parseIncPath); /* Should be empty now */ -Lst_Destroy(includes, NULL); +ifilestack_cleanup(&includes); #endif }
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 19:06:42 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: parse.c Log Message: More arrays, fewer lists. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/dholland-make2/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/parse.c diff -u othersrc/usr.bin/dholland-make2/parse.c:1.9 othersrc/usr.bin/dholland-make2/parse.c:1.10 --- othersrc/usr.bin/dholland-make2/parse.c:1.9 Sat Mar 23 18:35:31 2013 +++ othersrc/usr.bin/dholland-make2/parse.c Sat Mar 23 19:06:42 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.9 2013/03/23 18:35:31 dholland Exp $ */ +/* $NetBSD: parse.c,v 1.10 2013/03/23 19:06:42 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -81,10 +81,9 @@ * main entry point and controls most of the other functions in this * module. * - * Most important structures are kept in Lsts. Directories for - * the .include "..." function are kept in the 'parseIncPath' Lst, while - * those for the .include <...> are kept in the 'sysIncPath' Lst. The - * targets currently being defined are kept in the 'targets' Lst. + * Directories for .include "..." are kept in parseIncPath[]. + * Those for .include <...> are kept in sysIncPath[]. The + * targets currently being defined are kept in targets[]. * * The variables 'fname' and 'lineno' are used to track the name * of the current file and the line number in that file so that error @@ -111,7 +110,7 @@ * Parse_Error Function called when an error occurs in * parsing. Used by the variable and * conditional modules. - * Parse_MainName Returns a Lst of the main target to create. + * Parse_MainName Returns the main target(s) to create. */ #include @@ -138,7 +137,9 @@ #include "buf.h" #include "pathnames.h" -MAKE_RCSID("$NetBSD: parse.c,v 1.9 2013/03/23 18:35:31 dholland Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.10 2013/03/23 19:06:42 dholland Exp $"); + +//#define CLEANUP // types and constants @@ -159,6 +160,8 @@ typedef struct IFile { struct loadedfile *lf; /* loadedfile object, if any */ } IFile; +DECLARRAY_BYTYPE(ifilearray, struct IFile, static); +DEFARRAY_BYTYPE(ifilearray, struct IFile, MAKE_ATTR_UNUSED static); /* * These values are returned by ParseEOF to tell Parse_File whether to @@ -232,7 +235,7 @@ static GList targets; #ifdef CLEANUP /* command lines for targets */ -static Lst targCmds; +static struct stringarray targCmds; #endif /* @@ -2004,7 +2007,7 @@ Parse_AddIncludeDir(char *dir) * None * * Side Effects: - * A structure is added to the includes Lst and readProc, lineno, + * A structure is added to the includes list and readProc, lineno, * fname and curFILE are altered for the new file *- */ @@ -2245,7 +2248,7 @@ ParseTrackInput(const char *name) * None * * Side Effects: - * A structure is added to the includes Lst and readProc, lineno, + * A structure is added to the includes list and readProc, lineno, * fname and curFile are altered for the new file *- */ @@ -2269,9 +2272,10 @@ Parse_SetInput(const char *name, int lin /* sanity */ return; -if (curFile != NULL) +if (curFile != NULL) { /* Save exiting file info */ Lst_AtFront(includes, curFile); +} /* Allocate and fill in new structure */ curFile = bmake_malloc(sizeof *curFile); @@ -2319,7 +2323,7 @@ Parse_SetInput(const char *name, int lin * None * * Side Effects: - * A structure is added to the includes Lst and readProc, lineno, + * A structure is added to the includes list and readProc, lineno, * fname and curFILE are altered for the new file *- */ @@ -2855,7 +2859,7 @@ Parse_File(const char *name, int fd) ParseAddCmd(glist_get(&targets, i), cp); } #ifdef CLEANUP - Lst_AtEnd(targCmds, cp); + stringarray_add(&targCmds, cp, NULL); #endif } } @@ -3012,7 +3016,7 @@ Parse_Init(void) includes = Lst_Init(FALSE); glist_init(&targets); #ifdef CLEANUP -targCmds = Lst_Init(FALSE); +stringarray_init(&targCmds); #endif } @@ -3020,16 +3024,24 @@ void Parse_End(void) { #ifdef CLEANUP -Lst_Destroy(targCmds, (FreeProc *)free); +unsigned i, num; + +num = stringarray_num(&targCmds); +for (i=0; i
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 18:58:44 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: suff.c Log Message: Oops, left CLEANUP on for testing; turn it off again. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.21 othersrc/usr.bin/dholland-make2/suff.c:1.22 --- othersrc/usr.bin/dholland-make2/suff.c:1.21 Sat Mar 23 18:42:40 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 18:58:43 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.21 2013/03/23 18:42:40 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.22 2013/03/23 18:58:43 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,9 +131,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.21 2013/03/23 18:42:40 dholland Exp $"); - -#define CLEANUP +MAKE_RCSID("$NetBSD: suff.c,v 1.22 2013/03/23 18:58:43 dholland Exp $"); /* * Structure describing an individual suffix. @@ -2540,6 +2538,7 @@ Suff_Init(void) *-- */ +#ifdef CLEANUP static void sufflist_purge(struct sufflist *l) { @@ -2553,6 +2552,7 @@ sufflist_purge(struct sufflist *l) } sufflist_setsize(l, 0); } +#endif void Suff_End(void)
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 18:46:18 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: job.h Log Message: Update another comment. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/job.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/job.h diff -u othersrc/usr.bin/dholland-make2/job.h:1.2 othersrc/usr.bin/dholland-make2/job.h:1.3 --- othersrc/usr.bin/dholland-make2/job.h:1.2 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/job.h Sat Mar 23 18:46:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: job.h,v 1.2 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: job.h,v 1.3 2013/03/23 18:46:17 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -117,7 +117,7 @@ emul_poll(struct pollfd *fd, int nfd, in * Each job has several things associated with it: * 1) The process id of the child shell * 2) The graph node describing the target being made by this job - * 3) A LstNode for the first command to be saved after the job + * 3) The index for the first command to be saved after the job * completes. This is NULL if there was no "..." in the job's * commands. * 4) An FILE* for writing out the commands. This is only
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 18:43:10 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: targ.c Log Message: Update a comment. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/dholland-make2/targ.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/targ.c diff -u othersrc/usr.bin/dholland-make2/targ.c:1.9 othersrc/usr.bin/dholland-make2/targ.c:1.10 --- othersrc/usr.bin/dholland-make2/targ.c:1.9 Sat Mar 23 17:11:22 2013 +++ othersrc/usr.bin/dholland-make2/targ.c Sat Mar 23 18:43:10 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.9 2013/03/23 17:11:22 dholland Exp $ */ +/* $NetBSD: targ.c,v 1.10 2013/03/23 18:43:10 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -127,7 +127,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: targ.c,v 1.9 2013/03/23 17:11:22 dholland Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.10 2013/03/23 18:43:10 dholland Exp $"); static GList allTargets; /* the list of all targets found so far */ #ifdef CLEANUP @@ -819,7 +819,7 @@ TargPropagateNode(GNode *gn) * gnp Another node that has cnp as a cohort. * * Results: - * Always returns 0, for the benefit of Lst_ForEach(). + * nil * * Side Effects: * cnp's type bitmask is modified to incorporate some of the
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 18:42:40 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: suff.c Log Message: Update some more comments. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.20 othersrc/usr.bin/dholland-make2/suff.c:1.21 --- othersrc/usr.bin/dholland-make2/suff.c:1.20 Sat Mar 23 18:36:16 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 18:42:40 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.20 2013/03/23 18:36:16 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.21 2013/03/23 18:42:40 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.20 2013/03/23 18:36:16 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.21 2013/03/23 18:42:40 dholland Exp $"); #define CLEANUP @@ -179,10 +179,8 @@ typedef struct Src { } Src; /* - * A structure for passing more than one argument to the Lst-library-invoked - * function... + * This is used by SuffScanTargets to keep track of what it's doing. */ - typedef struct { GNode **gn; Suff *s; @@ -630,8 +628,7 @@ Suff_AddTransform(const char *line) * Suff_EndTransform -- * Handle the finish of a transformation definition, removing the * transformation from the graph if it has neither commands nor - * sources. This is a callback procedure for the Parse module via - * Lst_ForEach + * sources. This is a callback procedure for the Parse module. * * Input: * gn Node for transformation @@ -696,7 +693,7 @@ Suff_EndTransform(GNode *gn) /*- *--- * SuffRebuildGraph -- - * Called from Suff_AddSuffix via Lst_ForEach to search through the + * Called from Suff_AddSuffix to search through the * list of existing transformation rules and rebuild the transformation * graph when it has been destroyed by Suff_ClearSuffixes. If the * given rule is a transformation involving this suffix and another, @@ -769,7 +766,7 @@ SuffRebuildGraph(GNode *transform, Suff /*- *--- * SuffScanTargets -- - * Called from Suff_AddSuffix via Lst_ForEach to search through the + * Called from Suff_AddSuffix to search through the * list of existing targets and find if any of the existing targets * can be turned into a transformation rule. *
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 18:36:16 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: suff.c Log Message: Update comment for previous To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.19 othersrc/usr.bin/dholland-make2/suff.c:1.20 --- othersrc/usr.bin/dholland-make2/suff.c:1.19 Sat Mar 23 18:35:31 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 18:36:16 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.19 2013/03/23 18:35:31 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.20 2013/03/23 18:36:16 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.19 2013/03/23 18:35:31 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.20 2013/03/23 18:36:16 dholland Exp $"); #define CLEANUP @@ -634,11 +634,10 @@ Suff_AddTransform(const char *line) * Lst_ForEach * * Input: - * gnp Node for transformation - * dummy Node for transformation + * gn Node for transformation * * Results: - * === 0 + * nil * * Side Effects: * If the node has no commands or children, the children and parents
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 18:35:32 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: nonints.h parse.c suff.c Log Message: Use real types. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 othersrc/usr.bin/dholland-make2/nonints.h cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/dholland-make2/parse.c cvs rdiff -u -r1.18 -r1.19 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/nonints.h diff -u othersrc/usr.bin/dholland-make2/nonints.h:1.7 othersrc/usr.bin/dholland-make2/nonints.h:1.8 --- othersrc/usr.bin/dholland-make2/nonints.h:1.7 Sat Mar 23 18:33:00 2013 +++ othersrc/usr.bin/dholland-make2/nonints.h Sat Mar 23 18:35:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.7 2013/03/23 18:33:00 dholland Exp $ */ +/* $NetBSD: nonints.h,v 1.8 2013/03/23 18:35:31 dholland Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -144,7 +144,7 @@ void Str_SYSVSubst(Buffer *, char *, cha void Suff_ClearSuffixes(void); Boolean Suff_IsTransform(const char *); GNode *Suff_AddTransform(const char *); -int Suff_EndTransform(void *, void *); +void Suff_EndTransform(GNode *); void Suff_AddSuffix(const char *, GNode **); struct patharray *Suff_GetPath(const char *); void Suff_DoPaths(void); Index: othersrc/usr.bin/dholland-make2/parse.c diff -u othersrc/usr.bin/dholland-make2/parse.c:1.8 othersrc/usr.bin/dholland-make2/parse.c:1.9 --- othersrc/usr.bin/dholland-make2/parse.c:1.8 Sat Mar 23 18:33:00 2013 +++ othersrc/usr.bin/dholland-make2/parse.c Sat Mar 23 18:35:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.8 2013/03/23 18:33:00 dholland Exp $ */ +/* $NetBSD: parse.c,v 1.9 2013/03/23 18:35:31 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -138,7 +138,7 @@ #include "buf.h" #include "pathnames.h" -MAKE_RCSID("$NetBSD: parse.c,v 1.8 2013/03/23 18:33:00 dholland Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.9 2013/03/23 18:35:31 dholland Exp $"); // types and constants @@ -2731,9 +2731,7 @@ ParseFinishLine(void) if (inLine) { for (i=0; itype & OP_DOUBLEDEP) && glist_num(&gn->cohorts) > 0) { gn = glist_get(&gn->cohorts, glist_num(&gn->cohorts) - 1); } @@ -694,8 +692,6 @@ Suff_EndTransform(void *gnp, void *dummy } else if ((gn->type & OP_TRANSFORM) && DEBUG(SUFF)) { fprintf(debug_file, "transformation %s complete\n", gn->name); } - -return(dummy ? 0 : 0); } /*-
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 18:33:01 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: nonints.h parse.c suff.c Log Message: Use more const. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 othersrc/usr.bin/dholland-make2/nonints.h cvs rdiff -u -r1.7 -r1.8 othersrc/usr.bin/dholland-make2/parse.c cvs rdiff -u -r1.17 -r1.18 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/nonints.h diff -u othersrc/usr.bin/dholland-make2/nonints.h:1.6 othersrc/usr.bin/dholland-make2/nonints.h:1.7 --- othersrc/usr.bin/dholland-make2/nonints.h:1.6 Sat Mar 23 17:47:11 2013 +++ othersrc/usr.bin/dholland-make2/nonints.h Sat Mar 23 18:33:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.6 2013/03/23 17:47:11 dholland Exp $ */ +/* $NetBSD: nonints.h,v 1.7 2013/03/23 18:33:00 dholland Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -142,17 +142,17 @@ void Str_SYSVSubst(Buffer *, char *, cha /* suff.c */ void Suff_ClearSuffixes(void); -Boolean Suff_IsTransform(char *); -GNode *Suff_AddTransform(char *); +Boolean Suff_IsTransform(const char *); +GNode *Suff_AddTransform(const char *); int Suff_EndTransform(void *, void *); -void Suff_AddSuffix(char *, GNode **); -struct patharray *Suff_GetPath(char *); +void Suff_AddSuffix(const char *, GNode **); +struct patharray *Suff_GetPath(const char *); void Suff_DoPaths(void); -void Suff_AddInclude(char *); -void Suff_AddLib(char *); +void Suff_AddInclude(const char *); +void Suff_AddLib(const char *); void Suff_FindDeps(GNode *); const struct patharray *Suff_FindPath(GNode *); -void Suff_SetNull(char *); +void Suff_SetNull(const char *); void Suff_Init(void); void Suff_End(void); void Suff_PrintAll(void); Index: othersrc/usr.bin/dholland-make2/parse.c diff -u othersrc/usr.bin/dholland-make2/parse.c:1.7 othersrc/usr.bin/dholland-make2/parse.c:1.8 --- othersrc/usr.bin/dholland-make2/parse.c:1.7 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/parse.c Sat Mar 23 18:33:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.7 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: parse.c,v 1.8 2013/03/23 18:33:00 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -138,7 +138,7 @@ #include "buf.h" #include "pathnames.h" -MAKE_RCSID("$NetBSD: parse.c,v 1.7 2013/03/05 04:27:27 dholland Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.8 2013/03/23 18:33:00 dholland Exp $"); // types and constants @@ -2010,7 +2010,7 @@ Parse_AddIncludeDir(char *dir) */ static void -Parse_include_file(char *file, Boolean isSystem, int silent) +Parse_include_file(const char *file, Boolean isSystem, int silent) { struct loadedfile *lf; char *fullname; /* full pathname of file */ @@ -2061,7 +2061,7 @@ Parse_include_file(char *file, Boolean i * then on the .PATH search path, if not found in a -I directory. * If we have a suffix specific path we should use that. */ - char *suff; + const char *suff; struct patharray *suffPath; if ((suff = strrchr(file, '.'))) { @@ -2180,7 +2180,8 @@ ParseDoInclude(char *line) static void ParseSetParseFile(const char *filename) { -char *slash, *dirname; +const char *slash; +char *dirname; const char *pd, *pf; int len; Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.17 othersrc/usr.bin/dholland-make2/suff.c:1.18 --- othersrc/usr.bin/dholland-make2/suff.c:1.17 Sat Mar 23 18:27:18 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 18:33:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.17 2013/03/23 18:27:18 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.18 2013/03/23 18:33:00 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.17 2013/03/23 18:27:18 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.18 2013/03/23 18:33:00 dholland Exp $"); #define CLEANUP @@ -209,10 +209,10 @@ static Suff *emptySuff; /* The empt static const char *SuffStrIsPrefix(const char *, const char *); static const char *SuffSuffIsSuffix(const Suff *, const char *name); static void SuffUnRef(struct sufflist *, Suff *); -static void SuffFree(void *); +static void SuffFree(Suff *); static void SuffInsert(struct sufflist *, Suff *); static void SuffRemove(struct sufflist *, Suff *); -static Boolean SuffParseTransform(char *, Suff **, Suff **); +static Boolean SuffParseTransform(const char *, Suff **, Suff **); static void SuffRebuildGraph(GNode *, Suff *); static void SuffAddSrc(Suff *, struct srclist *, Src *); static int SuffRemoveSrc(struct srclist *); @@ -328,9 +328,8 @@ SuffUnRef(struct sufflist *l, Suff *s) * Des
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 18:27:18 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: suff.c Log Message: Reorg some of the comments. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.16 othersrc/usr.bin/dholland-make2/suff.c:1.17 --- othersrc/usr.bin/dholland-make2/suff.c:1.16 Sat Mar 23 18:12:12 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 18:27:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.16 2013/03/23 18:12:12 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.17 2013/03/23 18:27:18 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.16 2013/03/23 18:12:12 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.17 2013/03/23 18:27:18 dholland Exp $"); #define CLEANUP @@ -229,22 +229,12 @@ static void SuffPrintName(Suff *); static void SuffPrintSuff(Suff *); static void SuffPrintTrans(GNode *); - /*** Lst Predicates / -/*- - *--- - * SuffStrIsPrefix -- - * See if pref is a prefix of str. - * - * Input: - * pref possible prefix - * str string to check - * - * Results: - * NULL if it ain't, pointer to character in str after prefix if so - * - * Side Effects: - * None - *--- + +// support functions + +/* + * Check if PREF is a prefix of STR. If so, return the suffix part of + * STR. If not, return NULL. */ static const char * SuffStrIsPrefix(const char *pref, const char *str) @@ -258,8 +248,8 @@ SuffStrIsPrefix(const char *pref, const } /* - * Check if SUFF is a suffix of NAME. If so, return a pointer to - * the position of the suffix in NAME; otherwise, NULL. + * Check if SUFF is a suffix of NAME. If so, return a pointer to the + * position of the suffix in NAME; otherwise, NULL. */ static const char * SuffSuffIsSuffix(const Suff *suff, const char *name) @@ -280,20 +270,8 @@ SuffSuffIsSuffix(const Suff *suff, const return NULL; } -/*- - *--- - * findtransform -- - * find an entry in transforms[] by name - * - * Input: - * name name of node we're looking for - * - * Results: - * the GNode, or NULL if it's not there - * - * Side Effects: - * None - *--- +/* + * Find a GNode in transforms[] by name. Returns NULL if not there. */ static GNode * findtransform(const char *name) @@ -311,14 +289,18 @@ findtransform(const char *name) return NULL; } - /*** Maintenance Functions / - +/* + * Create a new reference to a suffix. + */ static void suff_incref(Suff *s) { s->refCount++; } +/* + * Drop a reference to a suffix. + */ static void suff_decref(Suff *s) { @@ -326,6 +308,10 @@ suff_decref(Suff *s) // XXX should destroy here but we need a cleanup pass first } +/* + * Remove a suffix from a suffix list and drop the associated + * reference. If not there, does nothing. + */ static void SuffUnRef(struct sufflist *l, Suff *s) { @@ -338,17 +324,8 @@ SuffUnRef(struct sufflist *l, Suff *s) } } -/*- - *--- - * SuffFree -- - * Free up all memory associated with the given suffix structure. - * - * Results: - * none - * - * Side Effects: - * the suffix entry is detroyed - *--- +/* + * Destroy a suffix. */ static void SuffFree(void *sp) @@ -383,18 +360,11 @@ SuffFree(void *sp) free(s); } -/*- - *--- - * SuffRemove -- - * Remove the suffix into the list - * - * Results: - * None +/* + * Remove a suffix from a suffix list. Drop it from the master list + * too if it isn't referenced anywhere else (?). * - * Side Effects: - * The reference count for the suffix is decremented and the - * suffix is possibly freed - *--- + * XXX: the refcount handling for suffixes is all hosed. */ static void SuffRemove(struct sufflist *l, Suff *s) @@ -405,23 +375,14 @@ SuffRemove(struct sufflist *l, Suff *s) SuffFree(s); } } - -/*- - *--- - * SuffInsert -- - * Insert the suffix into the list keeping the list ordered by suffix - * numbers. - * - * Input: - * l the list where in s should be inse
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 18:12:12 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: suff.c Log Message: Rewrite SuffSuffIsSuffix to avoid potential undefined behavior. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.15 othersrc/usr.bin/dholland-make2/suff.c:1.16 --- othersrc/usr.bin/dholland-make2/suff.c:1.15 Sat Mar 23 18:02:58 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 18:12:12 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.15 2013/03/23 18:02:58 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.16 2013/03/23 18:12:12 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.15 2013/03/23 18:02:58 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.16 2013/03/23 18:12:12 dholland Exp $"); #define CLEANUP @@ -257,44 +257,27 @@ SuffStrIsPrefix(const char *pref, const return (*pref ? NULL : str); } -/*- - *--- - * SuffSuffIsSuffix -- - * See if suff is a suffix of str. sd->ename should point to THE END - * of the string to check. (THE END == the null byte) - * - * Input: - * s possible suffix - * sd string to examine - * - * Results: - * NULL if it ain't, pointer to character in str before suffix if - * it is. - * - * Side Effects: - * None - *--- +/* + * Check if SUFF is a suffix of NAME. If so, return a pointer to + * the position of the suffix in NAME; otherwise, NULL. */ static const char * -SuffSuffIsSuffix(const Suff *s, const char *name) +SuffSuffIsSuffix(const Suff *suff, const char *name) { size_t namelen; -const char *p1; /* Pointer into suffix name */ -const char *p2; /* Pointer into string being examined */ +const char *candidate; namelen = strlen(name); -if (namelen < s->nameLen) - return NULL; /* this string is shorter than the suffix */ - -p1 = s->name + s->nameLen; -p2 = name + namelen; - -while (p1 >= s->name && *p1 == *p2) { - p1--; - p2--; +if (namelen < suff->nameLen) { + /* this string is shorter than the suffix */ + return NULL; } -return (p1 == s->name - 1 ? p2 : NULL); +candidate = name + namelen - suff->nameLen; +if (!strcmp(candidate, suff->name)) { + return candidate; +} +return NULL; } /*- @@ -789,7 +772,7 @@ SuffRebuildGraph(GNode *transform, Suff const char *cp; Suff *s2; unsigned i, numsuffixes; -size_t matchlen; +size_t prefixlen; numsuffixes = sufflist_num(&sufflist); @@ -817,19 +800,11 @@ SuffRebuildGraph(GNode *transform, Suff */ cp = SuffSuffIsSuffix(s, transform->name); if (cp != NULL) { - /* - * For reasons best known to whoever wrote it, - * SuffSuffIsSuffix returns one less than the pointer to - * the suffix inside transform->name, instead of the - * pointer to the suffix. - */ - cp++; - - matchlen = cp - transform->name; + prefixlen = cp - transform->name; for (i=0; inameLen == matchlen && - !memcmp(s2->name, transform->name, matchlen)) { + if (s2->nameLen == prefixlen && + !memcmp(s2->name, transform->name, prefixlen)) { /* * Found it -- establish the proper relationship */ @@ -2102,7 +2077,7 @@ SuffFindNormalDeps(GNode *gn, struct src for (pos = 0; pos < num; pos++) { suff = sufflist_get(&sufflist, pos); - if (SuffSuffIsSuffix(suff, gn->name)) { + if (SuffSuffIsSuffix(suff, gn->name) != NULL) { /* * Next possible suffix...
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 18:02:58 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: suff.c Log Message: Simplify the interface to SuffSuffIsSuffix(). To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.14 othersrc/usr.bin/dholland-make2/suff.c:1.15 --- othersrc/usr.bin/dholland-make2/suff.c:1.14 Sat Mar 23 17:56:58 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 18:02:58 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.14 2013/03/23 17:56:58 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.15 2013/03/23 18:02:58 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.14 2013/03/23 17:56:58 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.15 2013/03/23 18:02:58 dholland Exp $"); #define CLEANUP @@ -159,14 +159,6 @@ typedef struct Suff { } Suff; /* - * for SuffSuffIsSuffix - */ -typedef struct { -const char *ename; /* The end of the name */ -int len; /* Length of the name */ -} SuffixCmpData; - -/* * Structure used in the search for implied sources. */ @@ -215,7 +207,7 @@ static Suff *emptySuff; /* The empt static const char *SuffStrIsPrefix(const char *, const char *); -static const char *SuffSuffIsSuffix(const Suff *, const SuffixCmpData *); +static const char *SuffSuffIsSuffix(const Suff *, const char *name); static void SuffUnRef(struct sufflist *, Suff *); static void SuffFree(void *); static void SuffInsert(struct sufflist *, Suff *); @@ -284,16 +276,18 @@ SuffStrIsPrefix(const char *pref, const *--- */ static const char * -SuffSuffIsSuffix(const Suff *s, const SuffixCmpData *sd) +SuffSuffIsSuffix(const Suff *s, const char *name) { +size_t namelen; const char *p1; /* Pointer into suffix name */ const char *p2; /* Pointer into string being examined */ -if (sd->len < s->nameLen) +namelen = strlen(name); +if (namelen < s->nameLen) return NULL; /* this string is shorter than the suffix */ p1 = s->name + s->nameLen; -p2 = sd->ename; +p2 = name + namelen; while (p1 >= s->name && *p1 == *p2) { p1--; @@ -794,7 +788,6 @@ SuffRebuildGraph(GNode *transform, Suff { const char *cp; Suff *s2; -SuffixCmpData sd; unsigned i, numsuffixes; size_t matchlen; @@ -822,9 +815,7 @@ SuffRebuildGraph(GNode *transform, Suff /* * Not from, maybe to? */ -sd.len = strlen(transform->name); -sd.ename = transform->name + sd.len; -cp = SuffSuffIsSuffix(s, &sd); +cp = SuffSuffIsSuffix(s, transform->name); if (cp != NULL) { /* * For reasons best known to whoever wrote it, @@ -948,15 +939,11 @@ SuffFindBySuffix(struct sufflist *list, { unsigned i, num; Suff *s; - SuffixCmpData sd; /* Search string data */ - - sd.len = strlen(name); - sd.ename = name + sd.len; num = sufflist_num(list); for (i=0; iname); -sd.ename = eoname = gn->name + sd.len; +eoname = gn->name + strlen(gn->name); sopref = gn->name; @@ -2117,7 +2102,7 @@ SuffFindNormalDeps(GNode *gn, struct src for (pos = 0; pos < num; pos++) { suff = sufflist_get(&sufflist, pos); - if (SuffSuffIsSuffix(suff, &sd)) { + if (SuffSuffIsSuffix(suff, gn->name)) { /* * Next possible suffix...
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 17:56:58 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: suff.c Log Message: More arrays, fewer lists. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.13 othersrc/usr.bin/dholland-make2/suff.c:1.14 --- othersrc/usr.bin/dholland-make2/suff.c:1.13 Sat Mar 23 17:47:11 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 17:56:58 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.13 2013/03/23 17:47:11 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.14 2013/03/23 17:56:58 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.13 2013/03/23 17:47:11 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.14 2013/03/23 17:56:58 dholland Exp $"); #define CLEANUP @@ -205,7 +205,7 @@ static struct sufflist sufflist; /* all static struct sufflist suffClean; /* suffixes to be cleaned */ #endif static struct srclist srclist; /* sources */ -static Lst transforms; /* Lst of transformation rules */ +static GList transforms; /* transformation rules */ static intsNum = 0; /* Counter for assigning suffix numbers */ @@ -216,13 +216,12 @@ static Suff *emptySuff; /* The empt static const char *SuffStrIsPrefix(const char *, const char *); static const char *SuffSuffIsSuffix(const Suff *, const SuffixCmpData *); -static int SuffGNHasNameP(const void *, const void *); static void SuffUnRef(struct sufflist *, Suff *); static void SuffFree(void *); static void SuffInsert(struct sufflist *, Suff *); static void SuffRemove(struct sufflist *, Suff *); static Boolean SuffParseTransform(char *, Suff **, Suff **); -static int SuffRebuildGraph(void *, void *); +static void SuffRebuildGraph(GNode *, Suff *); static void SuffAddSrc(Suff *, struct srclist *, Src *); static int SuffRemoveSrc(struct srclist *); static void SuffAddLevel(struct srclist *, Src *); @@ -236,7 +235,7 @@ static void SuffFindArchiveDeps(GNode *, static void SuffFindNormalDeps(GNode *, struct srclist *); static void SuffPrintName(Suff *); static void SuffPrintSuff(Suff *); -static int SuffPrintTrans(void *, void *); +static void SuffPrintTrans(GNode *); /*** Lst Predicates / /*- @@ -306,24 +305,33 @@ SuffSuffIsSuffix(const Suff *s, const Su /*- *--- - * SuffGNHasNameP -- - * See if the graph node has the desired name + * findtransform -- + * find an entry in transforms[] by name * * Input: - * gn current node we're looking at - * name name we're looking for + * name name of node we're looking for * * Results: - * 0 if it does. non-zero if it doesn't + * the GNode, or NULL if it's not there * * Side Effects: * None *--- */ -static int -SuffGNHasNameP(const void *gn, const void *name) +static GNode * +findtransform(const char *name) { -return (strcmp(name, ((const GNode *)gn)->name)); + unsigned i, num; + GNode *gn; + + num = glist_num(&transforms); + for (i=0; iname)) { + return gn; + } + } + return NULL; } /*** Maintenance Functions / @@ -638,7 +646,7 @@ Suff_IsTransform(char *str) * The node created for the transformation in the transforms list * * Side Effects: - * The node is placed on the end of the transforms Lst and links are + * The node is placed on the end of transforms[] and links are * made between the two suffixes mentioned in the target name *--- */ @@ -648,16 +656,15 @@ Suff_AddTransform(char *line) GNode *gn; /* GNode of transformation rule */ Suff *s, /* source suffix */ *t; /* target suffix */ -LstNode ln; /* Node for existing transformation */ -ln = Lst_Find(transforms, line, SuffGNHasNameP); -if (ln == NULL) { +gn = findtransform(line); +if (gn == NULL) { /* * Make a new graph node for the transformation. It will be filled in * by the Parse module. */ gn = Targ_NewGN(line); - (void)Lst_AtEnd(transforms, gn); + glist_add(&transforms, gn, NULL); } else { /* * New specification for transformation rule. Just nuke the old list @@ -665,7 +672,6 @@ Suff_AddTransform(char *line) * free the commands themselves, because a given command can be * attached to several different transformations. */ - gn = (GNode *)Lst_Datum(ln); stringarray_setsize(&gn->commands, 0); glist_setsize(&gn->children, 0); } @@ -783,11 +789,9 @@ Suff_
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 17:47:12 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: main.c nonints.h suff.c Log Message: Make the DEBUG_SRC code compile again. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/dholland-make2/main.c cvs rdiff -u -r1.5 -r1.6 othersrc/usr.bin/dholland-make2/nonints.h cvs rdiff -u -r1.12 -r1.13 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/main.c diff -u othersrc/usr.bin/dholland-make2/main.c:1.8 othersrc/usr.bin/dholland-make2/main.c:1.9 --- othersrc/usr.bin/dholland-make2/main.c:1.8 Tue Mar 5 04:31:27 2013 +++ othersrc/usr.bin/dholland-make2/main.c Sat Mar 23 17:47:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.8 2013/03/05 04:31:27 dholland Exp $ */ +/* $NetBSD: main.c,v 1.9 2013/03/23 17:47:11 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -128,7 +128,7 @@ MAKE_COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ The Regents of the University of California. All rights reserved."); -MAKE_RCSID("$NetBSD: main.c,v 1.8 2013/03/05 04:31:27 dholland Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.9 2013/03/23 17:47:11 dholland Exp $"); #ifndef DEFMAXLOCAL @@ -1742,11 +1742,10 @@ usage(void) } -int -PrintAddr(void *a, void *b) +void +PrintAddr(void *a) { -printf("%lx ", (unsigned long) a); -return b ? 0 : 0; +printf("%p ", a); } Index: othersrc/usr.bin/dholland-make2/nonints.h diff -u othersrc/usr.bin/dholland-make2/nonints.h:1.5 othersrc/usr.bin/dholland-make2/nonints.h:1.6 --- othersrc/usr.bin/dholland-make2/nonints.h:1.5 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/nonints.h Sat Mar 23 17:47:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.5 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: nonints.h,v 1.6 2013/03/23 17:47:11 dholland Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -113,7 +113,7 @@ void Error(const char *, ...) MAKE_ATTR_ void Fatal(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD; void Punt(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD; void DieHorribly(void) MAKE_ATTR_DEAD; -int PrintAddr(void *, void *); +void PrintAddr(void *); void Finish(int) MAKE_ATTR_DEAD; int eunlink(const char *); void execError(const char *, const char *); Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.12 othersrc/usr.bin/dholland-make2/suff.c:1.13 --- othersrc/usr.bin/dholland-make2/suff.c:1.12 Sat Mar 23 17:36:37 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 17:47:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.12 2013/03/23 17:36:37 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.13 2013/03/23 17:47:11 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,9 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.12 2013/03/23 17:36:37 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.13 2013/03/23 17:47:11 dholland Exp $"); + +#define CLEANUP /* * Structure describing an individual suffix. @@ -180,7 +182,7 @@ typedef struct Src { int children; /* Count of existing children (so we don't free * this thing too early or never nuke it) */ #ifdef DEBUG_SRC -Lst cp; /* Debug; children list */ +struct srclist cp; /* Debug; children list */ #endif } Src; @@ -198,8 +200,6 @@ typedef struct { DEFARRAY_BYTYPE(sufflist, Suff, MAKE_ATTR_UNUSED static); DEFARRAY_BYTYPE(srclist, Src, MAKE_ATTR_UNUSED static); -#define CLEANUP - static struct sufflist sufflist; /* all current suffixes */ #ifdef CLEANUP static struct sufflist suffClean; /* suffixes to be cleaned */ @@ -1188,6 +1188,18 @@ Suff_AddLib(char *sname) * A Src structure is created and tacked onto the end of the list *--- */ +#ifdef DEBUG_SRC +static void +srclist_print(struct srclist *ll) +{ + unsigned i; + + for (i=0; ichildren += 1; srclist_add(ll, s2, NULL); #ifdef DEBUG_SRC - s2->cp = Lst_Init(FALSE); - Lst_AtEnd(targ->cp, s2); - fprintf(debug_file, "1 add %x %x to %x:", targ, s2, ls->l); - Lst_ForEach(ls->l, PrintAddr, NULL); + srclist_init(&s2->cp); + srclist_add(&targ->cp, s2, NULL); + fprintf(debug_file, "1 add %p %p to %p:", targ, s2, ll); + srclist_print(ll); fprintf(debug_file, "\n"); #endif } @@ -1228,10 +1240,10 @@ SuffAddSrc(Suff *s, struct srclist *ll, targ->children += 1; srclist_add(ll, s2, NULL); #ifdef DEBUG_SRC -s2->cp = Lst_Init(FALSE); -Lst_AtEnd(targ->cp, s2); -fprintf(debug_file, "2 add %x %x to %x:", targ, s2, ls->l); -Lst_ForEach(ls->l, PrintAddr, NULL); +srclist_init(&s2->cp); +srclist_add(&targ->cp, s2, NULL); +fprintf(debug_file, "2 add %p %p to %p:", targ, s2,
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 17:36:37 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: suff.c Log Message: Remove unused back-pointers. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.11 othersrc/usr.bin/dholland-make2/suff.c:1.12 --- othersrc/usr.bin/dholland-make2/suff.c:1.11 Sat Mar 23 17:33:58 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 17:36:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.11 2013/03/23 17:33:58 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.12 2013/03/23 17:36:37 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.11 2013/03/23 17:33:58 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.12 2013/03/23 17:36:37 dholland Exp $"); /* * Structure describing an individual suffix. @@ -154,7 +154,6 @@ typedef struct Suff { int refCount; /* Reference count of list membership */ struct sufflist parents; /* Suffixes we have a transformation to */ struct sufflist children; /* Suffixes we have a transformation from */ -Lst ref; /* List of lists this suffix is referenced */ } Suff; /* @@ -385,7 +384,6 @@ SuffFree(void *sp) s->refCount); #endif -Lst_Destroy(s->ref, NULL); sufflist_setsize(&s->children, 0); sufflist_cleanup(&s->children); sufflist_setsize(&s->parents, 0); @@ -462,7 +460,6 @@ SuffInsert(struct sufflist *l, Suff *s) } sufflist_add(l, s, NULL); s->refCount++; - (void)Lst_AtEnd(s->ref, l); } else if (s2->sNum != s->sNum) { if (DEBUG(SUFF)) { fprintf(debug_file, "before %s(%d)\n", s2->name, s2->sNum); @@ -470,7 +467,6 @@ SuffInsert(struct sufflist *l, Suff *s) sufflist_insert(l, pos); sufflist_set(l, pos, s); s->refCount++; - (void)Lst_AtEnd(s->ref, l); } else if (DEBUG(SUFF)) { fprintf(debug_file, "already there\n"); } @@ -985,7 +981,6 @@ Suff_AddSuffix(char *str, GNode **gn) patharray_init(&s->searchPath); sufflist_init(&s->children); sufflist_init(&s->parents); - s->ref = Lst_Init(FALSE); s->sNum = sNum++; s->flags = 0; s->refCount = 1; @@ -2605,11 +2600,9 @@ Suff_Init(void) Dir_Concat(&suffNull->searchPath, &dirSearchPath); sufflist_init(&suffNull->children); sufflist_init(&suffNull->parents); -suffNull->ref = Lst_Init(FALSE); suffNull->sNum = sNum++; suffNull->flags = SUFF_NULL; suffNull->refCount =1; - }
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 17:33:58 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: suff.c Log Message: More arrays, fewer lists. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.10 othersrc/usr.bin/dholland-make2/suff.c:1.11 --- othersrc/usr.bin/dholland-make2/suff.c:1.10 Sat Mar 23 17:09:40 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 17:33:58 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.10 2013/03/23 17:09:40 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.11 2013/03/23 17:33:58 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.10 2013/03/23 17:09:40 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.11 2013/03/23 17:33:58 dholland Exp $"); /* * Structure describing an individual suffix. @@ -168,11 +168,15 @@ typedef struct { /* * Structure used in the search for implied sources. */ -typedef struct _Src { + +struct Src; +DECLARRAY_BYTYPE(srclist, struct Src, static); + +typedef struct Src { char*file; /* The file to look for */ char *pref; /* Prefix from which file was formed */ Suff*suff; /* The suffix on the file */ -struct _Src *parent; /* The Src for which this is a source */ +struct Src *parent; /* The Src for which this is a source */ GNode *node; /* The node describing the file */ int children; /* Count of existing children (so we don't free * this thing too early or never nuke it) */ @@ -193,14 +197,15 @@ typedef struct { } GNodeSuff; DEFARRAY_BYTYPE(sufflist, Suff, MAKE_ATTR_UNUSED static); +DEFARRAY_BYTYPE(srclist, Src, MAKE_ATTR_UNUSED static); #define CLEANUP -static struct sufflist sufflist; /* suffixes */ +static struct sufflist sufflist; /* all current suffixes */ #ifdef CLEANUP static struct sufflist suffClean; /* suffixes to be cleaned */ #endif -static Lst srclist; /* Lst of sources */ +static struct srclist srclist; /* sources */ static Lst transforms; /* Lst of transformation rules */ static intsNum = 0; /* Counter for assigning suffix numbers */ @@ -219,17 +224,17 @@ static void SuffInsert(struct sufflist * static void SuffRemove(struct sufflist *, Suff *); static Boolean SuffParseTransform(char *, Suff **, Suff **); static int SuffRebuildGraph(void *, void *); -static void SuffAddSrc(Suff *, Lst, Src *); -static int SuffRemoveSrc(Lst); -static void SuffAddLevel(Lst, Src *); -static Src *SuffFindThem(Lst, Lst); -static Src *SuffFindCmds(Src *, Lst); +static void SuffAddSrc(Suff *, struct srclist *, Src *); +static int SuffRemoveSrc(struct srclist *); +static void SuffAddLevel(struct srclist *, Src *); +static Src *SuffFindThem(struct srclist *, struct srclist *); +static Src *SuffFindCmds(Src *, struct srclist *); static unsigned SuffExpandChildren(GNode *, unsigned, GNode *); static unsigned SuffExpandWildcards(GNode *, unsigned, GNode *); static Boolean SuffApplyTransform(GNode *, GNode *, Suff *, Suff *); -static void SuffFindDeps(GNode *, Lst); -static void SuffFindArchiveDeps(GNode *, Lst); -static void SuffFindNormalDeps(GNode *, Lst); +static void SuffFindDeps(GNode *, struct srclist *); +static void SuffFindArchiveDeps(GNode *, struct srclist *); +static void SuffFindNormalDeps(GNode *, struct srclist *); static void SuffPrintName(Suff *); static void SuffPrintSuff(Suff *); static int SuffPrintTrans(void *, void *); @@ -1189,7 +1194,7 @@ Suff_AddLib(char *sname) *--- */ static void -SuffAddSrc(Suff *s, Lst ll, Src *targ) +SuffAddSrc(Suff *s, struct srclist *ll, Src *targ) { Src *s2; /* new Src structure */ @@ -1208,7 +1213,7 @@ SuffAddSrc(Suff *s, Lst ll, Src *targ) s->refCount++; s2->children = 0; targ->children += 1; - (void)Lst_AtEnd(ll, s2); + srclist_add(ll, s2, NULL); #ifdef DEBUG_SRC s2->cp = Lst_Init(FALSE); Lst_AtEnd(targ->cp, s2); @@ -1226,7 +1231,7 @@ SuffAddSrc(Suff *s, Lst ll, Src *targ) s->refCount++; s2->children = 0; targ->children += 1; -(void)Lst_AtEnd(ll, s2); +srclist_add(ll, s2, NULL); #ifdef DEBUG_SRC s2->cp = Lst_Init(FALSE); Lst_AtEnd(targ->cp, s2); @@ -1253,7 +1258,7 @@ SuffAddSrc(Suff *s, Lst ll, Src *targ) *--- */ static void -SuffAddLevel(Lst l, Src *targ) +SuffAddLevel(struct srclist *l, Src *targ) { unsigned i, num; Suff *s; @@ -1278,24 +1283,20 @@ SuffAddLevel(Lst l, Src *targ) *---
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 17:11:22 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: targ.c Log Message: Update comment. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/dholland-make2/targ.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/targ.c diff -u othersrc/usr.bin/dholland-make2/targ.c:1.8 othersrc/usr.bin/dholland-make2/targ.c:1.9 --- othersrc/usr.bin/dholland-make2/targ.c:1.8 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/targ.c Sat Mar 23 17:11:22 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.8 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: targ.c,v 1.9 2013/03/23 17:11:22 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -74,8 +74,8 @@ /*- * targ.c -- - * Functions for maintaining the Lst allTargets. Target nodes are - * kept in two structures: a Lst, maintained by the list library, and a + * Functions for maintaining the array allTargets. Target nodes are + * kept in two structures: an array, maintained by the array code, and a * hash table, maintained by the hash library. * * Interface: @@ -127,7 +127,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: targ.c,v 1.8 2013/03/05 04:27:27 dholland Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.9 2013/03/23 17:11:22 dholland Exp $"); static GList allTargets; /* the list of all targets found so far */ #ifdef CLEANUP
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Sat Mar 23 17:09:40 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: graph.h suff.c Log Message: More arrays, fewer lists. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 othersrc/usr.bin/dholland-make2/graph.h cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/graph.h diff -u othersrc/usr.bin/dholland-make2/graph.h:1.6 othersrc/usr.bin/dholland-make2/graph.h:1.7 --- othersrc/usr.bin/dholland-make2/graph.h:1.6 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/graph.h Sat Mar 23 17:09:40 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: graph.h,v 1.6 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: graph.h,v 1.7 2013/03/23 17:09:40 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -174,7 +174,7 @@ struct GNode { Hash_Table context; /* The local variables */ struct stringarray commands;/* Creation commands */ -struct _Suff*suffix; /* Suffix for the node (determined by +struct Suff*suffix; /* Suffix for the node (determined by * Suff_FindDeps and opaque to everyone * but the Suff module) */ const char *fname; /* filename where the GNode got defined */ Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.9 othersrc/usr.bin/dholland-make2/suff.c:1.10 --- othersrc/usr.bin/dholland-make2/suff.c:1.9 Fri Mar 22 22:59:24 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Sat Mar 23 17:09:40 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.9 2013/03/22 22:59:24 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.10 2013/03/23 17:09:40 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,12 +131,16 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.9 2013/03/22 22:59:24 dholland Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.10 2013/03/23 17:09:40 dholland Exp $"); /* * Structure describing an individual suffix. */ -typedef struct _Suff { + +struct Suff; +DECLARRAY_BYTYPE(sufflist, struct Suff, static); + +typedef struct Suff { char *name; /* The suffix itself */ int nameLen; /* Length of the suffix */ short flags; /* Type of suffix */ @@ -146,9 +150,10 @@ typedef struct _Suff { struct patharray searchPath;/* The path along which files of this suffix * may be found */ int sNum; /* The suffix number */ + /* XXX: the handling of refCount is all broken */ int refCount; /* Reference count of list membership */ -Lst parents; /* Suffixes we have a transformation to */ -Lst children; /* Suffixes we have a transformation from */ +struct sufflist parents; /* Suffixes we have a transformation to */ +struct sufflist children; /* Suffixes we have a transformation from */ Lst ref; /* List of lists this suffix is referenced */ } Suff; @@ -156,7 +161,7 @@ typedef struct _Suff { * for SuffSuffIsSuffix */ typedef struct { -char *ename; /* The end of the name */ +const char *ename; /* The end of the name */ int len; /* Length of the name */ } SuffixCmpData; @@ -180,10 +185,6 @@ typedef struct _Src { * A structure for passing more than one argument to the Lst-library-invoked * function... */ -typedef struct { -Lstl; -Src*s; -} LstSrc; typedef struct { GNode **gn; @@ -191,9 +192,13 @@ typedef struct { Boolean r; } GNodeSuff; -static Lst sufflist; /* Lst of suffixes */ +DEFARRAY_BYTYPE(sufflist, Suff, MAKE_ATTR_UNUSED static); + +#define CLEANUP + +static struct sufflist sufflist; /* suffixes */ #ifdef CLEANUP -static Lst suffClean; /* Lst of suffixes to be cleaned */ +static struct sufflist suffClean; /* suffixes to be cleaned */ #endif static Lst srclist; /* Lst of sources */ static Lst transforms; /* Lst of transformation rules */ @@ -206,18 +211,15 @@ static Suff *emptySuff; /* The empt static const char *SuffStrIsPrefix(const char *, const char *); -static char *SuffSuffIsSuffix(const Suff *, const SuffixCmpData *); -static int SuffSuffIsSuffixP(const void *, const void *); -static int SuffSuffHasNameP(const void *, const void *); -static int SuffSuffIsPrefix(const void *, const void *); +static const char *SuffSuffIsSuffix(const Suff *, const SuffixCmpData *); static int SuffGNHasNameP(const void *, const void *); -static void SuffUnRef(void *, void *); +static void SuffUnRef(struct sufflist *, Suff *); static void SuffFree(void *); -static void SuffInsert(Lst, Suff *); -static void SuffRemove(Lst, Suff *); +static void SuffInsert(struct sufflist *, Suff *); +static void SuffRemove(struct sufflist *, Suff *); static Boolean SuffParseTransform(char *, Suff **, Suff **); static int
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Fri Mar 22 22:59:24 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: suff.c Log Message: Declare types before data. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.8 othersrc/usr.bin/dholland-make2/suff.c:1.9 --- othersrc/usr.bin/dholland-make2/suff.c:1.8 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/suff.c Fri Mar 22 22:59:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.8 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: suff.c,v 1.9 2013/03/22 22:59:24 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,16 +131,7 @@ #include "hash.h" #include "dir.h" -MAKE_RCSID("$NetBSD: suff.c,v 1.8 2013/03/05 04:27:27 dholland Exp $"); - -static Lst sufflist; /* Lst of suffixes */ -#ifdef CLEANUP -static Lst suffClean; /* Lst of suffixes to be cleaned */ -#endif -static Lst srclist; /* Lst of sources */ -static Lst transforms; /* Lst of transformation rules */ - -static intsNum = 0; /* Counter for assigning suffix numbers */ +MAKE_RCSID("$NetBSD: suff.c,v 1.9 2013/03/22 22:59:24 dholland Exp $"); /* * Structure describing an individual suffix. @@ -200,6 +191,15 @@ typedef struct { Boolean r; } GNodeSuff; +static Lst sufflist; /* Lst of suffixes */ +#ifdef CLEANUP +static Lst suffClean; /* Lst of suffixes to be cleaned */ +#endif +static Lst srclist; /* Lst of sources */ +static Lst transforms; /* Lst of transformation rules */ + +static intsNum = 0; /* Counter for assigning suffix numbers */ + static Suff *suffNull; /* The NULL suffix for this run */ static Suff *emptySuff; /* The empty suffix required for POSIX * single-suffix transformation rules */
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Tue Mar 5 04:32:57 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: array.c array.h Log Message: No longer need hacks for converting Lst to array and vice versa. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/array.c cvs rdiff -u -r1.5 -r1.6 othersrc/usr.bin/dholland-make2/array.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/array.c diff -u othersrc/usr.bin/dholland-make2/array.c:1.3 othersrc/usr.bin/dholland-make2/array.c:1.4 --- othersrc/usr.bin/dholland-make2/array.c:1.3 Mon Mar 4 08:47:08 2013 +++ othersrc/usr.bin/dholland-make2/array.c Tue Mar 5 04:32:56 2013 @@ -31,9 +31,6 @@ #include #include "portable.h" -/* XXX this should go away */ -#include "lst.h" - #define ARRAYINLINE #include "array.h" @@ -162,36 +159,3 @@ array_removeval(struct array *a, void *v array_remove(a, ix); } } - - -// tools for interfacing with lst.lib - -static int -Lst_AddToArray(void *p, void *arrv) -{ - struct array *arr = arrv; - - array_add(arr, p, NULL); - return 0; -} - -void -Lst_IntoArray(Lst list, struct array *arr) -{ - Lst_ForEach(list, Lst_AddToArray, arr); -} - -Lst -LstFromArray(struct array *arr) -{ - Lst ret; - unsigned i; - void *p; - - ret = Lst_Init(FALSE); - for (i=0; i
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Tue Mar 5 04:31:27 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: main.c Log Message: Simplify twisted logic of "ReadAllMakefiles". To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 othersrc/usr.bin/dholland-make2/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/main.c diff -u othersrc/usr.bin/dholland-make2/main.c:1.7 othersrc/usr.bin/dholland-make2/main.c:1.8 --- othersrc/usr.bin/dholland-make2/main.c:1.7 Tue Mar 5 04:27:27 2013 +++ othersrc/usr.bin/dholland-make2/main.c Tue Mar 5 04:31:27 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.7 2013/03/05 04:27:27 dholland Exp $ */ +/* $NetBSD: main.c,v 1.8 2013/03/05 04:31:27 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -128,7 +128,7 @@ MAKE_COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ The Regents of the University of California. All rights reserved."); -MAKE_RCSID("$NetBSD: main.c,v 1.7 2013/03/05 04:27:27 dholland Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.8 2013/03/05 04:31:27 dholland Exp $"); #ifndef DEFMAXLOCAL @@ -667,19 +667,6 @@ Main_SetObjdir(const char *path) return rc; } -/*- - * ReadAllMakefiles -- - * wrapper around ReadMakefile() to read all. - * - * Results: - * TRUE if ok, FALSE on error - */ -static int -ReadAllMakefiles(const void *p, const void *q) -{ - return (ReadMakefile(p, q) == 0); -} - int str2Lst_Append(struct stringarray *lp, char *str, const char *sep) { @@ -1133,7 +1120,7 @@ main(int argc, char **argv) for (i=0; i
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Tue Mar 5 04:27:27 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: compat.c cond.c graph.h job.c job.h main.c make.c make.h nonints.h parse.c suff.c targ.c Log Message: Clean up the last non-file-local lists. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 othersrc/usr.bin/dholland-make2/compat.c \ othersrc/usr.bin/dholland-make2/main.c \ othersrc/usr.bin/dholland-make2/parse.c cvs rdiff -u -r1.4 -r1.5 othersrc/usr.bin/dholland-make2/cond.c \ othersrc/usr.bin/dholland-make2/nonints.h cvs rdiff -u -r1.5 -r1.6 othersrc/usr.bin/dholland-make2/graph.h cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/job.c cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/job.h cvs rdiff -u -r1.7 -r1.8 othersrc/usr.bin/dholland-make2/make.c \ othersrc/usr.bin/dholland-make2/suff.c \ othersrc/usr.bin/dholland-make2/targ.c cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/dholland-make2/make.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/compat.c diff -u othersrc/usr.bin/dholland-make2/compat.c:1.6 othersrc/usr.bin/dholland-make2/compat.c:1.7 --- othersrc/usr.bin/dholland-make2/compat.c:1.6 Tue Mar 5 03:32:08 2013 +++ othersrc/usr.bin/dholland-make2/compat.c Tue Mar 5 04:27:27 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.6 2013/03/05 03:32:08 dholland Exp $ */ +/* $NetBSD: compat.c,v 1.7 2013/03/05 04:27:27 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -101,7 +101,7 @@ #include"job.h" #include"pathnames.h" -MAKE_RCSID("$NetBSD: compat.c,v 1.6 2013/03/05 03:32:08 dholland Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.7 2013/03/05 04:27:27 dholland Exp $"); /* * The following array is used to make a fast determination of which @@ -198,7 +198,7 @@ CompatInterrupt(int signo) *--- */ int -CompatRunCommand(void *cmdp, void *gnp) +CompatRunCommand(char *cmdp, unsigned cmdindex, GNode *gn) { char *cmdStart; /* Start of expanded command */ char *cp, *bp; @@ -209,7 +209,6 @@ CompatRunCommand(void *cmdp, void *gnp) int status; /* Description of child's death */ pid_t cpid; /* Child actually found */ pid_t retstat; /* Result of wait */ -LstNode cmdNode; /* Node where current command is located */ const char ** volatile av; /* Argument vector for thing to exec */ char ** volatile mav;/* Copy of the argument vector for freeing */ int argc; /* Number of arguments in av or 0 if not @@ -218,14 +217,14 @@ CompatRunCommand(void *cmdp, void *gnp) * locally */ Boolean useShell; /* TRUE if command should be executed * using a shell */ -char * volatile cmd = (char *)cmdp; -GNode *gn = (GNode *)gnp; +char * volatile cmd = cmdp; silent = gn->type & OP_SILENT; errCheck = !(gn->type & OP_IGNORE); doIt = FALSE; + +assert(stringarray_get(&gn->commands, cmdindex) == cmd); -cmdNode = Lst_Member(gn->commands, cmd); cmdStart = Var_Subst(NULL, cmd, gn, FALSE); /* @@ -240,10 +239,9 @@ CompatRunCommand(void *cmdp, void *gnp) return(0); } cmd = cmdStart; -Lst_Replace(cmdNode, cmdStart); - +stringarray_set(&gn->commands, cmdindex, cmdStart); if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) { - (void)Lst_AtEnd(ENDNode->commands, cmdStart); + stringarray_add(&ENDNode->commands, cmdStart, NULL); return(0); } if (strcmp(cmdStart, "...") == 0) { @@ -384,7 +382,8 @@ again: free(mav); if (bp) free(bp); -Lst_Replace(cmdNode, NULL); +/* XXX is this really right? */ +stringarray_set(&gn->commands, cmdindex, NULL); #ifdef USE_META if (useMeta) { @@ -496,6 +495,8 @@ Compat_Make(void *gnp, void *pgnp) { GNode *gn = (GNode *)gnp; GNode *pgn = (GNode *)pgnp; +unsigned i; +char *cmd; if (!meta[0]) /* we came here from jobs */ Compat_Init(); @@ -589,7 +590,12 @@ Compat_Make(void *gnp, void *pgnp) meta_job_start(NULL, gn); } #endif - Lst_ForEach(gn->commands, CompatRunCommand, gn); + for (i=0; icommands); i++) { + cmd = stringarray_get(&gn->commands, i); + if (CompatRunCommand(cmd, i, gn)) { + break; + } + } curTarg = NULL; } else { Job_Touch(gn, gn->type & OP_SILENT); Index: othersrc/usr.bin/dholland-make2/main.c diff -u othersrc/usr.bin/dholland-make2/main.c:1.6 othersrc/usr.bin/dholland-make2/main.c:1.7 --- othersrc/usr.bin/dholland-make2/main.c:1.6 Tue Mar 5 03:32:08 2013 +++ othersrc/usr.bin/dholland-make2/main.c Tue Mar 5 04:27:27 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.6 2013/03/05 03:32:08 dholland Exp $ */ +/* $NetBSD: main.c,v 1.7 2013/03/05
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Tue Mar 5 03:32:08 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: arch.c compat.c cond.c dir.c dir.h graph.h main.c make.c make.h nonints.h parse.c suff.c targ.c Log Message: more arrays; fewer lists. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 othersrc/usr.bin/dholland-make2/arch.c \ othersrc/usr.bin/dholland-make2/compat.c \ othersrc/usr.bin/dholland-make2/main.c \ othersrc/usr.bin/dholland-make2/parse.c cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/cond.c \ othersrc/usr.bin/dholland-make2/nonints.h cvs rdiff -u -r1.4 -r1.5 othersrc/usr.bin/dholland-make2/dir.c \ othersrc/usr.bin/dholland-make2/graph.h cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/dir.h cvs rdiff -u -r1.6 -r1.7 othersrc/usr.bin/dholland-make2/make.c \ othersrc/usr.bin/dholland-make2/suff.c \ othersrc/usr.bin/dholland-make2/targ.c cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/dholland-make2/make.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/arch.c diff -u othersrc/usr.bin/dholland-make2/arch.c:1.5 othersrc/usr.bin/dholland-make2/arch.c:1.6 --- othersrc/usr.bin/dholland-make2/arch.c:1.5 Tue Mar 5 01:44:34 2013 +++ othersrc/usr.bin/dholland-make2/arch.c Tue Mar 5 03:32:08 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.5 2013/03/05 01:44:34 dholland Exp $ */ +/* $NetBSD: arch.c,v 1.6 2013/03/05 03:32:08 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -137,7 +137,7 @@ #include"dir.h" #include"config.h" -MAKE_RCSID("$NetBSD: arch.c,v 1.5 2013/03/05 01:44:34 dholland Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.6 2013/03/05 03:32:08 dholland Exp $"); #ifdef TARGET_MACHINE #undef MAKE_MACHINE @@ -228,7 +228,7 @@ ArchFree(Arch *a) *--- */ ReturnStatus -Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt) +Arch_ParseArchive(char **linePtr, GList *nodeList, GNode *ctxt) { char *cp; /* Pointer into line */ GNode *gn; /* New node */ @@ -352,7 +352,7 @@ Arch_ParseArchive(char **linePtr, Lst no /* * Now form an archive spec and recurse to deal with nested * variables and multi-word variable values The results - * are just placed at the end of the nodeLst we're returning. + * are just placed at the end of the node list we're returning. */ sz = strlen(memName)+strlen(libName)+3; buf = sacrifice = bmake_malloc(sz); @@ -372,9 +372,9 @@ Arch_ParseArchive(char **linePtr, Lst no return(FAILURE); } else { gn->type |= OP_ARCHV; - (void)Lst_AtEnd(nodeLst, gn); + glist_add(nodeList, gn, NULL); } - } else if (Arch_ParseArchive(&sacrifice, nodeLst, ctxt)!=SUCCESS) { + } else if (Arch_ParseArchive(&sacrifice, nodeList, ctxt)!=SUCCESS) { /* * Error in nested call -- free buffer and return FAILURE * ourselves. @@ -387,14 +387,17 @@ Arch_ParseArchive(char **linePtr, Lst no */ free(buf); } else if (Dir_HasWildcards(memName)) { - Lst members = Lst_Init(FALSE); - char *member; + struct stringarray members; + char *member; + unsigned i; size_t sz = MAXPATHLEN, nsz; nameBuf = bmake_malloc(sz); - Dir_Expand(memName, &dirSearchPath, members); - while (!Lst_IsEmpty(members)) { - member = (char *)Lst_DeQueue(members); + stringarray_init(&members); + + Dir_Expand(memName, &dirSearchPath, &members); + for (i=0; i nsz) nameBuf = bmake_realloc(nameBuf, sz = nsz * 2); @@ -414,10 +417,11 @@ Arch_ParseArchive(char **linePtr, Lst no * end of the provided list. */ gn->type |= OP_ARCHV; - (void)Lst_AtEnd(nodeLst, gn); + glist_add(nodeList, gn, NULL); } } - Lst_Destroy(members, NULL); + stringarray_setsize(&members, 0); + stringarray_cleanup(&members); free(nameBuf); } else { size_t sz = strlen(libName) + strlen(memName) + 3; @@ -436,7 +440,7 @@ Arch_ParseArchive(char **linePtr, Lst no * provided list. */ gn->type |= OP_ARCHV; - (void)Lst_AtEnd(nodeLst, gn); + glist_add(nodeList, gn, NULL); } } if (doSubst) { Index: othersrc/usr.bin/dholland-make2/compat.c diff -u othersrc/usr.bin/dholland-make2/compat.c:1.5 othersrc/usr.bin/dholland-make2/compat.c:1.6 --- othersrc/usr.bin/dholland-make2/compat.c:1.5 Mon Mar 4 23:03:41 2013 +++ othersrc/usr.bin/dholland-make2/compat.c Tue Mar 5 03:32:08 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.5 2013/03/04 23:03:41 dholland Exp $ */ +/* $NetBSD: compat.c,v 1.6 2013/03/05 03:32:08 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -101,7 +101,7 @@ #include"job.h" #include"pathnames.h" -MA
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Tue Mar 5 01:44:35 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: arch.c cond.c dir.c dir.h main.c make.h nonints.h parse.c suff.c Log Message: Use arrays instead of lists for path searching. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 othersrc/usr.bin/dholland-make2/arch.c \ othersrc/usr.bin/dholland-make2/main.c \ othersrc/usr.bin/dholland-make2/parse.c cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/cond.c \ othersrc/usr.bin/dholland-make2/nonints.h cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/dir.c cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/dir.h cvs rdiff -u -r1.7 -r1.8 othersrc/usr.bin/dholland-make2/make.h cvs rdiff -u -r1.5 -r1.6 othersrc/usr.bin/dholland-make2/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/arch.c diff -u othersrc/usr.bin/dholland-make2/arch.c:1.4 othersrc/usr.bin/dholland-make2/arch.c:1.5 --- othersrc/usr.bin/dholland-make2/arch.c:1.4 Mon Mar 4 23:52:07 2013 +++ othersrc/usr.bin/dholland-make2/arch.c Tue Mar 5 01:44:34 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.4 2013/03/04 23:52:07 dholland Exp $ */ +/* $NetBSD: arch.c,v 1.5 2013/03/05 01:44:34 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -137,7 +137,7 @@ #include"dir.h" #include"config.h" -MAKE_RCSID("$NetBSD: arch.c,v 1.4 2013/03/04 23:52:07 dholland Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.5 2013/03/05 01:44:34 dholland Exp $"); #ifdef TARGET_MACHINE #undef MAKE_MACHINE @@ -392,7 +392,7 @@ Arch_ParseArchive(char **linePtr, Lst no size_t sz = MAXPATHLEN, nsz; nameBuf = bmake_malloc(sz); - Dir_Expand(memName, dirSearchPath, members); + Dir_Expand(memName, &dirSearchPath, members); while (!Lst_IsEmpty(members)) { member = (char *)Lst_DeQueue(members); nsz = strlen(libName) + strlen(member) + 3; @@ -1172,7 +1172,7 @@ Arch_MemMTime(GNode *gn) *--- */ void -Arch_FindLib(GNode *gn, Lst path) +Arch_FindLib(GNode *gn, const struct patharray *path) { char *libName; /* file name for archive */ size_t sz = strlen(gn->name) + 6 - 2; Index: othersrc/usr.bin/dholland-make2/main.c diff -u othersrc/usr.bin/dholland-make2/main.c:1.4 othersrc/usr.bin/dholland-make2/main.c:1.5 --- othersrc/usr.bin/dholland-make2/main.c:1.4 Mon Mar 4 08:47:08 2013 +++ othersrc/usr.bin/dholland-make2/main.c Tue Mar 5 01:44:34 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.4 2013/03/04 08:47:08 dholland Exp $ */ +/* $NetBSD: main.c,v 1.5 2013/03/05 01:44:34 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -128,7 +128,7 @@ MAKE_COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ The Regents of the University of California. All rights reserved."); -MAKE_RCSID("$NetBSD: main.c,v 1.4 2013/03/04 08:47:08 dholland Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.5 2013/03/05 01:44:34 dholland Exp $"); #ifndef DEFMAXLOCAL @@ -510,9 +510,9 @@ rearg: if (!Dir_FindHereOrAbove(curdir, argvalue+4, found_path, sizeof(found_path))) break; /* nothing doing */ -(void)Dir_AddDir(sysIncPath, found_path); +(void)Dir_AddDir(&sysIncPath, found_path); } else { -(void)Dir_AddDir(sysIncPath, argvalue); +(void)Dir_AddDir(&sysIncPath, argvalue); } Var_Append(MAKEFLAGS, "-m", VAR_GLOBAL); Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL); @@ -1080,11 +1080,11 @@ main(int argc, char **argv) } /* look for magic parent directory search string */ if (strncmp(".../", start, 4) != 0) { - (void)Dir_AddDir(defIncPath, start); + (void)Dir_AddDir(&defIncPath, start); } else { if (Dir_FindHereOrAbove(curdir, start+4, found_path, sizeof(found_path))) { -(void)Dir_AddDir(defIncPath, found_path); +(void)Dir_AddDir(&defIncPath, found_path); } } } @@ -1101,7 +1101,7 @@ main(int argc, char **argv) sysMkPath = Lst_Init(FALSE); Dir_Expand(_PATH_DEFSYSMK, - Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath, + patharray_num(&sysIncPath) == 0 ? &defIncPath : &sysIncPath, sysMkPath); if (Lst_IsEmpty(sysMkPath)) Fatal("%s: no system rules (%s).", progname, @@ -1178,7 +1178,7 @@ main(int argc, char **argv) savec = *cp; *cp = '\0'; /* Add directory to search path */ - (void)Dir_AddDir(dirSearchPath, path); + (void)Dir_AddDir(&dirSearchPath, path); *cp = savec; path = cp + 1; } while (savec == ':'); @@ -1349,10 +1349,10 @@ ReadMakefile(const void *p, const void * goto found; } /* look in -I and system include directories. */ - name = Dir_FindFile(fname, parseIncPath); + name = Dir_FindFile(fname, &parseIncPath); if (!name) name = Dir_FindFile(fname, -Lst_IsEm
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Mar 4 23:52:07 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: arch.c Log Message: Use arrays, not lists. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/arch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/arch.c diff -u othersrc/usr.bin/dholland-make2/arch.c:1.3 othersrc/usr.bin/dholland-make2/arch.c:1.4 --- othersrc/usr.bin/dholland-make2/arch.c:1.3 Mon Mar 4 23:03:41 2013 +++ othersrc/usr.bin/dholland-make2/arch.c Mon Mar 4 23:52:07 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.3 2013/03/04 23:03:41 dholland Exp $ */ +/* $NetBSD: arch.c,v 1.4 2013/03/04 23:52:07 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -137,8 +137,7 @@ #include"dir.h" #include"config.h" -MAKE_RCSID("$NetBSD: arch.c,v 1.3 2013/03/04 23:03:41 dholland Exp $"); - +MAKE_RCSID("$NetBSD: arch.c,v 1.4 2013/03/04 23:52:07 dholland Exp $"); #ifdef TARGET_MACHINE #undef MAKE_MACHINE @@ -149,8 +148,6 @@ MAKE_RCSID("$NetBSD: arch.c,v 1.3 2013/0 #define MAKE_MACHINE_ARCH TARGET_MACHINE_ARCH #endif -static Lst archives; /* Lst of archives we've already examined */ - typedef struct Arch { char *name; /* Name of archive */ Hash_Table members;/* All the members of the archive described @@ -159,10 +156,10 @@ typedef struct Arch { size_t fnamesize; /* Size of the string table */ } Arch; -static int ArchFindArchive(const void *, const void *); -#ifdef CLEANUP -static void ArchFree(void *); -#endif +DECLARRAY_BYTYPE(archlist, struct Arch, static); +DEFARRAY_BYTYPE(archlist, struct Arch, MAKE_ATTR_UNUSED static); +typedef struct archlist ArchList; + static struct ar_hdr *ArchStatMember(char *, char *, Boolean); static FILE *ArchFindMember(char *, char *, struct ar_hdr *, const char *); #if defined(__svr4__) || defined(__SVR4) || defined(__ELF__) @@ -170,6 +167,9 @@ static FILE *ArchFindMember(char *, char static int ArchSVR4Entry(Arch *, char *, size_t, FILE *); #endif +/* Archives we've already examined */ +static ArchList archives; + #ifdef CLEANUP /*- *--- @@ -185,9 +185,8 @@ static int ArchSVR4Entry(Arch *, char *, *--- */ static void -ArchFree(void *ap) +ArchFree(Arch *a) { -Arch *a = (Arch *)ap; Hash_Search search; Hash_Entry *entry; @@ -206,7 +205,6 @@ ArchFree(void *ap) #endif - /*- *--- * Arch_ParseArchive -- @@ -470,26 +468,34 @@ Arch_ParseArchive(char **linePtr, Lst no /*- *--- - * ArchFindArchive -- - * See if the given archive is the one we are looking for. Called - * From ArchStatMember and ArchFindMember via Lst_Find. + * FindArchive -- + * Find an archive by name. Called from ArchStatMember. * * Input: - * ar Current list element - * archName Name we want + * name Name we want * * Results: - * 0 if it is, non-zero if it isn't. + * The archive, or NULL if it doesn't exist. * * Side Effects: * None. * *--- */ -static int -ArchFindArchive(const void *ar, const void *archName) +static Arch * +FindArchive(const char *name) { -return (strcmp(archName, ((const Arch *)ar)->name)); + unsigned i, num; + Arch *a; + + num = archlist_num(&archives); + for (i=0; iname)) { + return a; + } + } + return NULL; } /*- @@ -523,7 +529,6 @@ ArchStatMember(char *archive, char *memb int size; /* Size of archive member */ char *cp; /* Useful character pointer */ char magic[SARMAG]; -LstNode ln; /* Lst member containing archive descriptor */ Arch *ar; /* Archive descriptor */ Hash_Entry *he; /* Entry containing member's description */ struct ar_hdr arh;/* archive-member header for reading archive */ @@ -541,10 +546,8 @@ ArchStatMember(char *archive, char *memb member = cp + 1; } -ln = Lst_Find(archives, archive, ArchFindArchive); -if (ln != NULL) { - ar = (Arch *)Lst_Datum(ln); - +ar = FindArchive(archive); +if (ar != NULL) { he = Hash_FindEntry(&ar->members, member); if (he != NULL) { @@ -688,7 +691,7 @@ ArchStatMember(char *archive, char *memb fclose(arch); -(void)Lst_AtEnd(archives, ar); +archlist_add(&archives, ar, NULL); /* * Now that the archive has been read and cached, we can look into @@ -1286,7 +1289,7 @@ Arch_LibOODate(GNode *gn) void Arch_Init(void) { -archives = Lst_Init(FALSE); +archlist_init(&archives); } @@ -1308,7 +1311,13 @@ voi
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Mar 4 23:31:57 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: make.c make.h targ.c Log Message: Use (far) fewer void pointers now that we're free of that list library. Also drop meaningless always-zero integer return values that the list library needed for its function pointers. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 othersrc/usr.bin/dholland-make2/make.c \ othersrc/usr.bin/dholland-make2/targ.c cvs rdiff -u -r1.6 -r1.7 othersrc/usr.bin/dholland-make2/make.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/make.c diff -u othersrc/usr.bin/dholland-make2/make.c:1.5 othersrc/usr.bin/dholland-make2/make.c:1.6 --- othersrc/usr.bin/dholland-make2/make.c:1.5 Mon Mar 4 23:03:42 2013 +++ othersrc/usr.bin/dholland-make2/make.c Mon Mar 4 23:31:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.5 2013/03/04 23:03:42 dholland Exp $ */ +/* $NetBSD: make.c,v 1.6 2013/03/04 23:31:57 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include"dir.h" #include"job.h" -MAKE_RCSID("$NetBSD: make.c,v 1.5 2013/03/04 23:03:42 dholland Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.6 2013/03/04 23:31:57 dholland Exp $"); static unsigned int checked = 1;/* Sequence # to detect recursion */ static Lst toBeMade; /* The current fringe of the graph. These @@ -120,18 +120,17 @@ static Lst toBeMade; /* The current * Make_Update and subtracted from by * MakeStartJobs */ -static int MakeAddChild2(void *, void *); -static int MakeFindChild(void *, void *); -static int MakeUnmark(void *, void *); -static int MakeAddAllSrc(void *, void *); -static int MakeTimeStamp(void *, void *); -static int MakeHandleUse(void *, void *); +static void MakeAddChild(GNode *, GList *); +static void MakeFindChild(GNode *, GNode *); +static void MakeUnmark(GNode *); +static void MakeAddAllSrc(GNode *, GNode *); +static void MakeHandleUse(GNode *, GNode *); static Boolean MakeStartJobs(void); -static int MakePrintStatus(void *, void *); -static int MakeCheckOrder(void *, void *); +static int MakePrintStatus(GNode *, int *); +static int MakeCheckOrder(GNode *); static int DoMakeCheckOrder(GList *); -static int MakeBuildChild(void *, void *); -static int MakeBuildParent(void *, void *); +static int MakeBuildChild(GNode *, LstNode); +static void MakeBuildParent(GNode *, LstNode); MAKE_ATTR_DEAD static void make_abort(GNode *gn, int line) @@ -156,33 +155,21 @@ make_abort(GNode *gn, int line) * cgn the child we've just examined * * Results: - * Always returns 0. + * None * * Side Effects: * The cmgn of the parent node will be changed if the mtime * field of the child is greater than it. *--- */ -int +void Make_TimeStamp(GNode *pgn, GNode *cgn) { if (pgn->cmgn == NULL || cgn->mtime > pgn->cmgn->mtime) { pgn->cmgn = cgn; } -return (0); } -/* - * Input: - * pgn the current parent - * cgn the child we've just examined - * - */ -static int -MakeTimeStamp(void *pgn, void *cgn) -{ -return Make_TimeStamp((GNode *)pgn, (GNode *)cgn); -} /*- *--- @@ -342,7 +329,7 @@ Make_OODate(GNode *gn) unsigned i; for (i=0; iparents); i++) { - MakeTimeStamp(glist_get(&gn->parents, i), gn); + Make_TimeStamp(glist_get(&gn->parents, i), gn); } } @@ -354,51 +341,28 @@ Make_OODate(GNode *gn) * MakeAddChild -- * Function used by Make_Run to add a child to the list l. * It will only add the child if its make field is FALSE. - * MakeAddChild2 -- - * Same but lp is a GList, not a Lst. * * Input: * gnp the node to add * lp the list to which to add it * * Results: - * Always returns 0 + * None * * Side Effects: * The given list is extended *--- */ -#if 0 -static int -MakeAddChild(void *gnp, void *lp) -{ -GNode *gn = (GNode *)gnp; -Lstl = (Lst) lp; -if ((gn->flags & REMAKE) == 0 && !(gn->type & (OP_USE|OP_USEBEFORE))) { - if (DEBUG(MAKE)) - fprintf(debug_file, "MakeAddChild: need to examine %s%s\n", - gn->name, gn->cohort_num); - (void)Lst_EnQueue(l, gn); -} -return (0); -} -#endif - -/* array variant */ -static int -MakeAddChild2(void *gnp, void *lp) +static void +MakeAddChild(GNode *gn, GList *l) { -GNode *gn = (GNode *)gnp; -GList *l = lp; - if ((gn->flags & REMAKE) == 0 && !(gn->type & (OP_USE|OP_USEBEFORE))) { if (DEBUG(MAKE)) fprintf(debug_file, "MakeAddChild: need to examine %s%s\n", gn->name, gn->cohort_num); glist_add(l, gn, NULL); } -return (0); } /*- @@ -408,27 +372,23 @
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Mar 4 23:03:42 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: arch.c compat.c graph.h job.c make.c parse.c suff.c targ.c Log Message: Use arrays instead of lists for graph links. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/arch.c \ othersrc/usr.bin/dholland-make2/job.c cvs rdiff -u -r1.4 -r1.5 othersrc/usr.bin/dholland-make2/compat.c \ othersrc/usr.bin/dholland-make2/make.c \ othersrc/usr.bin/dholland-make2/suff.c \ othersrc/usr.bin/dholland-make2/targ.c cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/graph.h \ othersrc/usr.bin/dholland-make2/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/arch.c diff -u othersrc/usr.bin/dholland-make2/arch.c:1.2 othersrc/usr.bin/dholland-make2/arch.c:1.3 --- othersrc/usr.bin/dholland-make2/arch.c:1.2 Mon Feb 25 03:39:28 2013 +++ othersrc/usr.bin/dholland-make2/arch.c Mon Mar 4 23:03:41 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.2 2013/02/25 03:39:28 dholland Exp $ */ +/* $NetBSD: arch.c,v 1.3 2013/03/04 23:03:41 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -137,7 +137,7 @@ #include"dir.h" #include"config.h" -MAKE_RCSID("$NetBSD: arch.c,v 1.2 2013/02/25 03:39:28 dholland Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.3 2013/03/04 23:03:41 dholland Exp $"); #ifdef TARGET_MACHINE @@ -1105,17 +1105,16 @@ Arch_MTime(GNode *gn) time_t Arch_MemMTime(GNode *gn) { -LstNode ln; GNode *pgn; char *nameStart, *nameEnd; +unsigned i; -if (Lst_Open(gn->parents) != SUCCESS) { - gn->mtime = 0; - return (0); -} -while ((ln = Lst_Next(gn->parents)) != NULL) { - pgn = (GNode *)Lst_Datum(ln); +/* by default, in case parents[] is empty (I think) */ +gn->mtime = 0; + +for (i=0; iparents); i++) { + pgn = glist_get(&gn->parents, i); if (pgn->type & OP_ARCHV) { /* @@ -1142,8 +1141,6 @@ Arch_MemMTime(GNode *gn) } } -Lst_Close(gn->parents); - return (gn->mtime); } @@ -1237,9 +1234,9 @@ Arch_LibOODate(GNode *gn) if (gn->type & OP_PHONY) { oodate = TRUE; -} else if (OP_NOP(gn->type) && Lst_IsEmpty(gn->children)) { +} else if (OP_NOP(gn->type) && glist_num(&gn->children) == 0) { oodate = FALSE; -} else if ((!Lst_IsEmpty(gn->children) && gn->cmgn == NULL) || +} else if ((glist_num(&gn->children) > 0 && gn->cmgn == NULL) || (gn->mtime > now) || (gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime)) { oodate = TRUE; Index: othersrc/usr.bin/dholland-make2/job.c diff -u othersrc/usr.bin/dholland-make2/job.c:1.2 othersrc/usr.bin/dholland-make2/job.c:1.3 --- othersrc/usr.bin/dholland-make2/job.c:1.2 Mon Feb 25 03:39:28 2013 +++ othersrc/usr.bin/dholland-make2/job.c Mon Mar 4 23:03:42 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.2 2013/02/25 03:39:28 dholland Exp $ */ +/* $NetBSD: job.c,v 1.3 2013/03/04 23:03:42 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -149,7 +149,7 @@ #include "trace.h" # define STATIC static -MAKE_RCSID("$NetBSD: job.c,v 1.2 2013/02/25 03:39:28 dholland Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.3 2013/03/04 23:03:42 dholland Exp $"); /* * error handling variables @@ -1193,7 +1193,7 @@ Boolean Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...)) { if (OP_NOP(gn->type) && Lst_IsEmpty(gn->commands) && - ((gn->type & OP_LIB) == 0 || Lst_IsEmpty(gn->children))) { + ((gn->type & OP_LIB) == 0 || glist_num(&gn->children) == 0)) { /* * No commands. Look for .DEFAULT rule from which we might infer * commands @@ -2585,7 +2585,7 @@ Job_Finish(void) { if (postCommands != NULL && (!Lst_IsEmpty(postCommands->commands) || - !Lst_IsEmpty(postCommands->children))) { + glist_num(&postCommands->children) > 0)) { if (errors) { Error("Errors reported so .END ignored"); } else { Index: othersrc/usr.bin/dholland-make2/compat.c diff -u othersrc/usr.bin/dholland-make2/compat.c:1.4 othersrc/usr.bin/dholland-make2/compat.c:1.5 --- othersrc/usr.bin/dholland-make2/compat.c:1.4 Mon Mar 4 08:47:08 2013 +++ othersrc/usr.bin/dholland-make2/compat.c Mon Mar 4 23:03:41 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.4 2013/03/04 08:47:08 dholland Exp $ */ +/* $NetBSD: compat.c,v 1.5 2013/03/04 23:03:41 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -101,7 +101,7 @@ #include"job.h" #include"pathnames.h" -MAKE_RCSID("$NetBSD: compat.c,v 1.4 2013/03/04 08:47:08 dholland Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.5 2013/03/04 23:03:41 dholland Exp $"); /* * The following array is used to make a fast determination of which @@ -512,7 +512,13 @@ Compat_Ma
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Mar 4 08:47:09 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: array.c array.h compat.c graph.h main.c make.c nonints.h parse.c suff.c targ.c Log Message: Use more arrays and fewer lists. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/array.c \ othersrc/usr.bin/dholland-make2/graph.h \ othersrc/usr.bin/dholland-make2/parse.c cvs rdiff -u -r1.4 -r1.5 othersrc/usr.bin/dholland-make2/array.h cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/compat.c \ othersrc/usr.bin/dholland-make2/main.c \ othersrc/usr.bin/dholland-make2/make.c \ othersrc/usr.bin/dholland-make2/suff.c \ othersrc/usr.bin/dholland-make2/targ.c cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/nonints.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/array.c diff -u othersrc/usr.bin/dholland-make2/array.c:1.2 othersrc/usr.bin/dholland-make2/array.c:1.3 --- othersrc/usr.bin/dholland-make2/array.c:1.2 Mon Mar 4 07:27:54 2013 +++ othersrc/usr.bin/dholland-make2/array.c Mon Mar 4 08:47:08 2013 @@ -31,6 +31,9 @@ #include #include "portable.h" +/* XXX this should go away */ +#include "lst.h" + #define ARRAYINLINE #include "array.h" @@ -159,3 +162,36 @@ array_removeval(struct array *a, void *v array_remove(a, ix); } } + + +// tools for interfacing with lst.lib + +static int +Lst_AddToArray(void *p, void *arrv) +{ + struct array *arr = arrv; + + array_add(arr, p, NULL); + return 0; +} + +void +Lst_IntoArray(Lst list, struct array *arr) +{ + Lst_ForEach(list, Lst_AddToArray, arr); +} + +Lst +LstFromArray(struct array *arr) +{ + Lst ret; + unsigned i; + void *p; + + ret = Lst_Init(FALSE); + for (i=0; itype & OP_DOUBLEDEP) && !Lst_IsEmpty (pgn->cohorts)) - pgn = (GNode *)Lst_Datum(Lst_Last(pgn->cohorts)); +if ((pgn->type & OP_DOUBLEDEP) && glist_num(&pgn->cohorts) > 0) { + pgn = glist_get(&pgn->cohorts, glist_num(&pgn->cohorts) - 1); +} (void)Lst_AtEnd(pgn->children, cgn); if (specType == Not) (void)Lst_AtEnd(cgn->parents, pgn); @@ -906,7 +907,7 @@ ParseDoOp(void *gnp, void *opp) * traversals will no longer see this node anyway. -mycroft) */ cohort->type = op | OP_INVISIBLE; - (void)Lst_AtEnd(gn->cohorts, cohort); + glist_add(&gn->cohorts, cohort, NULL); cohort->centurion = gn; gn->unmade_cohorts += 1; snprintf(cohort->cohort_num, sizeof cohort->cohort_num, "#%d", @@ -1941,8 +1942,9 @@ ParseAddCmd(void *gnp, void *cmd) GNode *gn = (GNode *)gnp; /* Add to last (ie current) cohort for :: targets */ -if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (gn->cohorts)) - gn = (GNode *)Lst_Datum(Lst_Last(gn->cohorts)); +if ((gn->type & OP_DOUBLEDEP) && glist_num(&gn->cohorts) > 0) { + gn = glist_get(&gn->cohorts, glist_num(&gn->cohorts) - 1); +} /* if target already supplied, ignore commands */ if (!(gn->type & OP_HAS_COMMANDS)) { @@ -3055,35 +3057,34 @@ Parse_End(void) /*- *--- * Parse_MainName -- - * Return a Lst of the main target to create for main()'s sake. If - * no such target exists, we Punt with an obnoxious error message. + * Fill a GList with the the main target to create for main()'s + * sake. If no such target exists, we Punt with an obnoxious + * error message. * * Results: - * A Lst of the single node to create. + * The argument GList is filled in. * * Side Effects: * None. * *--- */ -Lst -Parse_MainName(void) +void +Parse_MainName(GList *mainList) { -Lst mainList; /* result list */ - -mainList = Lst_Init(FALSE); +unsigned i; if (mainNode == NULL) { Punt("no target to make."); /*NOTREACHED*/ -} else if (mainNode->type & OP_DOUBLEDEP) { - (void)Lst_AtEnd(mainList, mainNode); - Lst_Concat(mainList, mainNode->cohorts, LST_CONCNEW); } -else - (void)Lst_AtEnd(mainList, mainNode); +glist_add(mainList, mainNode, NULL); +if (mainNode->type & OP_DOUBLEDEP) { + for (i=0; icohorts); i++) { + glist_add(mainList, glist_get(&mainNode->cohorts, i), NULL); + } +} Var_Append(".TARGETS", mainNode->name, VAR_GLOBAL); -return (mainList); } /*- Index: othersrc/usr.bin/dholland-make2/array.h diff -u othersrc/usr.bin/dholland-make2/array.h:1.4 othersrc/usr.bin/dholland-make2/array.h:1.5 --- othersrc/usr.bin/dholland-make2/array.h:1.4 Mon Mar 4 07:27:54 2013 +++ othersrc/usr.bin/dholland-make2/array.h Mon Mar 4 08:47:08 2013 @@ -290,4 +290,12 @@ array_add(struct array *a, void *val, un DECLARRAY_BYTYPE(stringarray, char, ARRAYINLINE); DEFARRAY_BYTYPE(stringarray, char, ARRAYINLINE);
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Mar 4 07:28:45 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: compat.c dir.c graph.h make.c suff.c targ.c Log Message: Use array.h instead of the list library for one of the lists in the graph node structure. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/compat.c \ othersrc/usr.bin/dholland-make2/dir.c \ othersrc/usr.bin/dholland-make2/make.c \ othersrc/usr.bin/dholland-make2/suff.c \ othersrc/usr.bin/dholland-make2/targ.c cvs rdiff -u -r1.1 -r1.2 othersrc/usr.bin/dholland-make2/graph.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/compat.c diff -u othersrc/usr.bin/dholland-make2/compat.c:1.2 othersrc/usr.bin/dholland-make2/compat.c:1.3 --- othersrc/usr.bin/dholland-make2/compat.c:1.2 Mon Feb 25 03:39:28 2013 +++ othersrc/usr.bin/dholland-make2/compat.c Mon Mar 4 07:28:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.2 2013/02/25 03:39:28 dholland Exp $ */ +/* $NetBSD: compat.c,v 1.3 2013/03/04 07:28:45 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -101,7 +101,7 @@ #include"job.h" #include"pathnames.h" -MAKE_RCSID("$NetBSD: compat.c,v 1.2 2013/02/25 03:39:28 dholland Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.3 2013/03/04 07:28:45 dholland Exp $"); /* * The following array is used to make a fast determination of which @@ -519,7 +519,7 @@ Compat_Make(void *gnp, void *pgnp) goto cohorts; } - if (Lst_Member(gn->iParents, pgn) != NULL) { + if (glist_contains(&gn->iParents, pgn)) { char *p1; Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); if (p1) @@ -623,7 +623,7 @@ Compat_Make(void *gnp, void *pgnp) */ pgn->flags &= ~REMAKE; } else { - if (Lst_Member(gn->iParents, pgn) != NULL) { + if (glist_contains(&gn->iParents, pgn)) { char *p1; Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); if (p1) Index: othersrc/usr.bin/dholland-make2/dir.c diff -u othersrc/usr.bin/dholland-make2/dir.c:1.2 othersrc/usr.bin/dholland-make2/dir.c:1.3 --- othersrc/usr.bin/dholland-make2/dir.c:1.2 Mon Feb 25 03:39:28 2013 +++ othersrc/usr.bin/dholland-make2/dir.c Mon Mar 4 07:28:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.2 2013/02/25 03:39:28 dholland Exp $ */ +/* $NetBSD: dir.c,v 1.3 2013/03/04 07:28:45 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -137,7 +137,7 @@ #include "hash.h" #include "dir.h" -__RCSID("$NetBSD: dir.c,v 1.2 2013/02/25 03:39:28 dholland Exp $"); +__RCSID("$NetBSD: dir.c,v 1.3 2013/03/04 07:28:45 dholland Exp $"); /* * A search path consists of a Lst of Path structures. A Path structure @@ -1438,7 +1438,7 @@ Dir_MTime(GNode *gn, Boolean recheck) else { fullName = Dir_FindFile(gn->name, Suff_FindPath(gn)); if (fullName == NULL && gn->flags & FROM_DEPEND && - !Lst_IsEmpty(gn->iParents)) { + glist_num(&gn->iParents) > 0) { char *cp; cp = strrchr(gn->name, '/'); Index: othersrc/usr.bin/dholland-make2/make.c diff -u othersrc/usr.bin/dholland-make2/make.c:1.2 othersrc/usr.bin/dholland-make2/make.c:1.3 --- othersrc/usr.bin/dholland-make2/make.c:1.2 Mon Feb 25 03:39:28 2013 +++ othersrc/usr.bin/dholland-make2/make.c Mon Mar 4 07:28:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.2 2013/02/25 03:39:28 dholland Exp $ */ +/* $NetBSD: make.c,v 1.3 2013/03/04 07:28:45 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include"dir.h" #include"job.h" -MAKE_RCSID("$NetBSD: make.c,v 1.2 2013/02/25 03:39:28 dholland Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.3 2013/03/04 07:28:45 dholland Exp $"); static unsigned int checked = 1;/* Sequence # to detect recursion */ static Lst toBeMade; /* The current fringe of the graph. These @@ -820,11 +820,12 @@ Make_Update(GNode *cgn) * Set the .PREFIX and .IMPSRC variables for all the implied parents * of this node. */ -if (Lst_Open(cgn->iParents) == SUCCESS) { +/*if (Lst_Open(cgn->iParents) == SUCCESS)*/ { char *cpref = Var_Value(PREFIX, cgn, &p1); + unsigned i; - while ((ln = Lst_Next(cgn->iParents)) != NULL) { - pgn = (GNode *)Lst_Datum(ln); + for (i=0; iiParents); i++) { + pgn = glist_get(&cgn->iParents, i); if (pgn->flags & REMAKE) { Var_Set(IMPSRC, cname, pgn, 0); if (cpref != NULL) @@ -833,7 +834,7 @@ Make_Update(GNode *cgn) } if (p1) free(p1); - Lst_Close(cgn->iParents); + /*Lst_Close(cgn->iParents);*/ } } Index: othersrc/usr.bin/dholland-make2/suff.c diff -u othersrc/usr.bin/dholland-make2/suff.c:1.2 othersrc/usr.bin/dholland-make2/suff.c:1.3 --- othersrc/usr.bin/dholland-make2/suff.c:1.2 Mon Feb 25 03:39:28 2013 +++ othersrc/usr.bin/dholla
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Mar 4 07:27:54 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: array.c array.h Log Message: add a couple more array ops we look likely to use a lot To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 othersrc/usr.bin/dholland-make2/array.c cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/array.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/array.c diff -u othersrc/usr.bin/dholland-make2/array.c:1.1 othersrc/usr.bin/dholland-make2/array.c:1.2 --- othersrc/usr.bin/dholland-make2/array.c:1.1 Mon Mar 4 05:47:15 2013 +++ othersrc/usr.bin/dholland-make2/array.c Mon Mar 4 07:27:54 2013 @@ -71,6 +71,32 @@ array_cleanup(struct array *a) } int +array_contains(struct array *a, void *val) +{ + unsigned i; + + for (i=0; inum; i++) { + if (a->v[i] == val) { + return 1; + } + } + return 0; +} + +unsigned +array_find(struct array *a, void *val) +{ + unsigned i; + + for (i=0; inum; i++) { + if (a->v[i] == val) { + return i; + } + } + return ARRAY_NOTFOUND; +} + +int array_setsize(struct array *a, unsigned num) { unsigned newmax; @@ -122,3 +148,14 @@ array_remove(struct array *a, unsigned i memmove(a->v + index_, a->v + index_+1, movers*sizeof(*a->v)); a->num--; } + +void +array_removeval(struct array *a, void *val) +{ + unsigned ix; + + ix = array_find(a, val); + if (ix != ARRAY_NOTFOUND) { + array_remove(a, ix); + } +} Index: othersrc/usr.bin/dholland-make2/array.h diff -u othersrc/usr.bin/dholland-make2/array.h:1.3 othersrc/usr.bin/dholland-make2/array.h:1.4 --- othersrc/usr.bin/dholland-make2/array.h:1.3 Mon Mar 4 06:48:03 2013 +++ othersrc/usr.bin/dholland-make2/array.h Mon Mar 4 07:27:54 2013 @@ -58,10 +58,16 @@ void array_cleanup(struct array *); ARRAYINLINE unsigned array_num(const struct array *); ARRAYINLINE void *array_get(const struct array *, unsigned index_); ARRAYINLINE void array_set(const struct array *, unsigned index_, void *val); +int array_contains(struct array *, void *val); +unsigned array_find(struct array *, void *val); int array_setsize(struct array *, unsigned num); ARRAYINLINE int array_add(struct array *, void *val, unsigned *index_ret); int array_insert(struct array *a, unsigned index_); void array_remove(struct array *a, unsigned index_); +void array_removeval(struct array *a, void *val); + +/* failure return for array_find() */ +#define ARRAY_NOTFOUND ((unsigned)-1) // inlining for base operations @@ -173,10 +179,13 @@ array_add(struct array *a, void *val, un INLINE unsigned ARRAY##_num(const struct ARRAY *a); \ INLINE T *ARRAY##_get(const struct ARRAY *a, unsigned index_); \ INLINE void ARRAY##_set(struct ARRAY *a, unsigned index_, T *val); \ + INLINE int ARRAY##_contains(struct ARRAY *a, T *val); \ + INLINE unsigned ARRAY##_find(struct ARRAY *a, T *val); \ INLINE int ARRAY##_setsize(struct ARRAY *a, unsigned num); \ INLINE int ARRAY##_add(struct ARRAY *a, T *val, unsigned *index_ret); \ INLINE int ARRAY##_insert(struct ARRAY *a, unsigned index_); \ - INLINE void ARRAY##_remove(struct ARRAY *a, unsigned index_) + INLINE void ARRAY##_remove(struct ARRAY *a, unsigned index_); \ + INLINE void ARRAY##_removeval(struct ARRAY *a, T *val) #define DEFARRAY_BYTYPE(ARRAY, T, INLINE) \ @@ -231,6 +240,18 @@ array_add(struct array *a, void *val, un } \ \ INLINE int \ + ARRAY##_contains(struct ARRAY *a, T *val) \ + { \ + return array_contains(&a->arr, val); \ + } \ +\ + INLINE unsigned \ + ARRAY##_find(struct ARRAY *a, T *val) \ + { \ + return array_find(&a->arr, val); \ + } \ +\ + INLINE int \ ARRAY##_setsize(struct ARRAY *a, unsigned num) \ { \ return array_setsize(&a->arr, num); \ @@ -252,6 +273,12 @@ array_add(struct array *a, void *val, un ARRAY##_remove(struct ARRAY *a, unsigned index_) \ { \ return array_remove(&a->arr, index_); \ + } \ +\ + INLINE void \ + ARRAY##_removeval(struct ARRAY *a, T *val) \ + { \ + return array_removeval(&a->arr, val); \ } #define DECLARRAY(T, INLINE) DECLARRAY_BYTYPE(T##array, struct T, INLINE)
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Mar 4 06:48:03 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: array.h Log Message: fail, try again. blah To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/array.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/array.h diff -u othersrc/usr.bin/dholland-make2/array.h:1.2 othersrc/usr.bin/dholland-make2/array.h:1.3 --- othersrc/usr.bin/dholland-make2/array.h:1.2 Mon Mar 4 06:45:23 2013 +++ othersrc/usr.bin/dholland-make2/array.h Mon Mar 4 06:48:03 2013 @@ -254,7 +254,7 @@ array_add(struct array *a, void *val, un return array_remove(&a->arr, index_); \ } -#define DECLARRAY(T) DECLARRAY_BYTYPE(T##array, struct T) +#define DECLARRAY(T, INLINE) DECLARRAY_BYTYPE(T##array, struct T, INLINE) #define DEFARRAY(T, INLINE) DEFARRAY_BYTYPE(T##array, struct T, INLINE)
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Mar 4 06:45:23 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: array.h Log Message: Improve inline handling. This will probably need more improving as I think it needs to support a no inlining at all mode for the tools build. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 othersrc/usr.bin/dholland-make2/array.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/array.h diff -u othersrc/usr.bin/dholland-make2/array.h:1.1 othersrc/usr.bin/dholland-make2/array.h:1.2 --- othersrc/usr.bin/dholland-make2/array.h:1.1 Mon Mar 4 05:47:15 2013 +++ othersrc/usr.bin/dholland-make2/array.h Mon Mar 4 06:45:23 2013 @@ -39,6 +39,10 @@ #define arrayassert(x) ((void)(x)) #endif +#ifndef ARRAYINLINE +#define ARRAYINLINE MAKE_INLINE +#endif + // type and base operations @@ -51,21 +55,17 @@ struct array *array_create(void); void array_destroy(struct array *); void array_init(struct array *); void array_cleanup(struct array *); -unsigned array_num(const struct array *); -void *array_get(const struct array *, unsigned index_); -void array_set(const struct array *, unsigned index_, void *val); +ARRAYINLINE unsigned array_num(const struct array *); +ARRAYINLINE void *array_get(const struct array *, unsigned index_); +ARRAYINLINE void array_set(const struct array *, unsigned index_, void *val); int array_setsize(struct array *, unsigned num); -int array_add(struct array *, void *val, unsigned *index_ret); +ARRAYINLINE int array_add(struct array *, void *val, unsigned *index_ret); int array_insert(struct array *a, unsigned index_); void array_remove(struct array *a, unsigned index_); // inlining for base operations -#ifndef ARRAYINLINE -#define ARRAYINLINE MAKE_INLINE -#endif - ARRAYINLINE unsigned array_num(const struct array *a) { @@ -106,50 +106,77 @@ array_add(struct array *a, void *val, un /* * Usage: * - * DECLARRAY_BYTYPE(foo, bar) declares "struct foo", which is + * DECLARRAY_BYTYPE(foo, bar, INLINE) declares "struct foo", which is * an array of pointers to "bar", plus the operations on it. * - * DECLARRAY(foo) is equivalent to DECLARRAY_BYTYPE(fooarray, struct foo). + * DECLARRAY(foo, INLINE) is equivalent to + * DECLARRAY_BYTYPE(fooarray, struct foo, INLINE). * * DEFARRAY_BYTYPE and DEFARRAY are the same as DECLARRAY except that - * they define the operations, and both take an extra argument INLINE. - * For C99 this should be INLINE in header files and empty in the - * master source file, the same as the usage of ARRAYINLINE above and - * in array.c. - * - * Example usage in e.g. item.h of some game: - * - * DECLARRAY_BYTYPE(stringarray, char); - * DECLARRAY(potion); - * DECLARRAY(sword); - * - * #ifndef ITEMINLINE - * #define ITEMINLINE INLINE - * #endif - * - * DEFARRAY_BYTYPE(stringarray, char, ITEMINLINE); - * DEFARRAY(potion, ITEMINLINE); - * DEFARRAY(sword, ITEMINLINE); + * they define the operations. + * + * The argument INLINE can be used as follows: * - * Then item.c would do "#define ITEMINLINE" before including item.h. + * 1. For no inlining: + *In foo.h: + * DECLARRAY(foo, ); + *In foo.c: + * DEFARRAY(foo, ); + * + * 2. To be file-static: + *In foo.c: + * DECLARRAY(foo, static); + * DEFARRAY(foo, static); + * + * 3. To inline using C99: + *In foo.h: + * DECLARRAY(foo, inline); + * DEFARRAY(foo, inline); + * + * 4. To inline with old gcc: + *In foo.h: + * #ifndef FOO_INLINE + * #define FOO_INLINE extern inline + * #endif + * DECLARRAY(foo, ); + * DEFARRAY(foo, FOO_INLINE); + *In foo.c: + * #define FOO_INLINE + * #include "foo.h" + * + * 5. To inline such that it works both with old gcc and C99: + *In foo.h: + * #ifndef FOO_INLINE + * #define FOO_INLINE extern inline + * #endif + * DECLARRAY(foo, FOO_INLINE); + * DEFARRAY(foo, FOO_INLINE); + *In foo.c: + * #define FOO_INLINE + * #include "foo.h" + * + * The mechanism in case (4) ensures that an externally linkable + * definition exists. There appears to be no need for this in C99; + * however, providing inline definitions does not work unless the + * declaration also contains inline. */ -#define DECLARRAY_BYTYPE(ARRAY, T) \ - struct ARRAY { \ - struct array arr;\ - }; \ -\ - struct ARRAY *ARRAY##_create(void); \ - void ARRAY##_destroy(struct ARRAY *a); \ - void ARRAY##_init(struct ARRAY *a); \ - void ARRAY##_cleanup(struct ARRAY *a); \ - unsigned ARRAY##_num(const struct ARRAY *a); \ - T *ARRAY##_get(const struct ARRAY
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Mar 4 05:50:49 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: make.h Added Files: othersrc/usr.bin/dholland-make2: graph.h Log Message: Move the graph data structure to its own header file. Expose it everywhere for now; I'll worry about reducing depends later. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 othersrc/usr.bin/dholland-make2/graph.h cvs rdiff -u -r1.5 -r1.6 othersrc/usr.bin/dholland-make2/make.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/make.h diff -u othersrc/usr.bin/dholland-make2/make.h:1.5 othersrc/usr.bin/dholland-make2/make.h:1.6 --- othersrc/usr.bin/dholland-make2/make.h:1.5 Mon Feb 25 03:45:27 2013 +++ othersrc/usr.bin/dholland-make2/make.h Mon Mar 4 05:50:49 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.5 2013/02/25 03:45:27 dholland Exp $ */ +/* $NetBSD: make.h,v 1.6 2013/03/04 05:50:49 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -96,170 +96,7 @@ #include "hash.h" #include "config.h" #include "buf.h" - -/* - * State of processing of a node. - */ -enum enum_made { -UNMADE, /* Not examined yet */ -DEFERRED, /* Examined once (building child) */ -REQUESTED, /* on toBeMade list */ -BEINGMADE, /* Already being made; indicates a cycle in the graph. */ -MADE, /* Was out-of-date and has been made. */ -UPTODATE, /* Was already up-to-date. */ -ERROR, /* An error occurred while being made (compat mode only) */ -ABORTED /* An error occurred making an inferior (compat) */ -}; - -/*- - * The structure for an individual graph node. Each node has several - * pieces of data associated with it. - * 1) the name of the target it describes - * 2) the location of the target file in the file system. - * 3) the type of operator used to define its sources (qv. parse.c) - * 4) whether it is involved in this invocation of make - * 5) whether the target has been remade - * 6) whether any of its children has been remade - * 7) the number of its children that are, as yet, unmade - * 8) its modification time - * 9) the modification time of its youngest child (qv. make.c) - * 10) a list of nodes for which this is a source (parents) - * 11) a list of nodes on which this depends (children) - * 12) a list of nodes that depend on this, as gleaned from the - * transformation rules (iParents) - * 13) a list of ancestor nodes, which includes parents, iParents, - * and recursive parents of parents - * 14) a list of nodes of the same name created by the :: operator - * 15) a list of nodes that must be made (if they're made) before - * this node can be, but that do not enter into the datedness of - * this node. - * 16) a list of nodes that must be made (if they're made) before - * this node or any child of this node can be, but that do not - * enter into the datedness of this node. - * 17) a list of nodes that must be made (if they're made) after - * this node is, but that do not depend on this node, in the - * normal sense. - * 18) a Lst of ``local'' variables that are specific to this target - * and this target only (qv. var.c [$@ $< $?, etc.]) - * 19) a Lst of strings that are commands to be given to a shell - * to create this target. - */ -typedef struct GNode { -char*name; /* The target's name */ -char*uname; /* The unexpanded name of a .USE node */ -char *path; /* The full pathname of the file */ -int type; /* Its type (see the OP flags, below) */ - -int flags; -#define REMAKE 0x1 /* this target needs to be (re)made */ -#define CHILDMADE 0x2 /* children of this target were made */ -#define FORCE 0x4 /* children don't exist, and we pretend made */ -#define DONE_WAIT 0x8 /* Set by Make_ProcessWait() */ -#define DONE_ORDER 0x10 /* Build requested by .ORDER processing */ -#define FROM_DEPEND 0x20 /* Node created from .depend */ -#define DONE_ALLSRC 0x40 /* We do it once only */ -#define CYCLE 0x1000 /* Used by MakePrintStatus */ -#define DONECYCLE 0x2000 /* Used by MakePrintStatus */ -enum enum_made made; /* Set to reflect the state of processing - * on this node */ -int unmade; /* The number of unmade children */ - -time_t mtime; /* Its modification time */ -struct GNode*cmgn; /* The youngest child */ - -Lst iParents; /* Links to parents for which this is an - * implied source, if any */ -Lst cohorts; /* Other nodes for the :: operator */ -Lst parents; /* Nodes that depend on this one */ -Lst children; /* Nodes on which this one depends */ -Lst order_pred; /* .ORDER nodes we need made */ -Lst order_succ; /* .ORDER nodes who need us
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Mar 4 05:47:16 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: Makefile portable.h Added Files: othersrc/usr.bin/dholland-make2: array.c array.h Log Message: Add typesafe array code. This is the same stuff found in sail and in a few other places now; if it continues to spread we should probably put it in a library. (Although make would need its own copy anyway.) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/Makefile cvs rdiff -u -r0 -r1.1 othersrc/usr.bin/dholland-make2/array.c \ othersrc/usr.bin/dholland-make2/array.h cvs rdiff -u -r1.5 -r1.6 othersrc/usr.bin/dholland-make2/portable.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/Makefile diff -u othersrc/usr.bin/dholland-make2/Makefile:1.2 othersrc/usr.bin/dholland-make2/Makefile:1.3 --- othersrc/usr.bin/dholland-make2/Makefile:1.2 Mon Feb 25 02:12:23 2013 +++ othersrc/usr.bin/dholland-make2/Makefile Mon Mar 4 05:47:15 2013 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.2 2013/02/25 02:12:23 dholland Exp $ +# $NetBSD: Makefile,v 1.3 2013/03/04 05:47:15 dholland Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 PROG= make SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \ make.c parse.c str.c suff.c targ.c trace.c var.c util.c -SRCS+= strlist.c +SRCS+= array.c strlist.c SRCS+= portable.c SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \ lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \ Index: othersrc/usr.bin/dholland-make2/portable.h diff -u othersrc/usr.bin/dholland-make2/portable.h:1.5 othersrc/usr.bin/dholland-make2/portable.h:1.6 --- othersrc/usr.bin/dholland-make2/portable.h:1.5 Mon Feb 25 03:39:28 2013 +++ othersrc/usr.bin/dholland-make2/portable.h Mon Mar 4 05:47:15 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: portable.h,v 1.5 2013/02/25 03:39:28 dholland Exp $ */ +/* $NetBSD: portable.h,v 1.6 2013/03/04 05:47:15 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -105,6 +105,7 @@ *MAKE_ATTR_UNUSED attribute for unused objects *MAKE_ATTR_DEAD attribute for noreturn functions *MAKE_ATTR_PRINTFLIKE attribute for printf functions + *MAKE_INLINE C99 "inline" keyword *MAKE_RCSID macro for holding rcsid strings *UNCONST(p) macro for discarding const *MIN(a, b), MAX(a, b) @@ -161,6 +162,12 @@ #define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) /* delete */ #endif +#if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__) +#define MAKE_INLINE extern inline +#else +#define MAKE_INLINE inline +#endif + #if defined(lint) #define MAKE_RCSID(str) #define MAKE_COPYRIGHT(str) Added files: Index: othersrc/usr.bin/dholland-make2/array.c diff -u /dev/null othersrc/usr.bin/dholland-make2/array.c:1.1 --- /dev/null Mon Mar 4 05:47:16 2013 +++ othersrc/usr.bin/dholland-make2/array.c Mon Mar 4 05:47:15 2013 @@ -0,0 +1,124 @@ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by David A. Holland. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "portable.h" + +#define ARRAYINLINE +#include "array.h" + +struct array * +array_create(void) +{ + struct array *a; + + a = bmake_malloc(sizeof(*a)); + if (a != NULL) { + array_init(a); + } + return a; +} + +void +array_destroy(struct array *a) +{ + array_cleanup(a); + free(a); +} + +void +array_init(struct array *a) +{ + a->num = a->max = 0; +
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Feb 25 03:45:27 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: make.h Log Message: Move enum decl out from inside of struct decl. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 othersrc/usr.bin/dholland-make2/make.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/make.h diff -u othersrc/usr.bin/dholland-make2/make.h:1.4 othersrc/usr.bin/dholland-make2/make.h:1.5 --- othersrc/usr.bin/dholland-make2/make.h:1.4 Mon Feb 25 02:12:23 2013 +++ othersrc/usr.bin/dholland-make2/make.h Mon Feb 25 03:45:27 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.4 2013/02/25 02:12:23 dholland Exp $ */ +/* $NetBSD: make.h,v 1.5 2013/02/25 03:45:27 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -97,6 +97,20 @@ #include "config.h" #include "buf.h" +/* + * State of processing of a node. + */ +enum enum_made { +UNMADE, /* Not examined yet */ +DEFERRED, /* Examined once (building child) */ +REQUESTED, /* on toBeMade list */ +BEINGMADE, /* Already being made; indicates a cycle in the graph. */ +MADE, /* Was out-of-date and has been made. */ +UPTODATE, /* Was already up-to-date. */ +ERROR, /* An error occurred while being made (compat mode only) */ +ABORTED /* An error occurred making an inferior (compat) */ +}; + /*- * The structure for an individual graph node. Each node has several * pieces of data associated with it. @@ -146,23 +160,8 @@ typedef struct GNode { #define DONE_ALLSRC 0x40 /* We do it once only */ #define CYCLE 0x1000 /* Used by MakePrintStatus */ #define DONECYCLE 0x2000 /* Used by MakePrintStatus */ -enum enum_made { - UNMADE, DEFERRED, REQUESTED, BEINGMADE, - MADE, UPTODATE, ERROR, ABORTED -} made; /* Set to reflect the state of processing - * on this node: - * UNMADE - Not examined yet - * DEFERRED - Examined once (building child) - * REQUESTED - on toBeMade list - * BEINGMADE - Target is already being made. - * Indicates a cycle in the graph. - * MADE - Was out-of-date and has been made - * UPTODATE - Was already up-to-date - * ERROR - An error occurred while it was being - * made (used only in compat mode) - * ABORTED - The target was aborted due to - * an error making an inferior (compat). - */ +enum enum_made made; /* Set to reflect the state of processing + * on this node */ int unmade; /* The number of unmade children */ time_t mtime; /* Its modification time */
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Feb 25 03:12:21 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: portable.h Log Message: Add MAKE_RCSID macro. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/portable.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/portable.h diff -u othersrc/usr.bin/dholland-make2/portable.h:1.3 othersrc/usr.bin/dholland-make2/portable.h:1.4 --- othersrc/usr.bin/dholland-make2/portable.h:1.3 Mon Feb 25 03:08:10 2013 +++ othersrc/usr.bin/dholland-make2/portable.h Mon Feb 25 03:12:21 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: portable.h,v 1.3 2013/02/25 03:08:10 dholland Exp $ */ +/* $NetBSD: portable.h,v 1.4 2013/02/25 03:12:21 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -105,6 +105,7 @@ *MAKE_ATTR_UNUSED attribute for unused objects *MAKE_ATTR_DEAD attribute for noreturn functions *MAKE_ATTR_PRINTFLIKE attribute for printf functions + *MAKE_RCSID macro for holding rcsid strings *UNCONST(p) macro for discarding const *MIN(a, b), MAX(a, b) *bmake_malloc allocator functions that crash on error @@ -125,12 +126,12 @@ #ifndef PORTABLE_H #define PORTABLE_H -#include /* for size_t */ - -#ifdef BSD4_4 -# include +#ifdef MAKE_NATIVE +#include #endif +#include /* for size_t */ + #if defined(__GNUC__) #define MAKE_GNUC_PREREQ(x, y) \ ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \ @@ -160,6 +161,12 @@ #define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) /* delete */ #endif +#ifdef MAKE_NATIVE +#define MAKE_RCSID __RCSID +#else +#define MAKE_RCSID(str) +#endif + #ifdef __GNUC__ #define UNCONST(ptr) ({ \ union __unconst { \
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Feb 25 03:08:23 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: portable.c Log Message: sort #defines To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/portable.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/portable.c diff -u othersrc/usr.bin/dholland-make2/portable.c:1.2 othersrc/usr.bin/dholland-make2/portable.c:1.3 --- othersrc/usr.bin/dholland-make2/portable.c:1.2 Mon Feb 25 02:53:33 2013 +++ othersrc/usr.bin/dholland-make2/portable.c Mon Feb 25 03:08:23 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: portable.c,v 1.2 2013/02/25 02:53:33 dholland Exp $ */ +/* $NetBSD: portable.c,v 1.3 2013/02/25 03:08:23 dholland Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ #ifdef MAKE_NATIVE #include -__RCSID("$NetBSD: portable.c,v 1.2 2013/02/25 02:53:33 dholland Exp $"); +__RCSID("$NetBSD: portable.c,v 1.3 2013/02/25 03:08:23 dholland Exp $"); #endif #include @@ -44,8 +44,8 @@ __RCSID("$NetBSD: portable.c,v 1.2 2013/ #ifdef MAKE_NATIVE #define HAVE_STRERROR -#define HAVE_VSNPRINTF #define HAVE_STRFTIME +#define HAVE_VSNPRINTF #endif
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Feb 25 03:08:10 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: portable.h Log Message: Update description. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/portable.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/portable.h diff -u othersrc/usr.bin/dholland-make2/portable.h:1.2 othersrc/usr.bin/dholland-make2/portable.h:1.3 --- othersrc/usr.bin/dholland-make2/portable.h:1.2 Mon Feb 25 02:12:23 2013 +++ othersrc/usr.bin/dholland-make2/portable.h Mon Feb 25 03:08:10 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: portable.h,v 1.2 2013/02/25 02:12:23 dholland Exp $ */ +/* $NetBSD: portable.h,v 1.3 2013/02/25 03:08:10 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -112,8 +112,14 @@ *bmake_strdup allocator functions that crash on error *bmake_strndup allocator functions that crash on error * - * External toggles that can be set: + * External toggles that can be set with -D: *USE_EMALLOC use emalloc() from libutil + *MAKE_NATIVE should be set if building native w/o autoconf + * + * If MAKE_NATIVE isn't set: + *HAVE_STRERROR set if build platform has strerror() + *HAVE_STRFTIME set if build platform has strftime() + *HAVE_VSNPRINTF set if build platform has (v)snprintf() */ #ifndef PORTABLE_H
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Feb 25 02:57:51 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: buf.c Log Message: We have MAX(), we don't also need max(). To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/buf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/buf.c diff -u othersrc/usr.bin/dholland-make2/buf.c:1.1.1.1 othersrc/usr.bin/dholland-make2/buf.c:1.2 --- othersrc/usr.bin/dholland-make2/buf.c:1.1.1.1 Mon Feb 25 01:32:49 2013 +++ othersrc/usr.bin/dholland-make2/buf.c Mon Feb 25 02:57:50 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.1.1.1 2013/02/25 01:32:49 dholland Exp $ */ +/* $NetBSD: buf.c,v 1.2 2013/02/25 02:57:50 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: buf.c,v 1.1.1.1 2013/02/25 01:32:49 dholland Exp $"; +static char rcsid[] = "$NetBSD: buf.c,v 1.2 2013/02/25 02:57:50 dholland Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)buf.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: buf.c,v 1.1.1.1 2013/02/25 01:32:49 dholland Exp $"); +__RCSID("$NetBSD: buf.c,v 1.2 2013/02/25 02:57:50 dholland Exp $"); #endif #endif /* not lint */ #endif @@ -90,10 +90,6 @@ __RCSID("$NetBSD: buf.c,v 1.1.1.1 2013/0 #include"make.h" #include"buf.h" -#ifndef max -#define max(a,b) ((a) > (b) ? (a) : (b)) -#endif - #define BUF_DEF_SIZE 256 /* Default buffer size */ /*- @@ -106,7 +102,7 @@ __RCSID("$NetBSD: buf.c,v 1.1.1.1 2013/0 void Buf_Expand_1(Buffer *bp) { -bp->size += max(bp->size, 16); +bp->size += MAX(bp->size, 16); bp->buffer = bmake_realloc(bp->buffer, bp->size); } @@ -130,7 +126,7 @@ Buf_AddBytes(Buffer *bp, int numBytes, c Byte *ptr; if (__predict_false(count + numBytes >= bp->size)) { - bp->size += max(bp->size, numBytes + 16); + bp->size += MAX(bp->size, numBytes + 16); bp->buffer = bmake_realloc(bp->buffer, bp->size); }
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Feb 25 02:53:33 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: portable.c util.c Log Message: Move the other compat stuff from util.c to portable.c. (and the reason it isn't called compat.c is we already have one of those for something quite different.) Leave the environment wrangling code behind as I have someting else in mind for that. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 othersrc/usr.bin/dholland-make2/portable.c cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/portable.c diff -u othersrc/usr.bin/dholland-make2/portable.c:1.1 othersrc/usr.bin/dholland-make2/portable.c:1.2 --- othersrc/usr.bin/dholland-make2/portable.c:1.1 Mon Feb 25 02:12:23 2013 +++ othersrc/usr.bin/dholland-make2/portable.c Mon Feb 25 02:53:33 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: portable.c,v 1.1 2013/02/25 02:12:23 dholland Exp $ */ +/* $NetBSD: portable.c,v 1.2 2013/02/25 02:53:33 dholland Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,17 +28,51 @@ #ifdef MAKE_NATIVE #include -__RCSID("$NetBSD: portable.c,v 1.1 2013/02/25 02:12:23 dholland Exp $"); +__RCSID("$NetBSD: portable.c,v 1.2 2013/02/25 02:53:33 dholland Exp $"); #endif +#include + #include #include #include +#include #include #include "portable.h" #include "make.h" +#ifdef MAKE_NATIVE +#define HAVE_STRERROR +#define HAVE_VSNPRINTF +#define HAVE_STRFTIME +#endif + + +// 1. Things we always intercept (bmake_*) + +// +// signals + +/* force posix signals */ +void (* +bmake_signal(int s, void (*a)(int)))(int) +{ +struct sigaction sa, osa; + +sa.sa_handler = a; +sigemptyset(&sa.sa_mask); +sa.sa_flags = SA_RESTART; + +if (sigaction(s, &sa, &osa) == -1) + return SIG_ERR; +else + return osa.sa_handler; +} + +// +// (e)malloc + #ifndef USE_EMALLOC static void enomem(void) MAKE_ATTR_DEAD; @@ -118,3 +152,375 @@ bmake_realloc(void *ptr, size_t size) return(ptr); } #endif + + +// 2. standard functions sometimes missing +// (in alphabetical order) + + +// +// getwd, req'd on hpux + +#if defined(__hpux__) || defined(__hpux) + +#include +#include +#include +#include +#include +#include +#include + +/* strrcpy(): + * Like strcpy, going backwards and returning the new pointer + */ +static char * +strrcpy(char *ptr, char *str) +{ +int len = strlen(str); + +while (len) + *--ptr = str[--len]; + +return (ptr); +} /* end strrcpy */ + +#if !defined(BSD) && !defined(d_fileno) +# define d_fileno d_ino +#endif + +#ifndef DEV_DEV_COMPARE +# define DEV_DEV_COMPARE(a, b) ((a) == (b)) +#endif +#define ISDOT(c) ((c)[0] == '.' && (((c)[1] == '\0') || ((c)[1] == '/'))) +#define ISDOTDOT(c) ((c)[0] == '.' && ISDOT(&((c)[1]))) + +char * +getwd(char *pathname) +{ +DIR*dp; +struct dirent *d; +extern int errno; + +struct stat st_root, st_cur, st_next, st_dotdot; +charpathbuf[MAXPATHLEN], nextpathbuf[MAXPATHLEN * 2]; +char *pathptr, *nextpathptr, *cur_name_add; + +/* find the inode of root */ +if (stat("/", &st_root) == -1) { + (void)sprintf(pathname, + "getwd: Cannot stat \"/\" (%s)", strerror(errno)); + return NULL; +} +pathbuf[MAXPATHLEN - 1] = '\0'; +pathptr = &pathbuf[MAXPATHLEN - 1]; +nextpathbuf[MAXPATHLEN - 1] = '\0'; +cur_name_add = nextpathptr = &nextpathbuf[MAXPATHLEN - 1]; + +/* find the inode of the current directory */ +if (lstat(".", &st_cur) == -1) { + (void)sprintf(pathname, + "getwd: Cannot stat \".\" (%s)", strerror(errno)); + return NULL; +} +nextpathptr = strrcpy(nextpathptr, "../"); + +/* Descend to root */ +for (;;) { + + /* look if we found root yet */ + if (st_cur.st_ino == st_root.st_ino && + DEV_DEV_COMPARE(st_cur.st_dev, st_root.st_dev)) { + (void)strcpy(pathname, *pathptr != '/' ? "/" : pathptr); + return (pathname); + } + + /* open the parent directory */ + if (stat(nextpathptr, &st_dotdot) == -1) { + (void)sprintf(pathname, + "getwd: Cannot stat directory \"%s\" (%s)", + nextpathptr, strerror(errno)); + return NULL; + } + if ((dp = opendir(nextpathptr)) == NULL) { + (void)sprintf(pathname, + "getwd: Cannot open directory \"%s\" (%s)", + nextpathptr, strerror(errno)); + return NULL; + } + + /* look in the parent for the entry with the same inode */ + if (DEV_DEV_COMPARE(st_dotdot.st_dev, st_cur.st_dev)) { + /* Parent has same device. No need to stat every member */ + for (d = readdir(dp); d != NULL; d = readdir(dp)) + if (d->d_fileno == st
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Feb 25 02:12:24 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: Makefile make.h portable.h strlist.c othersrc/usr.bin/dholland-make2/lst.lib: lstInt.h Added Files: othersrc/usr.bin/dholland-make2: portable.c Removed Files: othersrc/usr.bin/dholland-make2: make_malloc.c make_malloc.h Log Message: Fold make_malloc stuff into portable.h. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/Makefile \ othersrc/usr.bin/dholland-make2/strlist.c cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/dholland-make2/make.h cvs rdiff -u -r1.1.1.1 -r0 othersrc/usr.bin/dholland-make2/make_malloc.c \ othersrc/usr.bin/dholland-make2/make_malloc.h cvs rdiff -u -r0 -r1.1 othersrc/usr.bin/dholland-make2/portable.c cvs rdiff -u -r1.1 -r1.2 othersrc/usr.bin/dholland-make2/portable.h cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/lst.lib/lstInt.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/Makefile diff -u othersrc/usr.bin/dholland-make2/Makefile:1.1.1.1 othersrc/usr.bin/dholland-make2/Makefile:1.2 --- othersrc/usr.bin/dholland-make2/Makefile:1.1.1.1 Mon Feb 25 01:32:48 2013 +++ othersrc/usr.bin/dholland-make2/Makefile Mon Feb 25 02:12:23 2013 @@ -1,11 +1,11 @@ -# $NetBSD: Makefile,v 1.1.1.1 2013/02/25 01:32:48 dholland Exp $ +# $NetBSD: Makefile,v 1.2 2013/02/25 02:12:23 dholland Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 PROG= make SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \ make.c parse.c str.c suff.c targ.c trace.c var.c util.c SRCS+= strlist.c -SRCS+= make_malloc.c +SRCS+= portable.c SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \ lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \ lstFind.c lstFindFrom.c lstFirst.c lstForEach.c lstForEachFrom.c \ Index: othersrc/usr.bin/dholland-make2/strlist.c diff -u othersrc/usr.bin/dholland-make2/strlist.c:1.1.1.1 othersrc/usr.bin/dholland-make2/strlist.c:1.2 --- othersrc/usr.bin/dholland-make2/strlist.c:1.1.1.1 Mon Feb 25 01:33:05 2013 +++ othersrc/usr.bin/dholland-make2/strlist.c Mon Feb 25 02:12:23 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: strlist.c,v 1.1.1.1 2013/02/25 01:33:05 dholland Exp $ */ +/* $NetBSD: strlist.c,v 1.2 2013/02/25 02:12:23 dholland Exp $ */ /*- * Copyright (c) 2008 - 2009 The NetBSD Foundation, Inc. @@ -33,18 +33,18 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: strlist.c,v 1.1.1.1 2013/02/25 01:33:05 dholland Exp $"; +static char rcsid[] = "$NetBSD: strlist.c,v 1.2 2013/02/25 02:12:23 dholland Exp $"; #else #include #ifndef lint -__RCSID("$NetBSD: strlist.c,v 1.1.1.1 2013/02/25 01:33:05 dholland Exp $"); +__RCSID("$NetBSD: strlist.c,v 1.2 2013/02/25 02:12:23 dholland Exp $"); #endif /* not lint */ #endif #include #include +#include "portable.h" #include "strlist.h" -#include "make_malloc.h" void strlist_init(strlist_t *sl) Index: othersrc/usr.bin/dholland-make2/make.h diff -u othersrc/usr.bin/dholland-make2/make.h:1.3 othersrc/usr.bin/dholland-make2/make.h:1.4 --- othersrc/usr.bin/dholland-make2/make.h:1.3 Mon Feb 25 02:02:38 2013 +++ othersrc/usr.bin/dholland-make2/make.h Mon Feb 25 02:12:23 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.3 2013/02/25 02:02:38 dholland Exp $ */ +/* $NetBSD: make.h,v 1.4 2013/02/25 02:12:23 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -96,7 +96,6 @@ #include "hash.h" #include "config.h" #include "buf.h" -#include "make_malloc.h" /*- * The structure for an individual graph node. Each node has several Index: othersrc/usr.bin/dholland-make2/portable.h diff -u othersrc/usr.bin/dholland-make2/portable.h:1.1 othersrc/usr.bin/dholland-make2/portable.h:1.2 --- othersrc/usr.bin/dholland-make2/portable.h:1.1 Mon Feb 25 02:02:38 2013 +++ othersrc/usr.bin/dholland-make2/portable.h Mon Feb 25 02:12:23 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: portable.h,v 1.1 2013/02/25 02:02:38 dholland Exp $ */ +/* $NetBSD: portable.h,v 1.2 2013/02/25 02:12:23 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -72,6 +72,32 @@ * from: @(#)make.h 8.3 (Berkeley) 6/13/95 */ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATI
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Feb 25 02:02:38 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: make.h Added Files: othersrc/usr.bin/dholland-make2: portable.h Log Message: Split a bunch of definitions related to compilers and portability into a header file specifically for that purpose. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/dholland-make2/make.h cvs rdiff -u -r0 -r1.1 othersrc/usr.bin/dholland-make2/portable.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/make.h diff -u othersrc/usr.bin/dholland-make2/make.h:1.2 othersrc/usr.bin/dholland-make2/make.h:1.3 --- othersrc/usr.bin/dholland-make2/make.h:1.2 Mon Feb 25 01:43:03 2013 +++ othersrc/usr.bin/dholland-make2/make.h Mon Feb 25 02:02:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.2 2013/02/25 01:43:03 dholland Exp $ */ +/* $NetBSD: make.h,v 1.3 2013/02/25 02:02:38 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -89,38 +89,7 @@ #include #include -#ifdef BSD4_4 -# include -#endif - -#if defined(__GNUC__) -#define MAKE_GNUC_PREREQ(x, y) \ - ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \ - (__GNUC__ > (x))) -#else /* defined(__GNUC__) */ -#define MAKE_GNUC_PREREQx, y) 0 -#endif /* defined(__GNUC__) */ - -#if MAKE_GNUC_PREREQ(2, 7) -#define MAKE_ATTR_UNUSED __attribute__((__unused__)) -#else -#define MAKE_ATTR_UNUSED /* delete */ -#endif - -#if MAKE_GNUC_PREREQ(2, 5) -#define MAKE_ATTR_DEAD __attribute__((__noreturn__)) -#elif defined(__GNUC__) -#define MAKE_ATTR_DEAD __volatile -#else -#define MAKE_ATTR_DEAD /* delete */ -#endif - -#if MAKE_GNUC_PREREQ(2, 7) -#define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) \ - __attribute__((__format__ (__printf__, fmtarg, firstvararg))) -#else -#define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) /* delete */ -#endif +#include "portable.h" #include "sprite.h" #include "lst.h" @@ -478,22 +447,4 @@ Boolean Main_SetObjdir(const char *); int mkTempFile(const char *, char **); int str2Lst_Append(Lst, char *, const char *); -#ifdef __GNUC__ -#define UNCONST(ptr) ({ \ -union __unconst { \ - const void *__cp; \ - void *__p; \ -} __d;\ -__d.__cp = ptr, __d.__p; }) -#else -#define UNCONST(ptr) (void *)(ptr) -#endif - -#ifndef MIN -#define MIN(a, b) ((a < b) ? a : b) -#endif -#ifndef MAX -#define MAX(a, b) ((a > b) ? a : b) -#endif - #endif /* _MAKE_H_ */ Added files: Index: othersrc/usr.bin/dholland-make2/portable.h diff -u /dev/null othersrc/usr.bin/dholland-make2/portable.h:1.1 --- /dev/null Mon Feb 25 02:02:38 2013 +++ othersrc/usr.bin/dholland-make2/portable.h Mon Feb 25 02:02:38 2013 @@ -0,0 +1,142 @@ +/* $NetBSD: portable.h,v 1.1 2013/02/25 02:02:38 dholland Exp $ */ + +/* + * Copyright (c) 1988, 1989, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Adam de Boor. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + *may be used to endorse or promote products derived from this software + *without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)make.h 8.3 (Berkeley) 6/13/95 + */ + +/* + * Copyright (c) 1989 by Berkeley Softworks + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Adam de Boor. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Feb 25 01:43:04 UTC 2013 Modified Files: othersrc/usr.bin/dholland-make2: main.c make.h Log Message: extern decls should be only in header files. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/dholland-make2/main.c \ othersrc/usr.bin/dholland-make2/make.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/dholland-make2/main.c diff -u othersrc/usr.bin/dholland-make2/main.c:1.1.1.1 othersrc/usr.bin/dholland-make2/main.c:1.2 --- othersrc/usr.bin/dholland-make2/main.c:1.1.1.1 Mon Feb 25 01:32:59 2013 +++ othersrc/usr.bin/dholland-make2/main.c Mon Feb 25 01:43:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.1.1.1 2013/02/25 01:32:59 dholland Exp $ */ +/* $NetBSD: main.c,v 1.2 2013/02/25 01:43:03 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.1.1.1 2013/02/25 01:32:59 dholland Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.2 2013/02/25 01:43:03 dholland Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.1.1.1 2013/02/25 01:32:59 dholland Exp $"); +__RCSID("$NetBSD: main.c,v 1.2 2013/02/25 01:43:03 dholland Exp $"); #endif #endif /* not lint */ #endif @@ -187,8 +187,6 @@ pid_t myPid; Boolean forceJobs = FALSE; -extern Lst parseIncPath; - static void parse_debug_options(const char *argvalue) { Index: othersrc/usr.bin/dholland-make2/make.h diff -u othersrc/usr.bin/dholland-make2/make.h:1.1.1.1 othersrc/usr.bin/dholland-make2/make.h:1.2 --- othersrc/usr.bin/dholland-make2/make.h:1.1.1.1 Mon Feb 25 01:33:01 2013 +++ othersrc/usr.bin/dholland-make2/make.h Mon Feb 25 01:43:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.1.1.1 2013/02/25 01:33:01 dholland Exp $ */ +/* $NetBSD: make.h,v 1.2 2013/02/25 01:43:03 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -402,7 +402,8 @@ extern time_t now; /* The time at extern Boolean oldVars; /* Do old-style variable substitution */ -extern Lst sysIncPath; /* The system include path. */ +extern Lst parseIncPath; /* The general include path, for "". */ +extern Lst sysIncPath; /* The system include path, for <>. */ extern Lst defIncPath; /* The default include path. */ extern char curdir[]; /* Startup directory */
CVS commit: othersrc/usr.bin/dholland-make2
Module Name:othersrc Committed By: dholland Date: Mon Feb 25 01:33:26 UTC 2013 Update of /cvsroot/othersrc/usr.bin/dholland-make2 In directory ivanova.netbsd.org:/tmp/cvs-serv3353 Log Message: Import a copy of make from HEAD. I'm going to be beating this one like a rented mule. :-) For various reasons it seems like using othersrc for this particular hacking run is a better idea than using a branch in src; for one thing I'm likely to be adding and removing files, and for another it is more likely that this version will become a guide for making more measured updates to the master version than that it will eventually itself become the master version. try 2: don't try to use HEAD as the branch tag as it makes CVS very upset. Status: Vendor Tag: FROMHEAD Release Tags: FROMHEAD-20130225 N othersrc/usr.bin/dholland-make2/Makefile.boot N othersrc/usr.bin/dholland-make2/Makefile N othersrc/usr.bin/dholland-make2/make_malloc.c N othersrc/usr.bin/dholland-make2/arch.c N othersrc/usr.bin/dholland-make2/buf.c N othersrc/usr.bin/dholland-make2/buf.h N othersrc/usr.bin/dholland-make2/compat.c N othersrc/usr.bin/dholland-make2/cond.c N othersrc/usr.bin/dholland-make2/config.h N othersrc/usr.bin/dholland-make2/dir.c N othersrc/usr.bin/dholland-make2/dir.h N othersrc/usr.bin/dholland-make2/for.c N othersrc/usr.bin/dholland-make2/hash.c N othersrc/usr.bin/dholland-make2/hash.h N othersrc/usr.bin/dholland-make2/job.c N othersrc/usr.bin/dholland-make2/job.h N othersrc/usr.bin/dholland-make2/lst.h N othersrc/usr.bin/dholland-make2/main.c N othersrc/usr.bin/dholland-make2/make.1 N othersrc/usr.bin/dholland-make2/make.c N othersrc/usr.bin/dholland-make2/make.h N othersrc/usr.bin/dholland-make2/parse.c N othersrc/usr.bin/dholland-make2/make_malloc.h N othersrc/usr.bin/dholland-make2/meta.c N othersrc/usr.bin/dholland-make2/meta.h N othersrc/usr.bin/dholland-make2/nonints.h N othersrc/usr.bin/dholland-make2/pathnames.h N othersrc/usr.bin/dholland-make2/sprite.h N othersrc/usr.bin/dholland-make2/str.c N othersrc/usr.bin/dholland-make2/strlist.c N othersrc/usr.bin/dholland-make2/strlist.h N othersrc/usr.bin/dholland-make2/suff.c N othersrc/usr.bin/dholland-make2/targ.c N othersrc/usr.bin/dholland-make2/trace.c N othersrc/usr.bin/dholland-make2/trace.h N othersrc/usr.bin/dholland-make2/util.c N othersrc/usr.bin/dholland-make2/var.c I othersrc/usr.bin/dholland-make2/obj N othersrc/usr.bin/dholland-make2/PSD.doc/tutorial.ms N othersrc/usr.bin/dholland-make2/PSD.doc/Makefile N othersrc/usr.bin/dholland-make2/lst.lib/lstAppend.c N othersrc/usr.bin/dholland-make2/lst.lib/Makefile N othersrc/usr.bin/dholland-make2/lst.lib/lstFindFrom.c N othersrc/usr.bin/dholland-make2/lst.lib/lstAtEnd.c N othersrc/usr.bin/dholland-make2/lst.lib/lstAtFront.c N othersrc/usr.bin/dholland-make2/lst.lib/lstClose.c N othersrc/usr.bin/dholland-make2/lst.lib/lstConcat.c N othersrc/usr.bin/dholland-make2/lst.lib/lstDatum.c N othersrc/usr.bin/dholland-make2/lst.lib/lstDeQueue.c N othersrc/usr.bin/dholland-make2/lst.lib/lstDestroy.c N othersrc/usr.bin/dholland-make2/lst.lib/lstDupl.c N othersrc/usr.bin/dholland-make2/lst.lib/lstEnQueue.c N othersrc/usr.bin/dholland-make2/lst.lib/lstFind.c N othersrc/usr.bin/dholland-make2/lst.lib/lstForEachFrom.c N othersrc/usr.bin/dholland-make2/lst.lib/lstFirst.c N othersrc/usr.bin/dholland-make2/lst.lib/lstForEach.c N othersrc/usr.bin/dholland-make2/lst.lib/lstInit.c N othersrc/usr.bin/dholland-make2/lst.lib/lstInsert.c N othersrc/usr.bin/dholland-make2/lst.lib/lstInt.h N othersrc/usr.bin/dholland-make2/lst.lib/lstIsAtEnd.c N othersrc/usr.bin/dholland-make2/lst.lib/lstIsEmpty.c N othersrc/usr.bin/dholland-make2/lst.lib/lstLast.c N othersrc/usr.bin/dholland-make2/lst.lib/lstMember.c N othersrc/usr.bin/dholland-make2/lst.lib/lstNext.c N othersrc/usr.bin/dholland-make2/lst.lib/lstOpen.c N othersrc/usr.bin/dholland-make2/lst.lib/lstPrev.c N othersrc/usr.bin/dholland-make2/lst.lib/lstRemove.c N othersrc/usr.bin/dholland-make2/lst.lib/lstReplace.c N othersrc/usr.bin/dholland-make2/lst.lib/lstSucc.c N othersrc/usr.bin/dholland-make2/unit-tests/export-all N othersrc/usr.bin/dholland-make2/unit-tests/Makefile N othersrc/usr.bin/dholland-make2/unit-tests/comment N othersrc/usr.bin/dholland-make2/unit-tests/cond1 N othersrc/usr.bin/dholland-make2/unit-tests/doterror N othersrc/usr.bin/dholland-make2/unit-tests/dotwait N othersrc/usr.bin/dholland-make2/unit-tests/error N othersrc/usr.bin/dholland-make2/unit-tests/export N othersrc/usr.bin/dholland-make2/unit-tests/phony-end N othersrc/usr.bin/dholland-make2/unit-tests/forloop N othersrc/usr.bin/dholland-make2/unit-tests/forsubst N othersrc/usr.bin/dholland-make2/unit-tests/hash N othersrc/usr.bin/dholland-make2/unit-tests/misc N othersrc/usr.bin/dholland-make2/unit-tests/moderrs N othersrc/usr.bin/dholland-make2/unit-tests/modmatch N othersrc/usr.bin/dholland-make2/unit-tests/modmisc N othersrc/usr.bin/dholland-make2/unit-tests/modorder N oth