Changeset 24 for branches/FREEBSD/src/kmk/suff.c
- Timestamp:
- Nov 26, 2002, 10:24:54 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/FREEBSD/src/kmk/suff.c
r10 r24 35 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 36 * SUCH DAMAGE. 37 * 38 * @(#)suff.c 8.4 (Berkeley) 3/21/94 39 */ 40 41 #include <sys/cdefs.h> 42 __FBSDID("$FreeBSD: src/usr.bin/make/suff.c,v 1.26 2002/10/09 03:42:10 jmallett Exp $"); 37 */ 38 39 #ifndef lint 40 #if 0 41 static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; 42 #else 43 static const char rcsid[] = 44 "$FreeBSD: src/usr.bin/make/suff.c,v 1.12.2.1 2001/03/09 01:13:24 tmm Exp $"; 45 #endif 46 #endif /* not lint */ 43 47 44 48 /*- … … 89 93 * Suff_FindDeps Find implicit sources for and the location of 90 94 * a target based on its suffix. Returns the 91 * bottom-most node added to the graph or N ULL95 * bottom-most node added to the graph or NILGNODE 92 96 * if the target had no implicit sources. 93 97 */ … … 112 116 int nameLen; /* Length of the suffix */ 113 117 short flags; /* Type of suffix */ 114 #define 115 #define 116 #define 118 #define SUFF_INCLUDE 0x01 /* One which is #include'd */ 119 #define SUFF_LIBRARY 0x02 /* One which contains a library */ 120 #define SUFF_NULL 0x04 /* The empty suffix */ 117 121 Lst searchPath; /* The path along which files of this suffix 118 122 * may be found */ … … 154 158 155 159 156 static char *SuffStrIsPrefix (char *, char *);157 static char *SuffSuffIsSuffix (Suff *, char *);158 static int SuffSuffIsSuffixP (void *, void *);159 static int SuffSuffHasNameP (void *, void *);160 static int SuffSuffIsPrefix (void *, void *);161 static int SuffGNHasNameP (void *, void *);162 static void SuffFree (void *);163 static void SuffInsert (Lst, Suff *);164 static void SuffRemove (Lst, Suff *);165 static Boolean SuffParseTransform (char *, Suff **, Suff **);166 static int SuffRebuildGraph (void *, void *);167 static int SuffAddSrc (void *, void *);168 static int SuffRemoveSrc (Lst);169 static void SuffAddLevel (Lst, Src *);170 static Src *SuffFindThem (Lst, Lst);171 static Src *SuffFindCmds (Src *, Lst);172 static int SuffExpandChildren (void *, void *);173 static Boolean SuffApplyTransform (GNode *, GNode *, Suff *, Suff *);174 static void SuffFindDeps (GNode *, Lst);175 static void SuffFindArchiveDeps (GNode *, Lst);176 static void SuffFindNormalDeps (GNode *, Lst);177 static int SuffPrintName (void *, void *);178 static int SuffPrintSuff (void *, void *);179 static int SuffPrintTrans (void *, void *);160 static char *SuffStrIsPrefix __P((char *, char *)); 161 static char *SuffSuffIsSuffix __P((Suff *, char *)); 162 static int SuffSuffIsSuffixP __P((ClientData, ClientData)); 163 static int SuffSuffHasNameP __P((ClientData, ClientData)); 164 static int SuffSuffIsPrefix __P((ClientData, ClientData)); 165 static int SuffGNHasNameP __P((ClientData, ClientData)); 166 static void SuffFree __P((ClientData)); 167 static void SuffInsert __P((Lst, Suff *)); 168 static void SuffRemove __P((Lst, Suff *)); 169 static Boolean SuffParseTransform __P((char *, Suff **, Suff **)); 170 static int SuffRebuildGraph __P((ClientData, ClientData)); 171 static int SuffAddSrc __P((ClientData, ClientData)); 172 static int SuffRemoveSrc __P((Lst)); 173 static void SuffAddLevel __P((Lst, Src *)); 174 static Src *SuffFindThem __P((Lst, Lst)); 175 static Src *SuffFindCmds __P((Src *, Lst)); 176 static int SuffExpandChildren __P((ClientData, ClientData)); 177 static Boolean SuffApplyTransform __P((GNode *, GNode *, Suff *, Suff *)); 178 static void SuffFindDeps __P((GNode *, Lst)); 179 static void SuffFindArchiveDeps __P((GNode *, Lst)); 180 static void SuffFindNormalDeps __P((GNode *, Lst)); 181 static int SuffPrintName __P((ClientData, ClientData)); 182 static int SuffPrintSuff __P((ClientData, ClientData)); 183 static int SuffPrintTrans __P((ClientData, ClientData)); 180 184 181 185 /*************** Lst Predicates ****************/ … … 193 197 */ 194 198 static char * 195 SuffStrIsPrefix (char *pref, char *str) 199 SuffStrIsPrefix (pref, str) 200 register char *pref; /* possible prefix */ 201 register char *str; /* string to check */ 196 202 { 197 203 while (*str && *pref == *str) { … … 218 224 */ 219 225 static char * 220 SuffSuffIsSuffix (Suff *s, char *str) 221 { 222 char *p1; /* Pointer into suffix name */ 223 char *p2; /* Pointer into string being examined */ 226 SuffSuffIsSuffix (s, str) 227 register Suff *s; /* possible suffix */ 228 char *str; /* string to examine */ 229 { 230 register char *p1; /* Pointer into suffix name */ 231 register char *p2; /* Pointer into string being examined */ 224 232 225 233 p1 = s->name + s->nameLen; … … 249 257 */ 250 258 static int 251 SuffSuffIsSuffixP(void *s, void *str) 259 SuffSuffIsSuffixP(s, str) 260 ClientData s; 261 ClientData str; 252 262 { 253 263 return(!SuffSuffIsSuffix((Suff *) s, (char *) str)); … … 268 278 */ 269 279 static int 270 SuffSuffHasNameP (void *s, void *sname) 280 SuffSuffHasNameP (s, sname) 281 ClientData s; /* Suffix to check */ 282 ClientData sname; /* Desired name */ 271 283 { 272 284 return (strcmp ((char *) sname, ((Suff *) s)->name)); … … 289 301 */ 290 302 static int 291 SuffSuffIsPrefix (void *s, void *str) 303 SuffSuffIsPrefix (s, str) 304 ClientData s; /* suffix to compare */ 305 ClientData str; /* string to examine */ 292 306 { 293 307 return (SuffStrIsPrefix (((Suff *) s)->name, (char *) str) == NULL ? 1 : 0); … … 307 321 */ 308 322 static int 309 SuffGNHasNameP (void *gn, void *name) 323 SuffGNHasNameP (gn, name) 324 ClientData gn; /* current node we're looking at */ 325 ClientData name; /* name we're looking for */ 310 326 { 311 327 return (strcmp ((char *) name, ((GNode *) gn)->name)); … … 327 343 */ 328 344 static void 329 SuffFree (void *sp) 345 SuffFree (sp) 346 ClientData sp; 330 347 { 331 348 Suff *s = (Suff *) sp; … … 342 359 Lst_Destroy (s->searchPath, Dir_Destroy); 343 360 344 free ( s->name);345 free ( s);361 free ((Address)s->name); 362 free ((Address)s); 346 363 } 347 364 … … 359 376 */ 360 377 static void 361 SuffRemove(Lst l, Suff *s) 362 { 363 LstNode ln = Lst_Member(l, (void *)s); 364 if (ln != NULL) { 378 SuffRemove(l, s) 379 Lst l; 380 Suff *s; 381 { 382 LstNode ln = Lst_Member(l, (ClientData)s); 383 if (ln != NILLNODE) { 365 384 Lst_Remove(l, ln); 366 385 s->refCount--; … … 383 402 */ 384 403 static void 385 SuffInsert (Lst l, Suff *s) 404 SuffInsert (l, s) 405 Lst l; /* the list where in s should be inserted */ 406 Suff *s; /* the suffix to insert */ 386 407 { 387 408 LstNode ln; /* current element in l we're examining */ … … 391 412 return; 392 413 } 393 while ((ln = Lst_Next (l)) != N ULL) {414 while ((ln = Lst_Next (l)) != NILLNODE) { 394 415 s2 = (Suff *) Lst_Datum (ln); 395 416 if (s2->sNum >= s->sNum) { … … 397 418 } 398 419 } 399 if (s2 == NULL) {400 DEBUGF(SUFF, ("inserting an empty list?..."));401 }402 420 403 421 Lst_Close (l); 404 DEBUGF(SUFF, ("inserting %s(%d)...", s->name, s->sNum)); 405 if (ln == NULL) { 406 DEBUGF(SUFF, ("at end of list\n")); 407 (void)Lst_AtEnd (l, (void *)s); 422 if (DEBUG(SUFF)) { 423 printf("inserting %s(%d)...", s->name, s->sNum); 424 } 425 if (ln == NILLNODE) { 426 if (DEBUG(SUFF)) { 427 printf("at end of list\n"); 428 } 429 (void)Lst_AtEnd (l, (ClientData)s); 408 430 s->refCount++; 409 (void)Lst_AtEnd(s->ref, ( void *) l);431 (void)Lst_AtEnd(s->ref, (ClientData) l); 410 432 } else if (s2->sNum != s->sNum) { 411 DEBUGF(SUFF, ("before %s(%d)\n", s2->name, s2->sNum)); 412 (void)Lst_Insert (l, ln, (void *)s); 433 if (DEBUG(SUFF)) { 434 printf("before %s(%d)\n", s2->name, s2->sNum); 435 } 436 (void)Lst_Insert (l, ln, (ClientData)s); 413 437 s->refCount++; 414 (void)Lst_AtEnd(s->ref, ( void *) l);415 } else {416 DEBUGF(SUFF, ("already there\n"));438 (void)Lst_AtEnd(s->ref, (ClientData) l); 439 } else if (DEBUG(SUFF)) { 440 printf("already there\n"); 417 441 } 418 442 } … … 436 460 */ 437 461 void 438 Suff_ClearSuffixes ( void)462 Suff_ClearSuffixes () 439 463 { 440 464 Lst_Concat (suffClean, sufflist, LST_CONCLINK); … … 448 472 * suffNull should not have parents. 449 473 */ 450 Lst_Destroy(suffNull->children, NOFREE); 474 Lst_Destroy(suffNull->children, NOFREE); 451 475 suffNull->children = Lst_Init(FALSE); 452 476 } … … 466 490 */ 467 491 static Boolean 468 SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr) 469 { 470 LstNode srcLn; /* element in suffix list of trans source*/ 471 Suff *src; /* Source of transformation */ 472 LstNode targLn; /* element in suffix list of trans target*/ 473 char *str2; /* Extra pointer (maybe target suffix) */ 492 SuffParseTransform(str, srcPtr, targPtr) 493 char *str; /* String being parsed */ 494 Suff **srcPtr; /* Place to store source of trans. */ 495 Suff **targPtr; /* Place to store target of trans. */ 496 { 497 register LstNode srcLn; /* element in suffix list of trans source*/ 498 register Suff *src; /* Source of transformation */ 499 register LstNode targLn; /* element in suffix list of trans target*/ 500 register char *str2; /* Extra pointer (maybe target suffix) */ 474 501 LstNode singleLn; /* element in suffix list of any suffix 475 502 * that exactly matches str */ … … 477 504 * null suffix */ 478 505 479 srcLn = N ULL;480 singleLn = N ULL;506 srcLn = NILLNODE; 507 singleLn = NILLNODE; 481 508 482 509 /* … … 487 514 */ 488 515 for (;;) { 489 if (srcLn == N ULL) {490 srcLn = Lst_Find(sufflist, ( void *)str, SuffSuffIsPrefix);516 if (srcLn == NILLNODE) { 517 srcLn = Lst_Find(sufflist, (ClientData)str, SuffSuffIsPrefix); 491 518 } else { 492 srcLn = Lst_FindFrom (sufflist, Lst_Succ(srcLn), ( void *)str,519 srcLn = Lst_FindFrom (sufflist, Lst_Succ(srcLn), (ClientData)str, 493 520 SuffSuffIsPrefix); 494 521 } 495 if (srcLn == N ULL) {522 if (srcLn == NILLNODE) { 496 523 /* 497 524 * Ran out of source suffixes -- no such rule 498 525 */ 499 if (singleLn != N ULL) {526 if (singleLn != NILLNODE) { 500 527 /* 501 528 * Not so fast Mr. Smith! There was a suffix that encompassed … … 519 546 singleLn = srcLn; 520 547 } else { 521 targLn = Lst_Find(sufflist, ( void *)str2, SuffSuffHasNameP);522 if (targLn != N ULL) {548 targLn = Lst_Find(sufflist, (ClientData)str2, SuffSuffHasNameP); 549 if (targLn != NILLNODE) { 523 550 *srcPtr = src; 524 551 *targPtr = (Suff *)Lst_Datum(targLn); … … 544 571 */ 545 572 Boolean 546 Suff_IsTransform (char *str) 573 Suff_IsTransform (str) 574 char *str; /* string to check */ 547 575 { 548 576 Suff *src, *targ; … … 566 594 */ 567 595 GNode * 568 Suff_AddTransform (char *line) 596 Suff_AddTransform (line) 597 char *line; /* name of transformation to add */ 569 598 { 570 599 GNode *gn; /* GNode of transformation rule */ … … 573 602 LstNode ln; /* Node for existing transformation */ 574 603 575 ln = Lst_Find (transforms, ( void *)line, SuffGNHasNameP);576 if (ln == N ULL) {604 ln = Lst_Find (transforms, (ClientData)line, SuffGNHasNameP); 605 if (ln == NILLNODE) { 577 606 /* 578 607 * Make a new graph node for the transformation. It will be filled in … … 580 609 */ 581 610 gn = Targ_NewGN (line); 582 (void)Lst_AtEnd (transforms, ( void *)gn);611 (void)Lst_AtEnd (transforms, (ClientData)gn); 583 612 } else { 584 613 /* … … 602 631 * link the two together in the proper relationship and order 603 632 */ 604 DEBUGF(SUFF, ("defining transformation from `%s' to `%s'\n", 605 s->name, t->name)); 633 if (DEBUG(SUFF)) { 634 printf("defining transformation from `%s' to `%s'\n", 635 s->name, t->name); 636 } 606 637 SuffInsert (t->children, s); 607 638 SuffInsert (s->parents, t); … … 628 659 */ 629 660 int 630 Suff_EndTransform(void *gnp, void *dummy __unused) 661 Suff_EndTransform(gnp, dummy) 662 ClientData gnp; /* Node for transformation */ 663 ClientData dummy; /* Node for transformation */ 631 664 { 632 665 GNode *gn = (GNode *) gnp; … … 639 672 (void)SuffParseTransform(gn->name, &s, &t); 640 673 641 DEBUGF(SUFF, ("deleting transformation from `%s' to `%s'\n", 642 s->name, t->name)); 674 if (DEBUG(SUFF)) { 675 printf("deleting transformation from `%s' to `%s'\n", 676 s->name, t->name); 677 } 643 678 644 679 /* 645 680 * Remove the source from the target's children list. We check for a 646 * NULLreturn to handle a beanhead saying something like681 * nil return to handle a beanhead saying something like 647 682 * .c.o .c.o: 648 683 * … … 656 691 */ 657 692 SuffRemove(s->parents, t); 658 } else if ( gn->type & OP_TRANSFORM) {659 DEBUGF(SUFF, ("transformation %s complete\n", gn->name));660 } 661 662 return (0);693 } else if ((gn->type & OP_TRANSFORM) && DEBUG(SUFF)) { 694 printf("transformation %s complete\n", gn->name); 695 } 696 697 return(dummy ? 0 : 0); 663 698 } 664 699 … … 683 718 */ 684 719 static int 685 SuffRebuildGraph(void *transformp, void *sp) 720 SuffRebuildGraph(transformp, sp) 721 ClientData transformp; /* Transformation to test */ 722 ClientData sp; /* Suffix to rebuild */ 686 723 { 687 724 GNode *transform = (GNode *) transformp; … … 696 733 cp = SuffStrIsPrefix(s->name, transform->name); 697 734 if (cp != (char *)NULL) { 698 735 if (cp[0] == '\0') /* null rule */ 699 736 s2 = suffNull; 700 737 else { 701 ln = Lst_Find(sufflist, ( void *)cp, SuffSuffHasNameP);702 if (ln != N ULL)703 738 ln = Lst_Find(sufflist, (ClientData)cp, SuffSuffHasNameP); 739 if (ln != NILLNODE) 740 s2 = (Suff *)Lst_Datum(ln); 704 741 } 705 742 if (s2 != NULL) { … … 723 760 */ 724 761 cp[1] = '\0'; 725 ln = Lst_Find(sufflist, ( void *)transform->name, SuffSuffHasNameP);762 ln = Lst_Find(sufflist, (ClientData)transform->name, SuffSuffHasNameP); 726 763 /* 727 764 * Replace the start of the target suffix 728 765 */ 729 766 cp[1] = s->name[0]; 730 if (ln != N ULL) {767 if (ln != NILLNODE) { 731 768 /* 732 769 * Found it -- establish the proper relationship … … 755 792 */ 756 793 void 757 Suff_AddSuffix (char *str) 794 Suff_AddSuffix (str) 795 char *str; /* the name of the suffix to add */ 758 796 { 759 797 Suff *s; /* new suffix descriptor */ 760 798 LstNode ln; 761 799 762 ln = Lst_Find (sufflist, ( void *)str, SuffSuffHasNameP);763 if (ln == N ULL) {800 ln = Lst_Find (sufflist, (ClientData)str, SuffSuffHasNameP); 801 if (ln == NILLNODE) { 764 802 s = (Suff *) emalloc (sizeof (Suff)); 765 803 … … 774 812 s->refCount = 0; 775 813 776 (void)Lst_AtEnd (sufflist, ( void *)s);814 (void)Lst_AtEnd (sufflist, (ClientData)s); 777 815 /* 778 816 * Look for any existing transformations from or to this suffix. 779 817 * XXX: Only do this after a Suff_ClearSuffixes? 780 818 */ 781 Lst_ForEach (transforms, SuffRebuildGraph, ( void *)s);819 Lst_ForEach (transforms, SuffRebuildGraph, (ClientData)s); 782 820 } 783 821 } … … 789 827 * 790 828 * Results: 791 * The searchPath for the desired suffix or N ULLif the suffix isn't829 * The searchPath for the desired suffix or NILLST if the suffix isn't 792 830 * defined. 793 831 * … … 797 835 */ 798 836 Lst 799 Suff_GetPath (char *sname) 837 Suff_GetPath (sname) 838 char *sname; 800 839 { 801 840 LstNode ln; 802 841 Suff *s; 803 842 804 ln = Lst_Find (sufflist, ( void *)sname, SuffSuffHasNameP);805 if (ln == N ULL) {806 return (N ULL);843 ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP); 844 if (ln == NILLNODE) { 845 return (NILLST); 807 846 } else { 808 847 s = (Suff *) Lst_Datum (ln); … … 824 863 * directories in dirSearchPath. If paths were specified for the 825 864 * ".h" suffix, the directories are stuffed into a global variable 826 * called ".INCLUDES" with each directory prece ded by a -I. The same865 * called ".INCLUDES" with each directory preceeded by a -I. The same 827 866 * is done for the ".a" suffix, except the variable is called 828 867 * ".LIBS" and the flag is -L. … … 830 869 */ 831 870 void 832 Suff_DoPaths( void)833 { 834 Suff*s;835 LstNodeln;871 Suff_DoPaths() 872 { 873 register Suff *s; 874 register LstNode ln; 836 875 char *ptr; 837 876 Lst inIncludes; /* Cumulative .INCLUDES path */ … … 845 884 inLibs = Lst_Init(FALSE); 846 885 847 while ((ln = Lst_Next (sufflist)) != N ULL) {886 while ((ln = Lst_Next (sufflist)) != NILLNODE) { 848 887 s = (Suff *) Lst_Datum (ln); 849 888 if (!Lst_IsEmpty (s->searchPath)) { … … 892 931 */ 893 932 void 894 Suff_AddInclude (char *sname) 933 Suff_AddInclude (sname) 934 char *sname; /* Name of suffix to mark */ 895 935 { 896 936 LstNode ln; 897 937 Suff *s; 898 938 899 ln = Lst_Find (sufflist, ( void *)sname, SuffSuffHasNameP);900 if (ln != N ULL) {939 ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP); 940 if (ln != NILLNODE) { 901 941 s = (Suff *) Lst_Datum (ln); 902 942 s->flags |= SUFF_INCLUDE; … … 921 961 */ 922 962 void 923 Suff_AddLib (char *sname) 963 Suff_AddLib (sname) 964 char *sname; /* Name of suffix to mark */ 924 965 { 925 966 LstNode ln; 926 967 Suff *s; 927 968 928 ln = Lst_Find (sufflist, ( void *)sname, SuffSuffHasNameP);929 if (ln != N ULL) {969 ln = Lst_Find (sufflist, (ClientData)sname, SuffSuffHasNameP); 970 if (ln != NILLNODE) { 930 971 s = (Suff *) Lst_Datum (ln); 931 972 s->flags |= SUFF_LIBRARY; … … 950 991 */ 951 992 static int 952 SuffAddSrc (void *sp, void *lsp) 993 SuffAddSrc (sp, lsp) 994 ClientData sp; /* suffix for which to create a Src structure */ 995 ClientData lsp; /* list and parent for the new Src */ 953 996 { 954 997 Suff *s = (Suff *) sp; … … 969 1012 s2->pref = targ->pref; 970 1013 s2->parent = targ; 971 s2->node = N ULL;1014 s2->node = NILGNODE; 972 1015 s2->suff = s; 973 1016 s->refCount++; 974 1017 s2->children = 0; 975 1018 targ->children += 1; 976 (void)Lst_AtEnd (ls->l, ( void *)s2);1019 (void)Lst_AtEnd (ls->l, (ClientData)s2); 977 1020 #ifdef DEBUG_SRC 978 1021 s2->cp = Lst_Init(FALSE); 979 Lst_AtEnd(targ->cp, ( void *) s2);1022 Lst_AtEnd(targ->cp, (ClientData) s2); 980 1023 printf("1 add %x %x to %x:", targ, s2, ls->l); 981 Lst_ForEach(ls->l, PrintAddr, ( void *) 0);1024 Lst_ForEach(ls->l, PrintAddr, (ClientData) 0); 982 1025 printf("\n"); 983 1026 #endif … … 987 1030 s2->pref = targ->pref; 988 1031 s2->parent = targ; 989 s2->node = N ULL;1032 s2->node = NILGNODE; 990 1033 s2->suff = s; 991 1034 s->refCount++; 992 1035 s2->children = 0; 993 1036 targ->children += 1; 994 (void)Lst_AtEnd (ls->l, ( void *)s2);1037 (void)Lst_AtEnd (ls->l, (ClientData)s2); 995 1038 #ifdef DEBUG_SRC 996 1039 s2->cp = Lst_Init(FALSE); 997 Lst_AtEnd(targ->cp, ( void *) s2);1040 Lst_AtEnd(targ->cp, (ClientData) s2); 998 1041 printf("2 add %x %x to %x:", targ, s2, ls->l); 999 Lst_ForEach(ls->l, PrintAddr, ( void *) 0);1042 Lst_ForEach(ls->l, PrintAddr, (ClientData) 0); 1000 1043 printf("\n"); 1001 1044 #endif … … 1017 1060 */ 1018 1061 static void 1019 SuffAddLevel (Lst l, Src *targ) 1062 SuffAddLevel (l, targ) 1063 Lst l; /* list to which to add the new level */ 1064 Src *targ; /* Src structure to use as the parent */ 1020 1065 { 1021 1066 LstSrc ls; … … 1024 1069 ls.l = l; 1025 1070 1026 Lst_ForEach (targ->suff->children, SuffAddSrc, ( void *)&ls);1071 Lst_ForEach (targ->suff->children, SuffAddSrc, (ClientData)&ls); 1027 1072 } 1028 1073 … … 1040 1085 */ 1041 1086 static int 1042 SuffRemoveSrc (Lst l) 1087 SuffRemoveSrc (l) 1088 Lst l; 1043 1089 { 1044 1090 LstNode ln; … … 1051 1097 #ifdef DEBUG_SRC 1052 1098 printf("cleaning %lx: ", (unsigned long) l); 1053 Lst_ForEach(l, PrintAddr, ( void *) 0);1099 Lst_ForEach(l, PrintAddr, (ClientData) 0); 1054 1100 printf("\n"); 1055 1101 #endif 1056 1102 1057 1103 1058 while ((ln = Lst_Next (l)) != N ULL) {1104 while ((ln = Lst_Next (l)) != NILLNODE) { 1059 1105 s = (Src *) Lst_Datum (ln); 1060 1106 if (s->children == 0) { 1061 free ( s->file);1107 free ((Address)s->file); 1062 1108 if (!s->parent) 1063 free( s->pref);1109 free((Address)s->pref); 1064 1110 else { 1065 1111 #ifdef DEBUG_SRC 1066 LstNode ln = Lst_Member(s->parent->cp, ( void *)s);1067 if (ln != N ULL)1112 LstNode ln = Lst_Member(s->parent->cp, (ClientData)s); 1113 if (ln != NILLNODE) 1068 1114 Lst_Remove(s->parent->cp, ln); 1069 1115 #endif … … 1075 1121 #endif 1076 1122 Lst_Remove(l, ln); 1077 free ( s);1123 free ((Address)s); 1078 1124 t |= 1; 1079 1125 Lst_Close(l); … … 1083 1129 else { 1084 1130 printf("keep: [l=%x] p=%x %d: ", l, s, s->children); 1085 Lst_ForEach(s->cp, PrintAddr, ( void *) 0);1131 Lst_ForEach(s->cp, PrintAddr, (ClientData) 0); 1086 1132 printf("\n"); 1087 1133 } … … 1107 1153 */ 1108 1154 static Src * 1109 SuffFindThem (Lst srcs, Lst slst) 1155 SuffFindThem (srcs, slst) 1156 Lst srcs; /* list of Src structures to search through */ 1157 Lst slst; 1110 1158 { 1111 1159 Src *s; /* current Src */ … … 1118 1166 s = (Src *) Lst_DeQueue (srcs); 1119 1167 1120 DEBUGF(SUFF, ("\ttrying %s...", s->file)); 1168 if (DEBUG(SUFF)) { 1169 printf ("\ttrying %s...", s->file); 1170 } 1121 1171 1122 1172 /* … … 1124 1174 * graph for it or the file actually exists. 1125 1175 */ 1126 if (Targ_FindNode(s->file, TARG_NOCREATE) != N ULL) {1176 if (Targ_FindNode(s->file, TARG_NOCREATE) != NILGNODE) { 1127 1177 #ifdef DEBUG_SRC 1128 1178 printf("remove %x from %x\n", s, srcs); … … 1141 1191 } 1142 1192 1143 DEBUGF(SUFF, ("not there\n")); 1193 if (DEBUG(SUFF)) { 1194 printf ("not there\n"); 1195 } 1144 1196 1145 1197 SuffAddLevel (srcs, s); 1146 Lst_AtEnd(slst, ( void *) s);1147 } 1148 1149 if ( rs) {1150 DEBUGF(SUFF, ("got it\n"));1198 Lst_AtEnd(slst, (ClientData) s); 1199 } 1200 1201 if (DEBUG(SUFF) && rs) { 1202 printf ("got it\n"); 1151 1203 } 1152 1204 return (rs); … … 1161 1213 * 1162 1214 * Results: 1163 * The Src structure of the "winning" child, or N ULL if no such beast.1215 * The Src structure of the "winning" child, or NIL if no such beast. 1164 1216 * 1165 1217 * Side Effects: … … 1169 1221 */ 1170 1222 static Src * 1171 SuffFindCmds (Src *targ, Lst slst) 1223 SuffFindCmds (targ, slst) 1224 Src *targ; /* Src structure to play with */ 1225 Lst slst; 1172 1226 { 1173 1227 LstNode ln; /* General-purpose list node */ 1174 GNode*t, /* Target GNode */1228 register GNode *t, /* Target GNode */ 1175 1229 *s; /* Source GNode */ 1176 1230 int prefLen;/* The length of the defined prefix */ … … 1183 1237 prefLen = strlen (targ->pref); 1184 1238 1185 while ((ln = Lst_Next (t->children)) != N ULL) {1239 while ((ln = Lst_Next (t->children)) != NILLNODE) { 1186 1240 s = (GNode *)Lst_Datum (ln); 1187 1241 … … 1197 1251 * suffix. 1198 1252 */ 1199 ln = Lst_Find (sufflist, ( void *)&cp[prefLen],1253 ln = Lst_Find (sufflist, (ClientData)&cp[prefLen], 1200 1254 SuffSuffHasNameP); 1201 if (ln != N ULL) {1255 if (ln != NILLNODE) { 1202 1256 /* 1203 1257 * It even has a known suffix, see if there's a transformation … … 1209 1263 1210 1264 if (Lst_Member (suff->parents, 1211 ( void *)targ->suff) != NULL)1265 (ClientData)targ->suff) != NILLNODE) 1212 1266 { 1213 1267 /* … … 1229 1283 ret->cp = Lst_Init(FALSE); 1230 1284 printf("3 add %x %x\n", targ, ret); 1231 Lst_AtEnd(targ->cp, ( void *) ret);1285 Lst_AtEnd(targ->cp, (ClientData) ret); 1232 1286 #endif 1233 Lst_AtEnd(slst, (void *) ret); 1234 DEBUGF(SUFF, ("\tusing existing source %s\n", s->name)); 1287 Lst_AtEnd(slst, (ClientData) ret); 1288 if (DEBUG(SUFF)) { 1289 printf ("\tusing existing source %s\n", s->name); 1290 } 1235 1291 return (ret); 1236 1292 } … … 1259 1315 */ 1260 1316 static int 1261 SuffExpandChildren(void *cgnp, void *pgnp) 1317 SuffExpandChildren(cgnp, pgnp) 1318 ClientData cgnp; /* Child to examine */ 1319 ClientData pgnp; /* Parent node being processed */ 1262 1320 { 1263 1321 GNode *cgn = (GNode *) cgnp; … … 1272 1330 * after the child 1273 1331 */ 1274 prevLN = Lst_Member(pgn->children, ( void *)cgn);1332 prevLN = Lst_Member(pgn->children, (ClientData)cgn); 1275 1333 1276 1334 /* … … 1281 1339 */ 1282 1340 if (strchr(cgn->name, '$') != (char *)NULL) { 1283 DEBUGF(SUFF, ("Expanding \"%s\"...", cgn->name)); 1341 if (DEBUG(SUFF)) { 1342 printf("Expanding \"%s\"...", cgn->name); 1343 } 1284 1344 cp = Var_Subst(NULL, cgn->name, pgn, TRUE); 1285 1345 … … 1317 1377 *cp++ = '\0'; 1318 1378 gn = Targ_FindNode(start, TARG_CREATE); 1319 (void)Lst_AtEnd(members, ( void *)gn);1379 (void)Lst_AtEnd(members, (ClientData)gn); 1320 1380 while (*cp == ' ' || *cp == '\t') { 1321 1381 cp++; … … 1356 1416 */ 1357 1417 gn = Targ_FindNode(start, TARG_CREATE); 1358 (void)Lst_AtEnd(members, ( void *)gn);1418 (void)Lst_AtEnd(members, (ClientData)gn); 1359 1419 } 1360 1420 /* … … 1370 1430 gn = (GNode *)Lst_DeQueue(members); 1371 1431 1372 DEBUGF(SUFF, ("%s...", gn->name)); 1373 if (Lst_Member(pgn->children, (void *)gn) == NULL) { 1374 (void)Lst_Append(pgn->children, prevLN, (void *)gn); 1432 if (DEBUG(SUFF)) { 1433 printf("%s...", gn->name); 1434 } 1435 if (Lst_Member(pgn->children, (ClientData)gn) == NILLNODE) { 1436 (void)Lst_Append(pgn->children, prevLN, (ClientData)gn); 1375 1437 prevLN = Lst_Succ(prevLN); 1376 (void)Lst_AtEnd(gn->parents, ( void *)pgn);1438 (void)Lst_AtEnd(gn->parents, (ClientData)pgn); 1377 1439 pgn->unmade++; 1378 1440 } … … 1388 1450 * keep it from being processed. 1389 1451 */ 1390 ln = Lst_Member(pgn->children, ( void *)cgn);1452 ln = Lst_Member(pgn->children, (ClientData)cgn); 1391 1453 pgn->unmade--; 1392 1454 Lst_Remove(pgn->children, ln); 1393 DEBUGF(SUFF, ("\n")); 1455 if (DEBUG(SUFF)) { 1456 printf("\n"); 1457 } 1394 1458 } else if (Dir_HasWildcards(cgn->name)) { 1395 1459 Lst exp; /* List of expansions */ … … 1405 1469 */ 1406 1470 cp = cgn->name + strlen(cgn->name); 1407 ln = Lst_Find(sufflist, (void *)cp, SuffSuffIsSuffixP); 1408 1409 DEBUGF(SUFF, ("Wildcard expanding \"%s\"...", cgn->name)); 1410 1411 if (ln != NULL) { 1471 ln = Lst_Find(sufflist, (ClientData)cp, SuffSuffIsSuffixP); 1472 1473 if (DEBUG(SUFF)) { 1474 printf("Wildcard expanding \"%s\"...", cgn->name); 1475 } 1476 1477 if (ln != NILLNODE) { 1412 1478 Suff *s = (Suff *)Lst_Datum(ln); 1413 1479 1414 DEBUGF(SUFF, ("suffix is \"%s\"...", s->name)); 1480 if (DEBUG(SUFF)) { 1481 printf("suffix is \"%s\"...", s->name); 1482 } 1415 1483 path = s->searchPath; 1416 1484 } else { … … 1433 1501 cp = (char *)Lst_DeQueue(exp); 1434 1502 1435 DEBUGF(SUFF, ("%s...", cp)); 1503 if (DEBUG(SUFF)) { 1504 printf("%s...", cp); 1505 } 1436 1506 gn = Targ_FindNode(cp, TARG_CREATE); 1437 1507 … … 1440 1510 * up the parent's count of unmade children. 1441 1511 */ 1442 if (Lst_Member(pgn->children, ( void *)gn) == NULL) {1443 (void)Lst_Append(pgn->children, prevLN, ( void *)gn);1512 if (Lst_Member(pgn->children, (ClientData)gn) == NILLNODE) { 1513 (void)Lst_Append(pgn->children, prevLN, (ClientData)gn); 1444 1514 prevLN = Lst_Succ(prevLN); 1445 (void)Lst_AtEnd(gn->parents, ( void *)pgn);1515 (void)Lst_AtEnd(gn->parents, (ClientData)pgn); 1446 1516 pgn->unmade++; 1447 1517 } … … 1457 1527 * keep it from being processed. 1458 1528 */ 1459 ln = Lst_Member(pgn->children, ( void *)cgn);1529 ln = Lst_Member(pgn->children, (ClientData)cgn); 1460 1530 pgn->unmade--; 1461 1531 Lst_Remove(pgn->children, ln); 1462 DEBUGF(SUFF, ("\n")); 1532 if (DEBUG(SUFF)) { 1533 printf("\n"); 1534 } 1463 1535 } 1464 1536 … … 1485 1557 */ 1486 1558 static Boolean 1487 SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s) 1559 SuffApplyTransform(tGn, sGn, t, s) 1560 GNode *tGn; /* Target node */ 1561 GNode *sGn; /* Source node */ 1562 Suff *t; /* Target suffix */ 1563 Suff *s; /* Source suffix */ 1488 1564 { 1489 1565 LstNode ln; /* General node */ … … 1491 1567 GNode *gn; /* Node for same */ 1492 1568 1493 if (Lst_Member(tGn->children, ( void *)sGn) == NULL) {1569 if (Lst_Member(tGn->children, (ClientData)sGn) == NILLNODE) { 1494 1570 /* 1495 1571 * Not already linked, so form the proper links between the 1496 1572 * target and source. 1497 1573 */ 1498 (void)Lst_AtEnd(tGn->children, ( void *)sGn);1499 (void)Lst_AtEnd(sGn->parents, ( void *)tGn);1574 (void)Lst_AtEnd(tGn->children, (ClientData)sGn); 1575 (void)Lst_AtEnd(sGn->parents, (ClientData)tGn); 1500 1576 tGn->unmade += 1; 1501 1577 } … … 1508 1584 * will be sufficient to get the .IMPSRC variable set for tGn 1509 1585 */ 1510 for (ln=Lst_First(sGn->cohorts); ln != N ULL; ln=Lst_Succ(ln)) {1586 for (ln=Lst_First(sGn->cohorts); ln != NILLNODE; ln=Lst_Succ(ln)) { 1511 1587 gn = (GNode *)Lst_Datum(ln); 1512 1588 1513 if (Lst_Member(tGn->children, ( void *)gn) == NULL) {1589 if (Lst_Member(tGn->children, (ClientData)gn) == NILLNODE) { 1514 1590 /* 1515 1591 * Not already linked, so form the proper links between the 1516 1592 * target and source. 1517 1593 */ 1518 (void)Lst_AtEnd(tGn->children, ( void *)gn);1519 (void)Lst_AtEnd(gn->parents, ( void *)tGn);1594 (void)Lst_AtEnd(tGn->children, (ClientData)gn); 1595 (void)Lst_AtEnd(gn->parents, (ClientData)tGn); 1520 1596 tGn->unmade += 1; 1521 1597 } … … 1526 1602 */ 1527 1603 tname = str_concat(s->name, t->name, 0); 1528 ln = Lst_Find(transforms, ( void *)tname, SuffGNHasNameP);1604 ln = Lst_Find(transforms, (ClientData)tname, SuffGNHasNameP); 1529 1605 free(tname); 1530 1606 1531 if (ln == N ULL) {1607 if (ln == NILLNODE) { 1532 1608 /* 1533 1609 * Not really such a transformation rule (can happen when we're … … 1540 1616 gn = (GNode *)Lst_Datum(ln); 1541 1617 1542 DEBUGF(SUFF, ("\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name)); 1618 if (DEBUG(SUFF)) { 1619 printf("\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name); 1620 } 1543 1621 1544 1622 /* … … 1556 1634 */ 1557 1635 ln = Lst_Succ(ln); 1558 if (ln != N ULL) {1636 if (ln != NILLNODE) { 1559 1637 Lst_ForEachFrom(tGn->children, ln, 1560 SuffExpandChildren, ( void *)tGn);1638 SuffExpandChildren, (ClientData)tGn); 1561 1639 } 1562 1640 … … 1565 1643 * the .IMPSRC variable can be set correctly for the parent. 1566 1644 */ 1567 (void)Lst_AtEnd(sGn->iParents, ( void *)tGn);1645 (void)Lst_AtEnd(sGn->iParents, (ClientData)tGn); 1568 1646 1569 1647 return(TRUE); … … 1585 1663 */ 1586 1664 static void 1587 SuffFindArchiveDeps(GNode *gn, Lst slst) 1665 SuffFindArchiveDeps(gn, slst) 1666 GNode *gn; /* Node for which to locate dependencies */ 1667 Lst slst; 1588 1668 { 1589 1669 char *eoarch; /* End of archive portion */ … … 1623 1703 * Create the link between the two nodes right off 1624 1704 */ 1625 if (Lst_Member(gn->children, ( void *)mem) == NULL) {1626 (void)Lst_AtEnd(gn->children, ( void *)mem);1627 (void)Lst_AtEnd(mem->parents, ( void *)gn);1705 if (Lst_Member(gn->children, (ClientData)mem) == NILLNODE) { 1706 (void)Lst_AtEnd(gn->children, (ClientData)mem); 1707 (void)Lst_AtEnd(mem->parents, (ClientData)gn); 1628 1708 gn->unmade += 1; 1629 1709 } … … 1644 1724 * Didn't know what it was -- use .NULL suffix if not in make mode 1645 1725 */ 1646 DEBUGF(SUFF, ("using null suffix\n")); 1726 if (DEBUG(SUFF)) { 1727 printf("using null suffix\n"); 1728 } 1647 1729 ms = suffNull; 1648 1730 } … … 1669 1751 ln = Lst_Find(ms->parents, eoarch, SuffSuffIsSuffixP); 1670 1752 1671 if (ln != N ULL) {1753 if (ln != NILLNODE) { 1672 1754 /* 1673 1755 * Got one -- apply it 1674 1756 */ 1675 if (!SuffApplyTransform(gn, mem, (Suff *)Lst_Datum(ln), ms)) { 1676 DEBUGF(SUFF, ("\tNo transformation from %s -> %s\n", 1677 ms->name, ((Suff *)Lst_Datum(ln))->name)); 1757 if (!SuffApplyTransform(gn, mem, (Suff *)Lst_Datum(ln), ms) && 1758 DEBUG(SUFF)) 1759 { 1760 printf("\tNo transformation from %s -> %s\n", 1761 ms->name, ((Suff *)Lst_Datum(ln))->name); 1678 1762 } 1679 1763 } … … 1716 1800 */ 1717 1801 static void 1718 SuffFindNormalDeps(GNode *gn, Lst slst) 1802 SuffFindNormalDeps(gn, slst) 1803 GNode *gn; /* Node for which to find sources */ 1804 Lst slst; 1719 1805 { 1720 1806 char *eoname; /* End of name */ … … 1761 1847 */ 1762 1848 1763 while (ln != N ULL) {1849 while (ln != NILLNODE) { 1764 1850 /* 1765 1851 * Look for next possible suffix... … … 1767 1853 ln = Lst_FindFrom(sufflist, ln, eoname, SuffSuffIsSuffixP); 1768 1854 1769 if (ln != N ULL) {1855 if (ln != NILLNODE) { 1770 1856 int prefLen; /* Length of the prefix */ 1771 Src *targ et;1857 Src *targ; 1772 1858 1773 1859 /* 1774 1860 * Allocate a Src structure to which things can be transformed 1775 1861 */ 1776 targ et= (Src *)emalloc(sizeof (Src));1777 targ et->file = estrdup(gn->name);1778 targ et->suff = (Suff *)Lst_Datum(ln);1779 targ et->suff->refCount++;1780 targ et->node = gn;1781 targ et->parent = (Src *)NULL;1782 targ et->children = 0;1862 targ = (Src *)emalloc(sizeof (Src)); 1863 targ->file = estrdup(gn->name); 1864 targ->suff = (Suff *)Lst_Datum(ln); 1865 targ->suff->refCount++; 1866 targ->node = gn; 1867 targ->parent = (Src *)NULL; 1868 targ->children = 0; 1783 1869 #ifdef DEBUG_SRC 1784 targ et->cp = Lst_Init(FALSE);1870 targ->cp = Lst_Init(FALSE); 1785 1871 #endif 1786 1872 … … 1789 1875 * the length of the suffix from the end of the name. 1790 1876 */ 1791 prefLen = (eoname - targ et->suff->nameLen) - sopref;1792 targ et->pref = emalloc(prefLen + 1);1793 memcpy(targ et->pref, sopref, prefLen);1794 targ et->pref[prefLen] = '\0';1877 prefLen = (eoname - targ->suff->nameLen) - sopref; 1878 targ->pref = emalloc(prefLen + 1); 1879 memcpy(targ->pref, sopref, prefLen); 1880 targ->pref[prefLen] = '\0'; 1795 1881 1796 1882 /* 1797 1883 * Add nodes from which the target can be made 1798 1884 */ 1799 SuffAddLevel(srcs, targ et);1885 SuffAddLevel(srcs, targ); 1800 1886 1801 1887 /* 1802 1888 * Record the target so we can nuke it 1803 1889 */ 1804 (void)Lst_AtEnd(targs, ( void *)target);1890 (void)Lst_AtEnd(targs, (ClientData)targ); 1805 1891 1806 1892 /* … … 1815 1901 */ 1816 1902 if (Lst_IsEmpty(targs) && suffNull != NULL) { 1817 DEBUGF(SUFF, ("\tNo known suffix on %s. Using .NULL suffix\n", gn->name)); 1903 if (DEBUG(SUFF)) { 1904 printf("\tNo known suffix on %s. Using .NULL suffix\n", gn->name); 1905 } 1818 1906 1819 1907 targ = (Src *)emalloc(sizeof (Src)); … … 1836 1924 SuffAddLevel(srcs, targ); 1837 1925 else { 1838 DEBUGF(SUFF, ("not ")); 1839 } 1840 1841 DEBUGF(SUFF, ("adding suffix rules\n")); 1842 1843 (void)Lst_AtEnd(targs, (void *)targ); 1926 if (DEBUG(SUFF)) 1927 printf("not "); 1928 } 1929 1930 if (DEBUG(SUFF)) 1931 printf("adding suffix rules\n"); 1932 1933 (void)Lst_AtEnd(targs, (ClientData)targ); 1844 1934 } 1845 1935 … … 1884 1974 * that still contain variables or wildcards in their names. 1885 1975 */ 1886 Lst_ForEach(gn->children, SuffExpandChildren, ( void *)gn);1976 Lst_ForEach(gn->children, SuffExpandChildren, (ClientData)gn); 1887 1977 1888 1978 if (targ == NULL) { 1889 DEBUGF(SUFF, ("\tNo valid suffix on %s\n", gn->name)); 1979 if (DEBUG(SUFF)) { 1980 printf("\tNo valid suffix on %s\n", gn->name); 1981 } 1890 1982 1891 1983 sfnd_abort: … … 1984 2076 */ 1985 2077 while (bottom && bottom->parent != NULL) { 1986 if (Lst_Member(slst, ( void *) bottom) == NULL) {1987 Lst_AtEnd(slst, ( void *) bottom);2078 if (Lst_Member(slst, (ClientData) bottom) == NILLNODE) { 2079 Lst_AtEnd(slst, (ClientData) bottom); 1988 2080 } 1989 2081 bottom = bottom->parent; … … 2012 2104 * Etc. 2013 2105 */ 2014 if (bottom->node == N ULL) {2106 if (bottom->node == NILGNODE) { 2015 2107 bottom->node = Targ_FindNode(bottom->file, TARG_CREATE); 2016 2108 } … … 2024 2116 src->node->suffix->refCount++; 2025 2117 2026 if (targ->node == N ULL) {2118 if (targ->node == NILGNODE) { 2027 2119 targ->node = Targ_FindNode(targ->file, TARG_CREATE); 2028 2120 } … … 2066 2158 sfnd_return: 2067 2159 if (bottom) 2068 if (Lst_Member(slst, ( void *) bottom) == NULL)2069 Lst_AtEnd(slst, ( void *) bottom);2160 if (Lst_Member(slst, (ClientData) bottom) == NILLNODE) 2161 Lst_AtEnd(slst, (ClientData) bottom); 2070 2162 2071 2163 while (SuffRemoveSrc(srcs) || SuffRemoveSrc(targs)) … … 2106 2198 2107 2199 void 2108 Suff_FindDeps(GNode *gn) 2200 Suff_FindDeps(gn) 2201 GNode *gn; 2109 2202 { 2110 2203 … … 2116 2209 2117 2210 static void 2118 SuffFindDeps (GNode *gn, Lst slst) 2211 SuffFindDeps (gn, slst) 2212 GNode *gn; /* node we're dealing with */ 2213 Lst slst; 2119 2214 { 2120 2215 if (gn->type & OP_DEPS_FOUND) { … … 2127 2222 } 2128 2223 2129 DEBUGF(SUFF, ("SuffFindDeps (%s)\n", gn->name)); 2224 if (DEBUG(SUFF)) { 2225 printf ("SuffFindDeps (%s)\n", gn->name); 2226 } 2130 2227 2131 2228 if (gn->type & OP_ARCHV) { … … 2143 2240 Suff *s; 2144 2241 2145 ln = Lst_Find (sufflist, ( void *)LIBSUFF, SuffSuffHasNameP);2242 ln = Lst_Find (sufflist, (ClientData)LIBSUFF, SuffSuffHasNameP); 2146 2243 if (gn->suffix) 2147 2244 gn->suffix->refCount--; 2148 if (ln != N ULL) {2245 if (ln != NILLNODE) { 2149 2246 gn->suffix = s = (Suff *) Lst_Datum (ln); 2150 2247 gn->suffix->refCount++; … … 2183 2280 */ 2184 2281 void 2185 Suff_SetNull(char *name) 2282 Suff_SetNull(name) 2283 char *name; /* Name of null suffix */ 2186 2284 { 2187 2285 Suff *s; 2188 2286 LstNode ln; 2189 2287 2190 ln = Lst_Find(sufflist, ( void *)name, SuffSuffHasNameP);2191 if (ln != N ULL) {2288 ln = Lst_Find(sufflist, (ClientData)name, SuffSuffHasNameP); 2289 if (ln != NILLNODE) { 2192 2290 s = (Suff *)Lst_Datum(ln); 2193 2291 if (suffNull != (Suff *)NULL) { … … 2218 2316 */ 2219 2317 void 2220 Suff_Init ( void)2318 Suff_Init () 2221 2319 { 2222 2320 sufflist = Lst_Init (FALSE); … … 2261 2359 2262 2360 void 2263 Suff_End( void)2361 Suff_End() 2264 2362 { 2265 2363 Lst_Destroy(sufflist, SuffFree); … … 2274 2372 /********************* DEBUGGING FUNCTIONS **********************/ 2275 2373 2374 static int SuffPrintName(s, dummy) 2375 ClientData s; 2376 ClientData dummy; 2377 { 2378 printf ("`%s' ", ((Suff *) s)->name); 2379 return (dummy ? 0 : 0); 2380 } 2381 2276 2382 static int 2277 SuffPrintName(void *s, void *dummy __unused) 2278 { 2279 printf ("`%s' ", ((Suff *) s)->name); 2280 return (0); 2281 } 2282 2283 static int 2284 SuffPrintSuff (void *sp, void *dummy __unused) 2383 SuffPrintSuff (sp, dummy) 2384 ClientData sp; 2385 ClientData dummy; 2285 2386 { 2286 2387 Suff *s = (Suff *) sp; … … 2306 2407 printf ("LIBRARY"); 2307 2408 break; 2308 default:2309 break;2310 2409 } 2311 2410 fputc(flags ? '|' : ')', stdout); … … 2314 2413 fputc ('\n', stdout); 2315 2414 printf ("#\tTo: "); 2316 Lst_ForEach (s->parents, SuffPrintName, ( void *)0);2415 Lst_ForEach (s->parents, SuffPrintName, (ClientData)0); 2317 2416 fputc ('\n', stdout); 2318 2417 printf ("#\tFrom: "); 2319 Lst_ForEach (s->children, SuffPrintName, ( void *)0);2418 Lst_ForEach (s->children, SuffPrintName, (ClientData)0); 2320 2419 fputc ('\n', stdout); 2321 2420 printf ("#\tSearch Path: "); 2322 2421 Dir_PrintPath (s->searchPath); 2323 2422 fputc ('\n', stdout); 2324 return ( 0);2423 return (dummy ? 0 : 0); 2325 2424 } 2326 2425 2327 2426 static int 2328 SuffPrintTrans (void *tp, void *dummy __unused) 2427 SuffPrintTrans (tp, dummy) 2428 ClientData tp; 2429 ClientData dummy; 2329 2430 { 2330 2431 GNode *t = (GNode *) tp; … … 2333 2434 Targ_PrintType (t->type); 2334 2435 fputc ('\n', stdout); 2335 Lst_ForEach (t->commands, Targ_PrintCmd, ( void *)0);2436 Lst_ForEach (t->commands, Targ_PrintCmd, (ClientData)0); 2336 2437 fputc ('\n', stdout); 2337 return (0);2438 return(dummy ? 0 : 0); 2338 2439 } 2339 2440 2340 2441 void 2341 Suff_PrintAll( void)2442 Suff_PrintAll() 2342 2443 { 2343 2444 printf ("#*** Suffixes:\n"); 2344 Lst_ForEach (sufflist, SuffPrintSuff, ( void *)0);2445 Lst_ForEach (sufflist, SuffPrintSuff, (ClientData)0); 2345 2446 2346 2447 printf ("#*** Transformations:\n"); 2347 Lst_ForEach (transforms, SuffPrintTrans, ( void *)0);2348 } 2448 Lst_ForEach (transforms, SuffPrintTrans, (ClientData)0); 2449 }
Note:
See TracChangeset
for help on using the changeset viewer.