Fix previous - need to add a lstPrev()
This commit is contained in:
parent
95938658de
commit
7ef877a8c0
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.39 2006/10/08 17:52:29 peter Exp $
|
||||
# $NetBSD: Makefile,v 1.40 2006/10/25 20:05:59 dsl Exp $
|
||||
# @(#)Makefile 5.2 (Berkeley) 12/28/90
|
||||
|
||||
PROG= make
|
||||
@ -9,6 +9,8 @@ SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.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
|
||||
|
||||
.PATH: ${.CURDIR}/lst.lib
|
||||
WARNS=3
|
||||
.if make(install)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lst.h,v 1.11 2005/08/09 21:36:42 christos Exp $ */
|
||||
/* $NetBSD: lst.h,v 1.12 2006/10/25 20:05:59 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -148,6 +148,8 @@ LstNode Lst_First(Lst);
|
||||
LstNode Lst_Last(Lst);
|
||||
/* Return successor to given element */
|
||||
LstNode Lst_Succ(LstNode);
|
||||
/* Return predecessor to given element */
|
||||
LstNode Lst_Prev(LstNode);
|
||||
/* Get datum from LstNode */
|
||||
ClientData Lst_Datum(LstNode);
|
||||
|
||||
|
79
usr.bin/make/lst.lib/lstPrev.c
Normal file
79
usr.bin/make/lst.lib/lstPrev.c
Normal file
@ -0,0 +1,79 @@
|
||||
/* $NetBSD: lstPrev.c,v 1.1 2006/10/25 20:05:59 dsl 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.
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lstPrev.c,v 1.1 2006/10/25 20:05:59 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lstSucc.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lstPrev.c,v 1.1 2006/10/25 20:05:59 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* LstPrev.c --
|
||||
* return the predecessor to a given node
|
||||
*/
|
||||
|
||||
#include "lstInt.h"
|
||||
|
||||
/*-
|
||||
*-----------------------------------------------------------------------
|
||||
* Lst_Prev --
|
||||
* Return the predecessor to the given node on its list.
|
||||
*
|
||||
* Results:
|
||||
* The predecessor of the node, if it exists (note that on a circular
|
||||
* list, if the node is the only one in the list, it is its own
|
||||
* predecessor).
|
||||
*
|
||||
* Side Effects:
|
||||
* None.
|
||||
*
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
LstNode
|
||||
Lst_Prev(LstNode ln)
|
||||
{
|
||||
if (ln == NILLNODE) {
|
||||
return (NILLNODE);
|
||||
} else {
|
||||
return ((LstNode) ((ListNode) ln)->prevPtr);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: suff.c,v 1.56 2006/10/25 19:44:10 dsl Exp $ */
|
||||
/* $NetBSD: suff.c,v 1.57 2006/10/25 20:05:59 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.56 2006/10/25 19:44:10 dsl Exp $";
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.57 2006/10/25 20:05:59 dsl Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: suff.c,v 1.56 2006/10/25 19:44:10 dsl Exp $");
|
||||
__RCSID("$NetBSD: suff.c,v 1.57 2006/10/25 20:05:59 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -1632,7 +1632,7 @@ SuffExpandChildren(LstNode cln, GNode *pgn)
|
||||
(void)Lst_AtEnd(gn->parents, (ClientData)pgn);
|
||||
pgn->unmade++;
|
||||
/* Expand wildcards on new node */
|
||||
SuffExpandWildcards(lst_Prev(cln), pgn);
|
||||
SuffExpandWildcards(Lst_Prev(cln), pgn);
|
||||
}
|
||||
Lst_Destroy(members, NOFREE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user