version 1.105, 2020/08/22 14:54:48 |
version 1.106, 2020/08/22 15:17:09 |
Line 501 SuffInsert(Lst l, Suff *s) |
|
Line 501 SuffInsert(Lst l, Suff *s) |
|
|
|
Lst_OpenS(l); |
Lst_OpenS(l); |
while ((ln = Lst_NextS(l)) != NULL) { |
while ((ln = Lst_NextS(l)) != NULL) { |
s2 = (Suff *)Lst_Datum(ln); |
s2 = Lst_DatumS(ln); |
if (s2->sNum >= s->sNum) { |
if (s2->sNum >= s->sNum) { |
break; |
break; |
} |
} |
Line 637 SuffParseTransform(char *str, Suff **src |
|
Line 637 SuffParseTransform(char *str, Suff **src |
|
} |
} |
return FALSE; |
return FALSE; |
} |
} |
src = (Suff *)Lst_Datum(srcLn); |
src = Lst_DatumS(srcLn); |
str2 = str + src->nameLen; |
str2 = str + src->nameLen; |
if (*str2 == '\0') { |
if (*str2 == '\0') { |
single = src; |
single = src; |
Line 646 SuffParseTransform(char *str, Suff **src |
|
Line 646 SuffParseTransform(char *str, Suff **src |
|
targLn = Lst_Find(sufflist, str2, SuffSuffHasNameP); |
targLn = Lst_Find(sufflist, str2, SuffSuffHasNameP); |
if (targLn != NULL) { |
if (targLn != NULL) { |
*srcPtr = src; |
*srcPtr = src; |
*targPtr = (Suff *)Lst_Datum(targLn); |
*targPtr = Lst_DatumS(targLn); |
return TRUE; |
return TRUE; |
} |
} |
} |
} |
Line 718 Suff_AddTransform(char *line) |
|
Line 718 Suff_AddTransform(char *line) |
|
* free the commands themselves, because a given command can be |
* free the commands themselves, because a given command can be |
* attached to several different transformations. |
* attached to several different transformations. |
*/ |
*/ |
gn = (GNode *)Lst_Datum(ln); |
gn = Lst_DatumS(ln); |
Lst_Destroy(gn->commands, NULL); |
Lst_Destroy(gn->commands, NULL); |
Lst_Destroy(gn->children, NULL); |
Lst_Destroy(gn->children, NULL); |
gn->commands = Lst_Init(); |
gn->commands = Lst_Init(); |
Line 768 Suff_EndTransform(void *gnp, void *dummy |
|
Line 768 Suff_EndTransform(void *gnp, void *dummy |
|
{ |
{ |
GNode *gn = (GNode *)gnp; |
GNode *gn = (GNode *)gnp; |
|
|
if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (gn->cohorts)) |
if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts)) |
gn = (GNode *)Lst_Datum(Lst_Last(gn->cohorts)); |
gn = Lst_DatumS(Lst_Last(gn->cohorts)); |
if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) && |
if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) && |
Lst_IsEmpty(gn->children)) |
Lst_IsEmpty(gn->children)) |
{ |
{ |
Line 858 SuffRebuildGraph(void *transformp, void |
|
Line 858 SuffRebuildGraph(void *transformp, void |
|
* Found target. Link in and return, since it can't be anything |
* Found target. Link in and return, since it can't be anything |
* else. |
* else. |
*/ |
*/ |
s2 = (Suff *)Lst_Datum(ln); |
s2 = Lst_DatumS(ln); |
SuffInsert(s2->children, s); |
SuffInsert(s2->children, s); |
SuffInsert(s->parents, s2); |
SuffInsert(s->parents, s2); |
return 0; |
return 0; |
Line 885 SuffRebuildGraph(void *transformp, void |
|
Line 885 SuffRebuildGraph(void *transformp, void |
|
/* |
/* |
* Found it -- establish the proper relationship |
* Found it -- establish the proper relationship |
*/ |
*/ |
s2 = (Suff *)Lst_Datum(ln); |
s2 = Lst_DatumS(ln); |
SuffInsert(s->children, s2); |
SuffInsert(s->children, s2); |
SuffInsert(s2->parents, s); |
SuffInsert(s2->parents, s); |
} |
} |
Line 1035 Suff_GetPath(char *sname) |
|
Line 1035 Suff_GetPath(char *sname) |
|
if (ln == NULL) { |
if (ln == NULL) { |
return NULL; |
return NULL; |
} else { |
} else { |
s = (Suff *)Lst_Datum(ln); |
s = Lst_DatumS(ln); |
return s->searchPath; |
return s->searchPath; |
} |
} |
} |
} |
Line 1073 Suff_DoPaths(void) |
|
Line 1073 Suff_DoPaths(void) |
|
|
|
Lst_OpenS(sufflist); |
Lst_OpenS(sufflist); |
while ((ln = Lst_NextS(sufflist)) != NULL) { |
while ((ln = Lst_NextS(sufflist)) != NULL) { |
s = (Suff *)Lst_Datum(ln); |
s = Lst_DatumS(ln); |
if (!Lst_IsEmpty (s->searchPath)) { |
if (!Lst_IsEmpty (s->searchPath)) { |
#ifdef INCLUDES |
#ifdef INCLUDES |
if (s->flags & SUFF_INCLUDE) { |
if (s->flags & SUFF_INCLUDE) { |
Line 1128 Suff_AddInclude(char *sname) |
|
Line 1128 Suff_AddInclude(char *sname) |
|
|
|
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP); |
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP); |
if (ln != NULL) { |
if (ln != NULL) { |
s = (Suff *)Lst_Datum(ln); |
s = Lst_DatumS(ln); |
s->flags |= SUFF_INCLUDE; |
s->flags |= SUFF_INCLUDE; |
} |
} |
} |
} |
Line 1160 Suff_AddLib(char *sname) |
|
Line 1160 Suff_AddLib(char *sname) |
|
|
|
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP); |
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP); |
if (ln != NULL) { |
if (ln != NULL) { |
s = (Suff *)Lst_Datum(ln); |
s = Lst_DatumS(ln); |
s->flags |= SUFF_LIBRARY; |
s->flags |= SUFF_LIBRARY; |
} |
} |
} |
} |
Line 1296 SuffRemoveSrc(Lst l) |
|
Line 1296 SuffRemoveSrc(Lst l) |
|
|
|
|
|
while ((ln = Lst_NextS(l)) != NULL) { |
while ((ln = Lst_NextS(l)) != NULL) { |
s = (Src *)Lst_Datum(ln); |
s = Lst_DatumS(ln); |
if (s->children == 0) { |
if (s->children == 0) { |
free(s->file); |
free(s->file); |
if (!s->parent) |
if (!s->parent) |
Line 1438 SuffFindCmds(Src *targ, Lst slst) |
|
Line 1438 SuffFindCmds(Src *targ, Lst slst) |
|
Lst_CloseS(t->children); |
Lst_CloseS(t->children); |
return NULL; |
return NULL; |
} |
} |
s = (GNode *)Lst_Datum(ln); |
s = Lst_DatumS(ln); |
|
|
if (s->type & OP_OPTIONAL && Lst_IsEmpty(t->commands)) { |
if (s->type & OP_OPTIONAL && Lst_IsEmpty(t->commands)) { |
/* |
/* |
Line 1472 SuffFindCmds(Src *targ, Lst slst) |
|
Line 1472 SuffFindCmds(Src *targ, Lst slst) |
|
* |
* |
* XXX: Handle multi-stage transformations here, too. |
* XXX: Handle multi-stage transformations here, too. |
*/ |
*/ |
suff = (Suff *)Lst_Datum(ln); |
suff = Lst_DatumS(ln); |
|
|
if (Lst_Member(suff->parents, targ->suff) != NULL) |
if (Lst_Member(suff->parents, targ->suff) != NULL) |
break; |
break; |
Line 1528 SuffFindCmds(Src *targ, Lst slst) |
|
Line 1528 SuffFindCmds(Src *targ, Lst slst) |
|
static void |
static void |
SuffExpandChildren(LstNode cln, GNode *pgn) |
SuffExpandChildren(LstNode cln, GNode *pgn) |
{ |
{ |
GNode *cgn = (GNode *)Lst_Datum(cln); |
GNode *cgn = Lst_DatumS(cln); |
GNode *gn; /* New source 8) */ |
GNode *gn; /* New source 8) */ |
char *cp; /* Expanded value */ |
char *cp; /* Expanded value */ |
|
|
Line 1675 SuffExpandChildren(LstNode cln, GNode *p |
|
Line 1675 SuffExpandChildren(LstNode cln, GNode *p |
|
static void |
static void |
SuffExpandWildcards(LstNode cln, GNode *pgn) |
SuffExpandWildcards(LstNode cln, GNode *pgn) |
{ |
{ |
GNode *cgn = (GNode *)Lst_Datum(cln); |
GNode *cgn = Lst_DatumS(cln); |
GNode *gn; /* New source 8) */ |
GNode *gn; /* New source 8) */ |
char *cp; /* Expanded value */ |
char *cp; /* Expanded value */ |
Lst explist; /* List of expansions */ |
Lst explist; /* List of expansions */ |
Line 1760 Suff_FindPath(GNode* gn) |
|
Line 1760 Suff_FindPath(GNode* gn) |
|
fprintf(debug_file, "Wildcard expanding \"%s\"...", gn->name); |
fprintf(debug_file, "Wildcard expanding \"%s\"...", gn->name); |
} |
} |
if (ln != NULL) |
if (ln != NULL) |
suff = (Suff *)Lst_Datum(ln); |
suff = Lst_DatumS(ln); |
/* XXX: Here we can save the suffix so we don't have to do this again */ |
/* XXX: Here we can save the suffix so we don't have to do this again */ |
} |
} |
|
|
Line 1831 SuffApplyTransform(GNode *tGn, GNode *sG |
|
Line 1831 SuffApplyTransform(GNode *tGn, GNode *sG |
|
return FALSE; |
return FALSE; |
} |
} |
|
|
gn = (GNode *)Lst_Datum(ln); |
gn = Lst_DatumS(ln); |
|
|
if (DEBUG(SUFF)) { |
if (DEBUG(SUFF)) { |
fprintf(debug_file, "\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name); |
fprintf(debug_file, "\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name); |
Line 1995 SuffFindArchiveDeps(GNode *gn, Lst slst) |
|
Line 1995 SuffFindArchiveDeps(GNode *gn, Lst slst) |
|
/* |
/* |
* Got one -- apply it |
* Got one -- apply it |
*/ |
*/ |
if (!SuffApplyTransform(gn, mem, (Suff *)Lst_Datum(ln), ms) && |
if (!SuffApplyTransform(gn, mem, (Suff *)Lst_DatumS(ln), ms) && |
DEBUG(SUFF)) |
DEBUG(SUFF)) |
{ |
{ |
fprintf(debug_file, "\tNo transformation from %s -> %s\n", |
fprintf(debug_file, "\tNo transformation from %s -> %s\n", |
ms->name, ((Suff *)Lst_Datum(ln))->name); |
ms->name, ((Suff *)Lst_DatumS(ln))->name); |
} |
} |
} |
} |
} |
} |
Line 2109 SuffFindNormalDeps(GNode *gn, Lst slst) |
|
Line 2109 SuffFindNormalDeps(GNode *gn, Lst slst) |
|
*/ |
*/ |
targ = bmake_malloc(sizeof(Src)); |
targ = bmake_malloc(sizeof(Src)); |
targ->file = bmake_strdup(gn->name); |
targ->file = bmake_strdup(gn->name); |
targ->suff = (Suff *)Lst_Datum(ln); |
targ->suff = Lst_DatumS(ln); |
targ->suff->refCount++; |
targ->suff->refCount++; |
targ->node = gn; |
targ->node = gn; |
targ->parent = NULL; |
targ->parent = NULL; |
Line 2196 SuffFindNormalDeps(GNode *gn, Lst slst) |
|
Line 2196 SuffFindNormalDeps(GNode *gn, Lst slst) |
|
* for setting the local variables. |
* for setting the local variables. |
*/ |
*/ |
if (!Lst_IsEmpty(targs)) { |
if (!Lst_IsEmpty(targs)) { |
targ = (Src *)Lst_Datum(Lst_First(targs)); |
targ = Lst_DatumS(Lst_First(targs)); |
} else { |
} else { |
targ = NULL; |
targ = NULL; |
} |
} |
Line 2480 SuffFindDeps(GNode *gn, Lst slst) |
|
Line 2480 SuffFindDeps(GNode *gn, Lst slst) |
|
if (gn->suffix) |
if (gn->suffix) |
gn->suffix->refCount--; |
gn->suffix->refCount--; |
if (ln != NULL) { |
if (ln != NULL) { |
gn->suffix = s = (Suff *)Lst_Datum(ln); |
gn->suffix = s = Lst_DatumS(ln); |
gn->suffix->refCount++; |
gn->suffix->refCount++; |
Arch_FindLib(gn, s->searchPath); |
Arch_FindLib(gn, s->searchPath); |
} else { |
} else { |
Line 2526 Suff_SetNull(char *name) |
|
Line 2526 Suff_SetNull(char *name) |
|
|
|
ln = Lst_Find(sufflist, name, SuffSuffHasNameP); |
ln = Lst_Find(sufflist, name, SuffSuffHasNameP); |
if (ln != NULL) { |
if (ln != NULL) { |
s = (Suff *)Lst_Datum(ln); |
s = Lst_DatumS(ln); |
if (suffNull != NULL) { |
if (suffNull != NULL) { |
suffNull->flags &= ~SUFF_NULL; |
suffNull->flags &= ~SUFF_NULL; |
} |
} |