=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/suff.c,v retrieving revision 1.50 retrieving revision 1.51 diff -c -r1.50 -r1.51 *** src/usr.bin/make/suff.c 2003/06/03 02:56:12 1.50 --- src/usr.bin/make/suff.c 2004/04/07 13:11:36 1.51 *************** *** 1,5 **** /* $OpenPackages$ */ ! /* $OpenBSD: suff.c,v 1.50 2003/06/03 02:56:12 millert Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* --- 1,5 ---- /* $OpenPackages$ */ ! /* $OpenBSD: suff.c,v 1.51 2004/04/07 13:11:36 espie Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* *************** *** 198,220 **** /*- *----------------------------------------------------------------------- * SuffStrIsPrefix -- ! * See if pref is a prefix of str. * * Results: * NULL if it ain't, pointer to character in str after prefix if so *----------------------------------------------------------------------- */ static char * ! SuffStrIsPrefix(pref, str) ! const char *pref; /* possible prefix */ ! const char *str; /* string to check */ { ! while (*str && *pref == *str) { ! pref++; str++; } ! return *pref ? NULL : (char *)str; } /*- --- 198,218 ---- /*- *----------------------------------------------------------------------- * SuffStrIsPrefix -- ! * See if prefix is a prefix of str. * * Results: * NULL if it ain't, pointer to character in str after prefix if so *----------------------------------------------------------------------- */ static char * ! SuffStrIsPrefix(const char *prefix, const char *str) { ! while (*str && *prefix == *str) { ! prefix++; str++; } ! return *prefix ? NULL : (char *)str; } /*- *************** *** 229,237 **** *----------------------------------------------------------------------- */ static char * ! SuffSuffIsSuffix(s, str) ! Suff *s; /* possible suffix */ ! const char *str; /* string to examine */ { const char *p1; /* Pointer into suffix name */ const char *p2; /* Pointer into string being examined */ --- 227,233 ---- *----------------------------------------------------------------------- */ static char * ! SuffSuffIsSuffix(Suff *s, const char *str) { const char *p1; /* Pointer into suffix name */ const char *p2; /* Pointer into string being examined */ *************** *** 260,268 **** *----------------------------------------------------------------------- */ static int ! SuffSuffIsSuffixP(s, str) ! void *s; ! const void *str; { return !SuffSuffIsSuffix((Suff *)s, (const char *)str); } --- 256,262 ---- *----------------------------------------------------------------------- */ static int ! SuffSuffIsSuffixP(void *s, const void *str) { return !SuffSuffIsSuffix((Suff *)s, (const char *)str); } *************** *** 278,286 **** *----------------------------------------------------------------------- */ static int ! SuffSuffHasNameP(s, sname) ! void *s; /* Suffix to check */ ! const void *sname; /* Desired name */ { return strcmp((const char *)sname, ((Suff *)s)->name); } --- 272,278 ---- *----------------------------------------------------------------------- */ static int ! SuffSuffHasNameP(void *s, const void *sname) { return strcmp((const char *)sname, ((Suff *)s)->name); } *************** *** 298,306 **** *----------------------------------------------------------------------- */ static int ! SuffSuffIsPrefix(s, str) ! void *s; /* suffix to compare */ ! const void *str; /* string to examine */ { return SuffStrIsPrefix(((Suff *)s)->name, (const char *)str) == NULL ? 1 : 0; } --- 290,296 ---- *----------------------------------------------------------------------- */ static int ! SuffSuffIsPrefix(void *s, const void *str) { return SuffStrIsPrefix(((Suff *)s)->name, (const char *)str) == NULL ? 1 : 0; } *************** *** 315,323 **** *----------------------------------------------------------------------- */ static int ! SuffGNHasNameP(gn, name) ! void *gn; /* current node we're looking at */ ! const void *name; /* name we're looking for */ { return strcmp((const char *)name, ((GNode *)gn)->name); } --- 305,311 ---- *----------------------------------------------------------------------- */ static int ! SuffGNHasNameP(void *gn, const void *name) { return strcmp((const char *)name, ((GNode *)gn)->name); } *************** *** 325,333 **** /*********** Maintenance Functions ************/ static void ! SuffUnRef(l, sp) ! Lst l; ! Suff *sp; { LstNode ln = Lst_Member(l, sp); if (ln != NULL) --- 313,319 ---- /*********** Maintenance Functions ************/ static void ! SuffUnRef(Lst l, Suff *sp) { LstNode ln = Lst_Member(l, sp); if (ln != NULL) *************** *** 345,352 **** *----------------------------------------------------------------------- */ static void ! SuffFree(sp) ! void *sp; { Suff *s = (Suff *)sp; --- 331,337 ---- *----------------------------------------------------------------------- */ static void ! SuffFree(void *sp) { Suff *s = (Suff *)sp; *************** *** 378,386 **** *----------------------------------------------------------------------- */ static void ! SuffInsert(l, s) ! Lst l; /* the list where in s should be inserted */ ! Suff *s; /* the suffix to insert */ { LstNode ln; /* current element in l we're examining */ Suff *s2 = NULL; /* the suffix descriptor in this element */ --- 363,369 ---- *----------------------------------------------------------------------- */ static void ! SuffInsert(Lst l, Suff *s) { LstNode ln; /* current element in l we're examining */ Suff *s2 = NULL; /* the suffix descriptor in this element */ *************** *** 426,432 **** *----------------------------------------------------------------------- */ void ! Suff_ClearSuffixes() { #ifdef CLEANUP Lst_ConcatDestroy(&suffClean, &sufflist); --- 409,415 ---- *----------------------------------------------------------------------- */ void ! Suff_ClearSuffixes(void) { #ifdef CLEANUP Lst_ConcatDestroy(&suffClean, &sufflist); *************** *** 449,458 **** *----------------------------------------------------------------------- */ static bool ! SuffParseTransform(str, srcPtr, targPtr) ! const char *str; /* String being parsed */ ! Suff **srcPtr; /* Place to store source of trans. */ ! Suff **targPtr; /* Place to store target of trans. */ { LstNode srcLn; /* element in suffix list of trans source*/ Suff *src; /* Source of transformation */ --- 432,441 ---- *----------------------------------------------------------------------- */ static bool ! SuffParseTransform( ! const char *str, /* String being parsed */ ! Suff **srcPtr, /* Place to store source of trans. */ ! Suff **targPtr) /* Place to store target of trans. */ { LstNode srcLn; /* element in suffix list of trans source*/ Suff *src; /* Source of transformation */ *************** *** 524,531 **** *----------------------------------------------------------------------- */ bool ! Suff_IsTransform(str) ! const char *str; /* string to check */ { Suff *src, *targ; --- 507,513 ---- *----------------------------------------------------------------------- */ bool ! Suff_IsTransform(const char *str) { Suff *src, *targ; *************** *** 547,554 **** *----------------------------------------------------------------------- */ GNode * ! Suff_AddTransform(line) ! const char *line; /* name of transformation to add */ { GNode *gn; /* GNode of transformation rule */ Suff *s, /* source suffix */ --- 529,535 ---- *----------------------------------------------------------------------- */ GNode * ! Suff_AddTransform(const char *line) { GNode *gn; /* GNode of transformation rule */ Suff *s, /* source suffix */ *************** *** 608,615 **** *----------------------------------------------------------------------- */ void ! Suff_EndTransform(gnp) ! void *gnp; /* Node for transformation */ { GNode *gn = (GNode *)gnp; --- 589,595 ---- *----------------------------------------------------------------------- */ void ! Suff_EndTransform(void *gnp) { GNode *gn = (GNode *)gnp; *************** *** 659,667 **** *----------------------------------------------------------------------- */ static void ! SuffRebuildGraph(transformp, sp) ! void *transformp; /* Transformation to test */ ! void *sp; /* Suffix to rebuild */ { GNode *transform = (GNode *)transformp; Suff *s = (Suff *)sp; --- 639,647 ---- *----------------------------------------------------------------------- */ static void ! SuffRebuildGraph( ! void *transformp, /* Transformation to test */ ! void *sp) /* Suffix to rebuild */ { GNode *transform = (GNode *)transformp; Suff *s = (Suff *)sp; *************** *** 712,719 **** *----------------------------------------------------------------------- */ void ! Suff_AddSuffix(str) ! char *str; /* the name of the suffix to add */ { Suff *s; /* new suffix descriptor */ LstNode ln; --- 692,698 ---- *----------------------------------------------------------------------- */ void ! Suff_AddSuffix(char *str) { Suff *s; /* new suffix descriptor */ LstNode ln; *************** *** 751,758 **** *----------------------------------------------------------------------- */ Lst ! Suff_GetPath(sname) ! char *sname; { LstNode ln; Suff *s; --- 730,736 ---- *----------------------------------------------------------------------- */ Lst ! Suff_GetPath(char *sname) { LstNode ln; Suff *s; *************** *** 782,788 **** *----------------------------------------------------------------------- */ void ! Suff_DoPaths() { Suff *s; LstNode ln; --- 760,766 ---- *----------------------------------------------------------------------- */ void ! Suff_DoPaths(void) { Suff *s; LstNode ln; *************** *** 832,839 **** *----------------------------------------------------------------------- */ void ! Suff_AddInclude(sname) ! char *sname; /* Name of suffix to mark */ { LstNode ln; Suff *s; --- 810,816 ---- *----------------------------------------------------------------------- */ void ! Suff_AddInclude(char *sname) /* Name of suffix to mark */ { LstNode ln; Suff *s; *************** *** 858,865 **** *----------------------------------------------------------------------- */ void ! Suff_AddLib(sname) ! char *sname; /* Name of suffix to mark */ { LstNode ln; Suff *s; --- 835,841 ---- *----------------------------------------------------------------------- */ void ! Suff_AddLib(char *sname) /* Name of suffix to mark */ { LstNode ln; Suff *s; *************** *** 885,893 **** *----------------------------------------------------------------------- */ static void ! SuffAddSrc(sp, lsp) ! void *sp; /* suffix for which to create a Src structure */ ! void *lsp; /* list and parent for the new Src */ { Suff *s = (Suff *)sp; LstSrc *ls = (LstSrc *)lsp; --- 861,869 ---- *----------------------------------------------------------------------- */ static void ! SuffAddSrc( ! void *sp, /* suffix for which to create a Src structure */ ! void *lsp) /* list and parent for the new Src */ { Suff *s = (Suff *)sp; LstSrc *ls = (LstSrc *)lsp; *************** *** 948,956 **** *----------------------------------------------------------------------- */ static void ! SuffAddLevel(l, targ) ! Lst l; /* list to which to add the new level */ ! Src *targ; /* Src structure to use as the parent */ { LstSrc ls; --- 924,932 ---- *----------------------------------------------------------------------- */ static void ! SuffAddLevel( ! Lst l, /* list to which to add the new level */ ! Src *targ) /* Src structure to use as the parent */ { LstSrc ls; *************** *** 973,980 **** *---------------------------------------------------------------------- */ static int ! SuffRemoveSrc(l) ! Lst l; { LstNode ln; Src *s; --- 949,955 ---- *---------------------------------------------------------------------- */ static int ! SuffRemoveSrc(Lst l) { LstNode ln; Src *s; *************** *** 1032,1040 **** *----------------------------------------------------------------------- */ static Src * ! SuffFindThem(srcs, slst) ! Lst srcs; /* list of Src structures to search through */ ! Lst slst; { Src *s; /* current Src */ Src *rs; /* returned Src */ --- 1007,1015 ---- *----------------------------------------------------------------------- */ static Src * ! SuffFindThem( ! Lst srcs, /* list of Src structures to search through */ ! Lst slst) { Src *s; /* current Src */ Src *rs; /* returned Src */ *************** *** 1097,1105 **** *----------------------------------------------------------------------- */ static Src * ! SuffFindCmds(targ, slst) ! Src *targ; /* Src structure to play with */ ! Lst slst; { LstNode ln; /* General-purpose list node */ GNode *t, /* Target GNode */ --- 1072,1080 ---- *----------------------------------------------------------------------- */ static Src * ! SuffFindCmds( ! Src *targ, /* Src structure to play with */ ! Lst slst) { LstNode ln; /* General-purpose list node */ GNode *t, /* Target GNode */ *************** *** 1168,1177 **** } static void ! SuffExpandVarChildren(after, cgn, pgn) ! LstNode after; ! GNode *cgn; ! GNode *pgn; { GNode *gn; /* New source 8) */ char *cp; /* Expanded value */ --- 1143,1149 ---- } static void ! SuffExpandVarChildren(LstNode after, GNode *cgn, GNode *pgn) { GNode *gn; /* New source 8) */ char *cp; /* Expanded value */ *************** *** 1256,1265 **** } static void ! SuffExpandWildChildren(after, cgn, pgn) ! LstNode after; ! GNode *cgn; ! GNode *pgn; { LstNode ln; /* List element for old source */ char *cp; /* Expanded value */ --- 1228,1234 ---- } static void ! SuffExpandWildChildren(LstNode after, GNode *cgn, GNode *pgn) { LstNode ln; /* List element for old source */ char *cp; /* Expanded value */ *************** *** 1327,1335 **** *----------------------------------------------------------------------- */ static void ! SuffExpandChildren(cgnp, pgnp) ! void *cgnp; /* Child to examine */ ! void *pgnp; /* Parent node being processed */ { GNode *cgn = (GNode *)cgnp; GNode *pgn = (GNode *)pgnp; --- 1296,1304 ---- *----------------------------------------------------------------------- */ static void ! SuffExpandChildren( ! void *cgnp, /* Child to examine */ ! void *pgnp) /* Parent node being processed */ { GNode *cgn = (GNode *)cgnp; GNode *pgn = (GNode *)pgnp; *************** *** 1374,1384 **** *----------------------------------------------------------------------- */ static bool ! SuffApplyTransform(tGn, sGn, t, s) ! GNode *tGn; /* Target node */ ! GNode *sGn; /* Source node */ ! Suff *t; /* Target suffix */ ! Suff *s; /* Source suffix */ { LstNode ln; /* General node */ LstNode np; /* Next node for loop */ --- 1343,1353 ---- *----------------------------------------------------------------------- */ static bool ! SuffApplyTransform( ! GNode *tGn, /* Target node */ ! GNode *sGn, /* Source node */ ! Suff *t, /* Target suffix */ ! Suff *s) /* Source suffix */ { LstNode ln; /* General node */ LstNode np; /* Next node for loop */ *************** *** 1456,1464 **** *----------------------------------------------------------------------- */ static void ! SuffFindArchiveDeps(gn, slst) ! GNode *gn; /* Node for which to locate dependencies */ ! Lst slst; { char *eoarch; /* End of archive portion */ char *eoname; /* End of member portion */ --- 1425,1433 ---- *----------------------------------------------------------------------- */ static void ! SuffFindArchiveDeps( ! GNode *gn, /* Node for which to locate dependencies */ ! Lst slst) { char *eoarch; /* End of archive portion */ char *eoname; /* End of member portion */ *************** *** 1551,1559 **** *----------------------------------------------------------------------- */ static void ! SuffFindNormalDeps(gn, slst) ! GNode *gn; /* Node for which to find sources */ ! Lst slst; { char *eoname; /* End of name */ char *sopref; /* Start of prefix */ --- 1520,1528 ---- *----------------------------------------------------------------------- */ static void ! SuffFindNormalDeps( ! GNode *gn, /* Node for which to find sources */ ! Lst slst) { char *eoname; /* End of name */ char *sopref; /* Start of prefix */ *************** *** 1873,1880 **** */ void ! Suff_FindDeps(gn) ! GNode *gn; { SuffFindDeps(gn, &srclist); --- 1842,1848 ---- */ void ! Suff_FindDeps(GNode *gn) { SuffFindDeps(gn, &srclist); *************** *** 1884,1892 **** static void ! SuffFindDeps(gn, slst) ! GNode *gn; /* node we're dealing with */ ! Lst slst; { if (gn->type & OP_DEPS_FOUND) { /* --- 1852,1858 ---- static void ! SuffFindDeps(GNode *gn, Lst slst) { if (gn->type & OP_DEPS_FOUND) { /* *************** *** 1947,1954 **** *----------------------------------------------------------------------- */ void ! Suff_SetNull(name) ! char *name; /* Name of null suffix */ { Suff *s; LstNode ln; --- 1913,1919 ---- *----------------------------------------------------------------------- */ void ! Suff_SetNull(char *name) { Suff *s; LstNode ln; *************** *** 1980,1986 **** *----------------------------------------------------------------------- */ void ! Suff_Init() { Static_Lst_Init(&sufflist); #ifdef CLEANUP --- 1945,1951 ---- *----------------------------------------------------------------------- */ void ! Suff_Init(void) { Static_Lst_Init(&sufflist); #ifdef CLEANUP *************** *** 2022,2028 **** #ifdef CLEANUP void ! Suff_End() { Lst_Destroy(&sufflist, SuffFree); Lst_Destroy(&suffClean, SuffFree); --- 1987,1993 ---- #ifdef CLEANUP void ! Suff_End(void) { Lst_Destroy(&sufflist, SuffFree); Lst_Destroy(&suffClean, SuffFree); *************** *** 2036,2050 **** /********************* DEBUGGING FUNCTIONS **********************/ ! static void SuffPrintName(s) ! void *s; { printf("%s ", ((Suff *)s)->name); } static void ! SuffPrintSuff(sp) ! void *sp; { Suff *s = (Suff *)sp; int flags; --- 2001,2013 ---- /********************* DEBUGGING FUNCTIONS **********************/ ! static void SuffPrintName(void *s) { printf("%s ", ((Suff *)s)->name); } static void ! SuffPrintSuff(void *sp) { Suff *s = (Suff *)sp; int flags; *************** *** 2085,2092 **** } static void ! SuffPrintTrans(tp) ! void *tp; { GNode *t = (GNode *)tp; --- 2048,2054 ---- } static void ! SuffPrintTrans(void *tp) { GNode *t = (GNode *)tp; *************** *** 2098,2104 **** } void ! Suff_PrintAll() { printf("#*** Suffixes:\n"); Lst_Every(&sufflist, SuffPrintSuff); --- 2060,2066 ---- } void ! Suff_PrintAll(void) { printf("#*** Suffixes:\n"); Lst_Every(&sufflist, SuffPrintSuff); *************** *** 2109,2116 **** #ifdef DEBUG_SRC static void ! PrintAddr(a) ! void *a; { printf("%lx ", (unsigned long)a); } --- 2071,2077 ---- #ifdef DEBUG_SRC static void ! PrintAddr(void *a) { printf("%lx ", (unsigned long)a); }