Typedefs of pointers to structs are evil. Make Lst and LstNode typedef of
the structs itself not of pointers to them. This will simplify constification. Checked by: diff on the object files
This commit is contained in:
parent
b82f920f8e
commit
bf1ead0608
@ -103,7 +103,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static Lst archives; /* Lst of archives we've already examined */
|
static Lst *archives; /* Lst of archives we've already examined */
|
||||||
|
|
||||||
typedef struct Arch {
|
typedef struct Arch {
|
||||||
char *name; /* Name of archive */
|
char *name; /* Name of archive */
|
||||||
@ -174,7 +174,7 @@ ArchFree(void *ap)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
ReturnStatus
|
ReturnStatus
|
||||||
Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
|
Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
|
||||||
{
|
{
|
||||||
char *cp; /* Pointer into line */
|
char *cp; /* Pointer into line */
|
||||||
GNode *gn; /* New node */
|
GNode *gn; /* New node */
|
||||||
@ -336,7 +336,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
|
|||||||
*/
|
*/
|
||||||
free(buf);
|
free(buf);
|
||||||
} else if (Dir_HasWildcards(memName)) {
|
} else if (Dir_HasWildcards(memName)) {
|
||||||
Lst members = Lst_Init();
|
Lst *members = Lst_Init();
|
||||||
char *member;
|
char *member;
|
||||||
size_t sz = MAXPATHLEN;
|
size_t sz = MAXPATHLEN;
|
||||||
size_t nsz;
|
size_t nsz;
|
||||||
@ -466,7 +466,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
|
|||||||
int size; /* Size of archive member */
|
int size; /* Size of archive member */
|
||||||
char *cp; /* Useful character pointer */
|
char *cp; /* Useful character pointer */
|
||||||
char magic[SARMAG];
|
char magic[SARMAG];
|
||||||
LstNode ln; /* Lst member containing archive descriptor */
|
LstNode *ln; /* Lst member containing archive descriptor */
|
||||||
Arch *ar; /* Archive descriptor */
|
Arch *ar; /* Archive descriptor */
|
||||||
Hash_Entry *he; /* Entry containing member's description */
|
Hash_Entry *he; /* Entry containing member's description */
|
||||||
struct ar_hdr arh; /* archive-member header for reading archive */
|
struct ar_hdr arh; /* archive-member header for reading archive */
|
||||||
@ -1016,7 +1016,7 @@ Arch_MTime(GNode *gn)
|
|||||||
int
|
int
|
||||||
Arch_MemMTime(GNode *gn)
|
Arch_MemMTime(GNode *gn)
|
||||||
{
|
{
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
GNode *pgn;
|
GNode *pgn;
|
||||||
char *nameStart,
|
char *nameStart,
|
||||||
*nameEnd;
|
*nameEnd;
|
||||||
@ -1079,7 +1079,7 @@ Arch_MemMTime(GNode *gn)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Arch_FindLib(GNode *gn, Lst path)
|
Arch_FindLib(GNode *gn, Lst *path)
|
||||||
{
|
{
|
||||||
char *libName; /* file name for archive */
|
char *libName; /* file name for archive */
|
||||||
size_t sz;
|
size_t sz;
|
||||||
|
@ -225,7 +225,7 @@ Compat_RunCommand(void *cmdp, void *gnp)
|
|||||||
int status; /* Description of child's death */
|
int status; /* Description of child's death */
|
||||||
int cpid; /* Child actually found */
|
int cpid; /* Child actually found */
|
||||||
ReturnStatus rstat; /* Status of fork */
|
ReturnStatus rstat; /* Status of fork */
|
||||||
LstNode cmdNode; /* Node where current command is located */
|
LstNode *cmdNode; /* Node where current command is located */
|
||||||
char **av; /* Argument vector for thing to exec */
|
char **av; /* Argument vector for thing to exec */
|
||||||
int argc; /* Number of arguments in av or 0 if not
|
int argc; /* Number of arguments in av or 0 if not
|
||||||
* dynamically allocated */
|
* dynamically allocated */
|
||||||
@ -679,7 +679,7 @@ CompatMake(void *gnp, void *pgnp)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Compat_Run(Lst targs)
|
Compat_Run(Lst *targs)
|
||||||
{
|
{
|
||||||
GNode *gn = NULL;/* Current root target */
|
GNode *gn = NULL;/* Current root target */
|
||||||
int errors; /* Number of targets not remade due to errors */
|
int errors; /* Number of targets not remade due to errors */
|
||||||
|
@ -164,9 +164,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
* in a cache for when Dir_MTime was actually called.
|
* in a cache for when Dir_MTime was actually called.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Lst dirSearchPath; /* main search path */
|
Lst *dirSearchPath; /* main search path */
|
||||||
|
|
||||||
static Lst openDirectories; /* the list of all open directories */
|
static Lst *openDirectories; /* the list of all open directories */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Variables for gathering statistics on the efficiency of the hashing
|
* Variables for gathering statistics on the efficiency of the hashing
|
||||||
@ -229,7 +229,7 @@ Dir_Init(void)
|
|||||||
void
|
void
|
||||||
Dir_InitDot(void)
|
Dir_InitDot(void)
|
||||||
{
|
{
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
Dir_AddDir(openDirectories, ".");
|
Dir_AddDir(openDirectories, ".");
|
||||||
if ((ln = Lst_Last(openDirectories)) == NULL)
|
if ((ln = Lst_Last(openDirectories)) == NULL)
|
||||||
@ -352,7 +352,7 @@ Dir_HasWildcards(const char *name)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DirMatchFiles(const char *pattern, const Path *p, Lst expansions)
|
DirMatchFiles(const char *pattern, const Path *p, Lst *expansions)
|
||||||
{
|
{
|
||||||
Hash_Search search; /* Index into the directory's table */
|
Hash_Search search; /* Index into the directory's table */
|
||||||
Hash_Entry *entry; /* Current entry in the table */
|
Hash_Entry *entry; /* Current entry in the table */
|
||||||
@ -400,7 +400,7 @@ DirMatchFiles(const char *pattern, const Path *p, Lst expansions)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
DirExpandCurly(const char *word, const char *brace, Lst path, Lst expansions)
|
DirExpandCurly(const char *word, const char *brace, Lst *path, Lst *expansions)
|
||||||
{
|
{
|
||||||
const char *end; /* Character after the closing brace */
|
const char *end; /* Character after the closing brace */
|
||||||
const char *cp; /* Current position in brace clause */
|
const char *cp; /* Current position in brace clause */
|
||||||
@ -504,9 +504,9 @@ DirExpandCurly(const char *word, const char *brace, Lst path, Lst expansions)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
DirExpandInt(const char *word, Lst path, Lst expansions)
|
DirExpandInt(const char *word, Lst *path, Lst *expansions)
|
||||||
{
|
{
|
||||||
LstNode ln; /* Current node */
|
LstNode *ln; /* Current node */
|
||||||
Path *p; /* Directory in the node */
|
Path *p; /* Directory in the node */
|
||||||
|
|
||||||
if (Lst_Open(path) == SUCCESS) {
|
if (Lst_Open(path) == SUCCESS) {
|
||||||
@ -556,7 +556,7 @@ DirPrintWord(void *word, void *dummy __unused)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Dir_Expand(char *word, Lst path, Lst expansions)
|
Dir_Expand(char *word, Lst *path, Lst *expansions)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
@ -677,11 +677,11 @@ Dir_Expand(char *word, Lst path, Lst expansions)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
Dir_FindFile(char *name, Lst path)
|
Dir_FindFile(char *name, Lst *path)
|
||||||
{
|
{
|
||||||
char *p1; /* pointer into p->name */
|
char *p1; /* pointer into p->name */
|
||||||
char *p2; /* pointer into name */
|
char *p2; /* pointer into name */
|
||||||
LstNode ln; /* a list element */
|
LstNode *ln; /* a list element */
|
||||||
char *file; /* the current filename to check */
|
char *file; /* the current filename to check */
|
||||||
Path *p; /* current path member */
|
Path *p; /* current path member */
|
||||||
char *cp; /* final component of the name */
|
char *cp; /* final component of the name */
|
||||||
@ -1012,9 +1012,9 @@ Dir_MTime(GNode *gn)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Dir_AddDir(Lst path, char *name)
|
Dir_AddDir(Lst *path, char *name)
|
||||||
{
|
{
|
||||||
LstNode ln; /* node in case Path structure is found */
|
LstNode *ln; /* node in case Path structure is found */
|
||||||
Path *p; /* pointer to new Path structure */
|
Path *p; /* pointer to new Path structure */
|
||||||
DIR *d; /* for reading directory */
|
DIR *d; /* for reading directory */
|
||||||
struct dirent *dp; /* entry in directory */
|
struct dirent *dp; /* entry in directory */
|
||||||
@ -1111,11 +1111,11 @@ Dir_CopyDir(void *p)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
Dir_MakeFlags(char *flag, Lst path)
|
Dir_MakeFlags(char *flag, Lst *path)
|
||||||
{
|
{
|
||||||
char *str; /* the string which will be returned */
|
char *str; /* the string which will be returned */
|
||||||
char *tstr; /* the current directory preceded by 'flag' */
|
char *tstr; /* the current directory preceded by 'flag' */
|
||||||
LstNode ln; /* the node of the current directory */
|
LstNode *ln; /* the node of the current directory */
|
||||||
Path *p; /* the structure describing the current directory */
|
Path *p; /* the structure describing the current directory */
|
||||||
|
|
||||||
str = estrdup("");
|
str = estrdup("");
|
||||||
@ -1155,7 +1155,7 @@ Dir_Destroy(void *pp)
|
|||||||
p->refCount -= 1;
|
p->refCount -= 1;
|
||||||
|
|
||||||
if (p->refCount == 0) {
|
if (p->refCount == 0) {
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
ln = Lst_Member(openDirectories, p);
|
ln = Lst_Member(openDirectories, p);
|
||||||
Lst_Remove(openDirectories, ln);
|
Lst_Remove(openDirectories, ln);
|
||||||
@ -1181,7 +1181,7 @@ Dir_Destroy(void *pp)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Dir_ClearPath(Lst path)
|
Dir_ClearPath(Lst *path)
|
||||||
{
|
{
|
||||||
Path *p;
|
Path *p;
|
||||||
|
|
||||||
@ -1207,9 +1207,9 @@ Dir_ClearPath(Lst path)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Dir_Concat(Lst path1, Lst path2)
|
Dir_Concat(Lst *path1, Lst *path2)
|
||||||
{
|
{
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
Path *p;
|
Path *p;
|
||||||
|
|
||||||
for (ln = Lst_First(path2); ln != NULL; ln = Lst_Succ(ln)) {
|
for (ln = Lst_First(path2); ln != NULL; ln = Lst_Succ(ln)) {
|
||||||
@ -1225,7 +1225,7 @@ Dir_Concat(Lst path1, Lst path2)
|
|||||||
void
|
void
|
||||||
Dir_PrintDirectories(void)
|
Dir_PrintDirectories(void)
|
||||||
{
|
{
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
Path *p;
|
Path *p;
|
||||||
|
|
||||||
printf("#*** Directory Cache:\n");
|
printf("#*** Directory Cache:\n");
|
||||||
@ -1254,7 +1254,7 @@ DirPrintDir(void *p, void *dummy __unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Dir_PrintPath(Lst path)
|
Dir_PrintPath(Lst *path)
|
||||||
{
|
{
|
||||||
|
|
||||||
Lst_ForEach(path, DirPrintDir, (void *)NULL);
|
Lst_ForEach(path, DirPrintDir, (void *)NULL);
|
||||||
|
@ -58,15 +58,15 @@ void Dir_Init(void);
|
|||||||
void Dir_InitDot(void);
|
void Dir_InitDot(void);
|
||||||
void Dir_End(void);
|
void Dir_End(void);
|
||||||
Boolean Dir_HasWildcards(const char *);
|
Boolean Dir_HasWildcards(const char *);
|
||||||
void Dir_Expand(char *, Lst, Lst);
|
void Dir_Expand(char *, Lst *, Lst *);
|
||||||
char *Dir_FindFile(char *, Lst);
|
char *Dir_FindFile(char *, Lst *);
|
||||||
int Dir_MTime(GNode *);
|
int Dir_MTime(GNode *);
|
||||||
void Dir_AddDir(Lst, char *);
|
void Dir_AddDir(Lst *, char *);
|
||||||
char *Dir_MakeFlags(char *, Lst);
|
char *Dir_MakeFlags(char *, Lst *);
|
||||||
void Dir_ClearPath(Lst);
|
void Dir_ClearPath(Lst *);
|
||||||
void Dir_Concat(Lst, Lst);
|
void Dir_Concat(Lst *, Lst *);
|
||||||
void Dir_PrintDirectories(void);
|
void Dir_PrintDirectories(void);
|
||||||
void Dir_PrintPath(Lst);
|
void Dir_PrintPath(Lst *);
|
||||||
void Dir_Destroy(void *);
|
void Dir_Destroy(void *);
|
||||||
void *Dir_CopyDir(void *);
|
void *Dir_CopyDir(void *);
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
static int forLevel = 0; /* Nesting level */
|
static int forLevel = 0; /* Nesting level */
|
||||||
static char *forVar; /* Iteration variable */
|
static char *forVar; /* Iteration variable */
|
||||||
static Buffer forBuf; /* Commands in loop */
|
static Buffer forBuf; /* Commands in loop */
|
||||||
static Lst forLst; /* List of items */
|
static Lst *forLst; /* List of items */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* State of a for loop.
|
* State of a for loop.
|
||||||
@ -80,7 +80,7 @@ static Lst forLst; /* List of items */
|
|||||||
typedef struct _For {
|
typedef struct _For {
|
||||||
Buffer buf; /* Unexpanded buffer */
|
Buffer buf; /* Unexpanded buffer */
|
||||||
char* var; /* Index name */
|
char* var; /* Index name */
|
||||||
Lst lst; /* List of variables */
|
Lst *lst; /* List of variables */
|
||||||
int lineno; /* Line # */
|
int lineno; /* Line # */
|
||||||
} For;
|
} For;
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ char *shellPath = NULL, /* full pathname of executable image */
|
|||||||
|
|
||||||
static int maxJobs; /* The most children we can run at once */
|
static int maxJobs; /* The most children we can run at once */
|
||||||
STATIC int nJobs; /* The number of children currently running */
|
STATIC int nJobs; /* The number of children currently running */
|
||||||
STATIC Lst jobs; /* The structures that describe them */
|
STATIC Lst *jobs; /* The structures that describe them */
|
||||||
STATIC Boolean jobFull; /* Flag to tell when the job table is full. It
|
STATIC Boolean jobFull; /* Flag to tell when the job table is full. It
|
||||||
* is set TRUE when (1) the total number of
|
* is set TRUE when (1) the total number of
|
||||||
* running jobs equals the maximum allowed */
|
* running jobs equals the maximum allowed */
|
||||||
@ -241,7 +241,7 @@ STATIC char *targFmt; /* Format string to use to head output from a
|
|||||||
* been stopped somehow, the job is placed on the stoppedJobs queue to be run
|
* been stopped somehow, the job is placed on the stoppedJobs queue to be run
|
||||||
* when the next job finishes.
|
* when the next job finishes.
|
||||||
*/
|
*/
|
||||||
STATIC Lst stoppedJobs; /* Lst of Job structures describing
|
STATIC Lst *stoppedJobs; /* Lst of Job structures describing
|
||||||
* jobs that were stopped due to concurrency
|
* jobs that were stopped due to concurrency
|
||||||
* limits or externally */
|
* limits or externally */
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ JobPrintCommand(void *cmdp, void *jobp)
|
|||||||
char *cmdTemplate; /* Template to use when printing the
|
char *cmdTemplate; /* Template to use when printing the
|
||||||
* command */
|
* command */
|
||||||
char *cmdStart; /* Start of expanded command */
|
char *cmdStart; /* Start of expanded command */
|
||||||
LstNode cmdNode; /* Node for replacing the command */
|
LstNode *cmdNode; /* Node for replacing the command */
|
||||||
char *cmd = cmdp;
|
char *cmd = cmdp;
|
||||||
Job *job = jobp;
|
Job *job = jobp;
|
||||||
|
|
||||||
@ -1465,7 +1465,7 @@ JobStart(GNode *gn, int flags, Job *previous)
|
|||||||
if ((job->flags&JOB_FIRST) && (Lst_Open(gn->commands) != SUCCESS)){
|
if ((job->flags&JOB_FIRST) && (Lst_Open(gn->commands) != SUCCESS)){
|
||||||
cmdsOK = FALSE;
|
cmdsOK = FALSE;
|
||||||
} else {
|
} else {
|
||||||
LstNode ln = Lst_Next(gn->commands);
|
LstNode *ln = Lst_Next(gn->commands);
|
||||||
|
|
||||||
if ((ln == NULL) ||
|
if ((ln == NULL) ||
|
||||||
JobPrintCommand(Lst_Datum(ln), job))
|
JobPrintCommand(Lst_Datum(ln), job))
|
||||||
@ -1904,7 +1904,7 @@ Job_CatchChildren(Boolean block)
|
|||||||
{
|
{
|
||||||
int pid; /* pid of dead child */
|
int pid; /* pid of dead child */
|
||||||
Job *job; /* job descriptor for dead child */
|
Job *job; /* job descriptor for dead child */
|
||||||
LstNode jnode; /* list element for finding job */
|
LstNode *jnode; /* list element for finding job */
|
||||||
int status; /* Exit/termination status */
|
int status; /* Exit/termination status */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1985,7 +1985,7 @@ Job_CatchOutput(int flag)
|
|||||||
#else
|
#else
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
fd_set readfds;
|
fd_set readfds;
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
Job *job;
|
Job *job;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2615,7 +2615,7 @@ Job_ParseShell(char *line)
|
|||||||
static void
|
static void
|
||||||
JobInterrupt(int runINTERRUPT, int signo)
|
JobInterrupt(int runINTERRUPT, int signo)
|
||||||
{
|
{
|
||||||
LstNode ln; /* element in job table */
|
LstNode *ln; /* element in job table */
|
||||||
Job *job = NULL; /* job descriptor in that element */
|
Job *job = NULL; /* job descriptor in that element */
|
||||||
GNode *interrupt; /* the node describing the .INTERRUPT target */
|
GNode *interrupt; /* the node describing the .INTERRUPT target */
|
||||||
|
|
||||||
@ -2736,7 +2736,7 @@ Job_Wait(void)
|
|||||||
void
|
void
|
||||||
Job_AbortAll(void)
|
Job_AbortAll(void)
|
||||||
{
|
{
|
||||||
LstNode ln; /* element in job table */
|
LstNode *ln; /* element in job table */
|
||||||
Job *job; /* the job descriptor in that element */
|
Job *job; /* the job descriptor in that element */
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ typedef struct Job {
|
|||||||
char tfile[sizeof(TMPPAT)];
|
char tfile[sizeof(TMPPAT)];
|
||||||
/* Temporary file to use for job */
|
/* Temporary file to use for job */
|
||||||
GNode *node; /* The target the child is making */
|
GNode *node; /* The target the child is making */
|
||||||
LstNode tailCmds; /* The node of the first command to be
|
LstNode *tailCmds; /* The node of the first command to be
|
||||||
* saved when the job has been run */
|
* saved when the job has been run */
|
||||||
FILE *cmdFILE; /* When creating the shell script, this is
|
FILE *cmdFILE; /* When creating the shell script, this is
|
||||||
* where the commands go */
|
* where the commands go */
|
||||||
|
@ -62,7 +62,7 @@ struct LstNode {
|
|||||||
int flags:8; /* Node status flags */
|
int flags:8; /* Node status flags */
|
||||||
void *datum; /* datum associated with this element */
|
void *datum; /* datum associated with this element */
|
||||||
};
|
};
|
||||||
typedef struct LstNode *LstNode;
|
typedef struct LstNode LstNode;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flags required for synchronization
|
* Flags required for synchronization
|
||||||
@ -77,19 +77,19 @@ typedef enum {
|
|||||||
* The list itself
|
* The list itself
|
||||||
*/
|
*/
|
||||||
struct Lst {
|
struct Lst {
|
||||||
LstNode firstPtr; /* first node in list */
|
LstNode *firstPtr; /* first node in list */
|
||||||
LstNode lastPtr; /* last node in list */
|
LstNode *lastPtr; /* last node in list */
|
||||||
/*
|
/*
|
||||||
* fields for sequential access
|
* fields for sequential access
|
||||||
*/
|
*/
|
||||||
LstWhere atEnd; /* Where in the list the last access was */
|
LstWhere atEnd; /* Where in the list the last access was */
|
||||||
Boolean isOpen; /* true if list has been Lst_Open'ed */
|
Boolean isOpen; /* true if list has been Lst_Open'ed */
|
||||||
LstNode curPtr; /* current node, if open. NULL if
|
LstNode *curPtr; /* current node, if open. NULL if
|
||||||
* *just* opened */
|
* *just* opened */
|
||||||
LstNode prevPtr; /* Previous node, if open. Used by
|
LstNode *prevPtr; /* Previous node, if open. Used by
|
||||||
* Lst_Remove */
|
* Lst_Remove */
|
||||||
};
|
};
|
||||||
typedef struct Lst *Lst;
|
typedef struct Lst Lst;
|
||||||
|
|
||||||
typedef int CompareProc(void *, void *);
|
typedef int CompareProc(void *, void *);
|
||||||
typedef int DoProc(void *, void *);
|
typedef int DoProc(void *, void *);
|
||||||
@ -111,30 +111,30 @@ typedef void FreeProc(void *);
|
|||||||
* Creation/destruction functions
|
* Creation/destruction functions
|
||||||
*/
|
*/
|
||||||
/* Create a new list */
|
/* Create a new list */
|
||||||
Lst Lst_Init(void);
|
Lst *Lst_Init(void);
|
||||||
/* Duplicate an existing list */
|
/* Duplicate an existing list */
|
||||||
Lst Lst_Duplicate(Lst, DuplicateProc *);
|
Lst *Lst_Duplicate(Lst *, DuplicateProc *);
|
||||||
/* Destroy an old one */
|
/* Destroy an old one */
|
||||||
void Lst_Destroy(Lst, FreeProc *);
|
void Lst_Destroy(Lst *, FreeProc *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions to modify a list
|
* Functions to modify a list
|
||||||
*/
|
*/
|
||||||
/* Insert an element before another */
|
/* Insert an element before another */
|
||||||
ReturnStatus Lst_Insert(Lst, LstNode, void *);
|
ReturnStatus Lst_Insert(Lst *, LstNode *, void *);
|
||||||
/* Insert an element after another */
|
/* Insert an element after another */
|
||||||
ReturnStatus Lst_Append(Lst, LstNode, void *);
|
ReturnStatus Lst_Append(Lst *, LstNode *, void *);
|
||||||
/* Place an element at the front of a lst. */
|
/* Place an element at the front of a lst. */
|
||||||
#define Lst_AtFront(LST, D) (Lst_Insert((LST), Lst_First(LST), (D)))
|
#define Lst_AtFront(LST, D) (Lst_Insert((LST), Lst_First(LST), (D)))
|
||||||
/* Place an element at the end of a lst. */
|
/* Place an element at the end of a lst. */
|
||||||
#define Lst_AtEnd(LST, D) (Lst_Append((LST), Lst_Last(LST), (D)))
|
#define Lst_AtEnd(LST, D) (Lst_Append((LST), Lst_Last(LST), (D)))
|
||||||
/* Remove an element */
|
/* Remove an element */
|
||||||
ReturnStatus Lst_Remove(Lst, LstNode);
|
ReturnStatus Lst_Remove(Lst *, LstNode *);
|
||||||
/* Replace a node with a new value */
|
/* Replace a node with a new value */
|
||||||
#define Lst_Replace(NODE, D) (((NODE) == NULL) ? FAILURE : \
|
#define Lst_Replace(NODE, D) (((NODE) == NULL) ? FAILURE : \
|
||||||
(((NODE)->datum = (D)), SUCCESS))
|
(((NODE)->datum = (D)), SUCCESS))
|
||||||
/* Concatenate two lists */
|
/* Concatenate two lists */
|
||||||
ReturnStatus Lst_Concat(Lst, Lst, int);
|
ReturnStatus Lst_Concat(Lst *, Lst *, int);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Node-specific functions
|
* Node-specific functions
|
||||||
@ -156,14 +156,14 @@ ReturnStatus Lst_Concat(Lst, Lst, int);
|
|||||||
/* Find an element in a list */
|
/* Find an element in a list */
|
||||||
#define Lst_Find(LST, D, FN) (Lst_FindFrom((LST), Lst_First(LST), (D), (FN)))
|
#define Lst_Find(LST, D, FN) (Lst_FindFrom((LST), Lst_First(LST), (D), (FN)))
|
||||||
/* Find an element starting from somewhere */
|
/* Find an element starting from somewhere */
|
||||||
LstNode Lst_FindFrom(Lst, LstNode, void *, CompareProc *);
|
LstNode *Lst_FindFrom(Lst *, LstNode *, void *, CompareProc *);
|
||||||
/*
|
/*
|
||||||
* See if the given datum is on the list. Returns the LstNode containing
|
* See if the given datum is on the list. Returns the LstNode containing
|
||||||
* the datum
|
* the datum
|
||||||
*/
|
*/
|
||||||
LstNode Lst_Member(Lst, void *);
|
LstNode *Lst_Member(Lst *, void *);
|
||||||
/* Apply a function to all elements of a lst */
|
/* Apply a function to all elements of a lst */
|
||||||
void Lst_ForEach(Lst, DoProc *, void *);
|
void Lst_ForEach(Lst *, DoProc *, void *);
|
||||||
#define Lst_ForEach(LST, FN, D) (Lst_ForEachFrom((LST), Lst_First(LST), \
|
#define Lst_ForEach(LST, FN, D) (Lst_ForEachFrom((LST), Lst_First(LST), \
|
||||||
(FN), (D)))
|
(FN), (D)))
|
||||||
/*
|
/*
|
||||||
@ -171,20 +171,20 @@ void Lst_ForEach(Lst, DoProc *, void *);
|
|||||||
* If the list is circular, the application will wrap around to the
|
* If the list is circular, the application will wrap around to the
|
||||||
* beginning of the list again.
|
* beginning of the list again.
|
||||||
*/
|
*/
|
||||||
void Lst_ForEachFrom(Lst, LstNode, DoProc *, void *);
|
void Lst_ForEachFrom(Lst *, LstNode *, DoProc *, void *);
|
||||||
/*
|
/*
|
||||||
* these functions are for dealing with a list as a table, of sorts.
|
* these functions are for dealing with a list as a table, of sorts.
|
||||||
* An idea of the "current element" is kept and used by all the functions
|
* An idea of the "current element" is kept and used by all the functions
|
||||||
* between Lst_Open() and Lst_Close().
|
* between Lst_Open() and Lst_Close().
|
||||||
*/
|
*/
|
||||||
/* Open the list */
|
/* Open the list */
|
||||||
ReturnStatus Lst_Open(Lst);
|
ReturnStatus Lst_Open(Lst *);
|
||||||
/* Next element please */
|
/* Next element please */
|
||||||
LstNode Lst_Next(Lst);
|
LstNode *Lst_Next(Lst *);
|
||||||
/* Done yet? */
|
/* Done yet? */
|
||||||
Boolean Lst_IsAtEnd(Lst);
|
Boolean Lst_IsAtEnd(Lst *);
|
||||||
/* Finish table access */
|
/* Finish table access */
|
||||||
void Lst_Close(Lst);
|
void Lst_Close(Lst *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* for using the list as a queue
|
* for using the list as a queue
|
||||||
@ -194,7 +194,7 @@ void Lst_Close(Lst);
|
|||||||
? Lst_Append((LST), Lst_Last(LST), (D)) \
|
? Lst_Append((LST), Lst_Last(LST), (D)) \
|
||||||
: FAILURE)
|
: FAILURE)
|
||||||
/* Remove an element from head of queue */
|
/* Remove an element from head of queue */
|
||||||
void * Lst_DeQueue(Lst);
|
void *Lst_DeQueue(Lst *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LstValid (L) --
|
* LstValid (L) --
|
||||||
|
@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* d said datum
|
* d said datum
|
||||||
*
|
*
|
||||||
* Side Effects:
|
* Side Effects:
|
||||||
* A new ListNode is created and linked in to the List. The lastPtr
|
* A new LstNode is created and linked in to the List. The lastPtr
|
||||||
* field of the List will be altered if ln is the last node in the
|
* field of the List will be altered if ln is the last node in the
|
||||||
* list. lastPtr and firstPtr will alter if the list was empty and
|
* list. lastPtr and firstPtr will alter if the list was empty and
|
||||||
* ln was NULL.
|
* ln was NULL.
|
||||||
@ -71,9 +71,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
ReturnStatus
|
ReturnStatus
|
||||||
Lst_Append(Lst list, LstNode ln, void *d)
|
Lst_Append(Lst *list, LstNode *ln, void *d)
|
||||||
{
|
{
|
||||||
LstNode nLNode;
|
LstNode *nLNode;
|
||||||
|
|
||||||
if (Lst_Valid(list) && (ln == NULL && Lst_IsEmpty(list))) {
|
if (Lst_Valid(list) && (ln == NULL && Lst_IsEmpty(list))) {
|
||||||
goto ok;
|
goto ok;
|
||||||
|
@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Lst_Close(Lst list)
|
Lst_Close(Lst *list)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Lst_Valid(list) == TRUE) {
|
if (Lst_Valid(list) == TRUE) {
|
||||||
|
@ -73,12 +73,12 @@ __FBSDID("$FreeBSD$");
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
ReturnStatus
|
ReturnStatus
|
||||||
Lst_Concat(Lst list1, Lst list2, int flags)
|
Lst_Concat(Lst *list1, Lst *list2, int flags)
|
||||||
{
|
{
|
||||||
LstNode ln; /* original LstNode */
|
LstNode *ln; /* original LstNode */
|
||||||
LstNode nln; /* new LstNode */
|
LstNode *nln; /* new LstNode */
|
||||||
LstNode last; /* the last element in the list. Keeps
|
LstNode *last; /* the last element in the list. Keeps
|
||||||
* bookkeeping until the end */
|
* bookkeeping until the end */
|
||||||
|
|
||||||
if (!Lst_Valid(list1) || !Lst_Valid(list2)) {
|
if (!Lst_Valid(list1) || !Lst_Valid(list2)) {
|
||||||
return (FAILURE);
|
return (FAILURE);
|
||||||
|
@ -64,10 +64,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
Lst_DeQueue(Lst l)
|
Lst_DeQueue(Lst *l)
|
||||||
{
|
{
|
||||||
void * rd;
|
void *rd;
|
||||||
LstNode tln;
|
LstNode *tln;
|
||||||
|
|
||||||
tln = Lst_First(l);
|
tln = Lst_First(l);
|
||||||
if (tln == NULL) {
|
if (tln == NULL) {
|
||||||
|
@ -65,10 +65,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Lst_Destroy(Lst list, FreeProc *freeProc)
|
Lst_Destroy(Lst *list, FreeProc *freeProc)
|
||||||
{
|
{
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
LstNode tln;
|
LstNode *tln;
|
||||||
|
|
||||||
if (!Lst_Valid(list)) {
|
if (!Lst_Valid(list)) {
|
||||||
/*
|
/*
|
||||||
|
@ -67,11 +67,11 @@ __FBSDID("$FreeBSD$");
|
|||||||
* A new list is created.
|
* A new list is created.
|
||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
Lst
|
Lst *
|
||||||
Lst_Duplicate(Lst list, DuplicateProc *copyProc)
|
Lst_Duplicate(Lst *list, DuplicateProc *copyProc)
|
||||||
{
|
{
|
||||||
Lst nl;
|
Lst *nl;
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
if (!Lst_Valid(list)) {
|
if (!Lst_Valid(list)) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
@ -64,10 +64,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
*
|
*
|
||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
LstNode
|
LstNode *
|
||||||
Lst_FindFrom(Lst l, LstNode ln, void *d, CompareProc *cProc)
|
Lst_FindFrom(Lst *l, LstNode *ln, void *d, CompareProc *cProc)
|
||||||
{
|
{
|
||||||
LstNode tln;
|
LstNode *tln;
|
||||||
Boolean found = FALSE;
|
Boolean found = FALSE;
|
||||||
|
|
||||||
if (!Lst_Valid(l) || Lst_IsEmpty(l) || !Lst_NodeValid(ln, l)) {
|
if (!Lst_Valid(l) || Lst_IsEmpty(l) || !Lst_NodeValid(ln, l)) {
|
||||||
|
@ -66,9 +66,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Lst_ForEachFrom(Lst list, LstNode ln, DoProc *proc, void *d)
|
Lst_ForEachFrom(Lst *list, LstNode *ln, DoProc *proc, void *d)
|
||||||
{
|
{
|
||||||
LstNode next;
|
LstNode *next;
|
||||||
Boolean done;
|
Boolean done;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
@ -62,10 +62,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
*
|
*
|
||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
Lst
|
Lst *
|
||||||
Lst_Init(void)
|
Lst_Init(void)
|
||||||
{
|
{
|
||||||
Lst nList;
|
Lst *nList;
|
||||||
|
|
||||||
nList = emalloc(sizeof(*nList));
|
nList = emalloc(sizeof(*nList));
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
ReturnStatus
|
ReturnStatus
|
||||||
Lst_Insert(Lst list, LstNode ln, void *d)
|
Lst_Insert(Lst *list, LstNode *ln, void *d)
|
||||||
{
|
{
|
||||||
LstNode nLNode; /* new lnode for d */
|
LstNode *nLNode; /* new lnode for d */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check validity of arguments
|
* check validity of arguments
|
||||||
|
@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
Boolean
|
Boolean
|
||||||
Lst_IsAtEnd(Lst list)
|
Lst_IsAtEnd(Lst *list)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (!Lst_Valid(list) || !list->isOpen ||
|
return (!Lst_Valid(list) || !list->isOpen ||
|
||||||
|
@ -49,10 +49,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "make.h"
|
#include "make.h"
|
||||||
#include "lst.h"
|
#include "lst.h"
|
||||||
|
|
||||||
LstNode
|
LstNode *
|
||||||
Lst_Member(Lst list, void *d)
|
Lst_Member(Lst *list, void *d)
|
||||||
{
|
{
|
||||||
LstNode lNode;
|
LstNode *lNode;
|
||||||
|
|
||||||
lNode = list->firstPtr;
|
lNode = list->firstPtr;
|
||||||
if (lNode == NULL) {
|
if (lNode == NULL) {
|
||||||
|
@ -67,10 +67,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
*
|
*
|
||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
LstNode
|
LstNode *
|
||||||
Lst_Next(Lst list)
|
Lst_Next(Lst *list)
|
||||||
{
|
{
|
||||||
LstNode tln;
|
LstNode *tln;
|
||||||
|
|
||||||
if ((Lst_Valid(list) == FALSE) || (list->isOpen == FALSE)) {
|
if ((Lst_Valid(list) == FALSE) || (list->isOpen == FALSE)) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
ReturnStatus
|
ReturnStatus
|
||||||
Lst_Open(Lst l)
|
Lst_Open(Lst *l)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Lst_Valid(l) == FALSE) {
|
if (Lst_Valid(l) == FALSE) {
|
||||||
|
@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
ReturnStatus
|
ReturnStatus
|
||||||
Lst_Remove(Lst list, LstNode ln)
|
Lst_Remove(Lst *list, LstNode *ln)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!Lst_Valid(list) || !Lst_NodeValid(ln, list)) {
|
if (!Lst_Valid(list) || !Lst_NodeValid(ln, list)) {
|
||||||
|
@ -93,15 +93,15 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#define MAKEFLAGS ".MAKEFLAGS"
|
#define MAKEFLAGS ".MAKEFLAGS"
|
||||||
|
|
||||||
Lst create; /* Targets to be made */
|
Lst *create; /* Targets to be made */
|
||||||
time_t now; /* Time at start of make */
|
time_t now; /* Time at start of make */
|
||||||
GNode *DEFAULT; /* .DEFAULT node */
|
GNode *DEFAULT; /* .DEFAULT node */
|
||||||
Boolean allPrecious; /* .PRECIOUS given on line by itself */
|
Boolean allPrecious; /* .PRECIOUS given on line by itself */
|
||||||
|
|
||||||
static Boolean noBuiltins; /* -r flag */
|
static Boolean noBuiltins; /* -r flag */
|
||||||
static Lst makefiles; /* ordered list of makefiles to read */
|
static Lst *makefiles; /* ordered list of makefiles to read */
|
||||||
static Boolean expandVars; /* fully expand printed variables */
|
static Boolean expandVars; /* fully expand printed variables */
|
||||||
static Lst variables; /* list of variables to print */
|
static Lst *variables; /* list of variables to print */
|
||||||
int maxJobs; /* -j argument */
|
int maxJobs; /* -j argument */
|
||||||
static Boolean forceJobs; /* -j argument given */
|
static Boolean forceJobs; /* -j argument given */
|
||||||
Boolean compatMake; /* -B argument */
|
Boolean compatMake; /* -B argument */
|
||||||
@ -116,7 +116,7 @@ Boolean beSilent; /* -s flag */
|
|||||||
Boolean beVerbose; /* -v flag */
|
Boolean beVerbose; /* -v flag */
|
||||||
Boolean oldVars; /* variable substitution style */
|
Boolean oldVars; /* variable substitution style */
|
||||||
Boolean checkEnvFirst; /* -e flag */
|
Boolean checkEnvFirst; /* -e flag */
|
||||||
Lst envFirstVars; /* (-E) vars to override from env */
|
Lst *envFirstVars; /* (-E) vars to override from env */
|
||||||
Boolean jobsRunning; /* TRUE if the jobs might be running */
|
Boolean jobsRunning; /* TRUE if the jobs might be running */
|
||||||
|
|
||||||
static void MainParseArgs(int, char **);
|
static void MainParseArgs(int, char **);
|
||||||
@ -450,7 +450,7 @@ check_make_level(void)
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
Lst targs; /* target nodes to create -- passed to Make_Init */
|
Lst *targs; /* target nodes to create -- passed to Make_Init */
|
||||||
Boolean outOfDate = TRUE; /* FALSE if all targets up to date */
|
Boolean outOfDate = TRUE; /* FALSE if all targets up to date */
|
||||||
struct stat sa;
|
struct stat sa;
|
||||||
char *p, *p1, *path, *pathp;
|
char *p, *p1, *path, *pathp;
|
||||||
@ -460,7 +460,7 @@ main(int argc, char **argv)
|
|||||||
char *machine = getenv("MACHINE");
|
char *machine = getenv("MACHINE");
|
||||||
char *machine_arch = getenv("MACHINE_ARCH");
|
char *machine_arch = getenv("MACHINE_ARCH");
|
||||||
char *machine_cpu = getenv("MACHINE_CPU");
|
char *machine_cpu = getenv("MACHINE_CPU");
|
||||||
Lst sysMkPath; /* Path of sys.mk */
|
Lst *sysMkPath; /* Path of sys.mk */
|
||||||
char *cp = NULL, *start;
|
char *cp = NULL, *start;
|
||||||
/* avoid faults on read-only strings */
|
/* avoid faults on read-only strings */
|
||||||
static char syspath[] = _PATH_DEFSYSPATH;
|
static char syspath[] = _PATH_DEFSYSPATH;
|
||||||
@ -709,7 +709,7 @@ main(int argc, char **argv)
|
|||||||
* will fill the thing in with the default or .MAIN target.
|
* will fill the thing in with the default or .MAIN target.
|
||||||
*/
|
*/
|
||||||
if (!Lst_IsEmpty(create)) {
|
if (!Lst_IsEmpty(create)) {
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
for (ln = Lst_First(create); ln != NULL; ln = Lst_Succ(ln)) {
|
for (ln = Lst_First(create); ln != NULL; ln = Lst_Succ(ln)) {
|
||||||
char *name = Lst_Datum(ln);
|
char *name = Lst_Datum(ln);
|
||||||
@ -744,7 +744,7 @@ main(int argc, char **argv)
|
|||||||
* Makefile and makefile, in that order, if it wasn't.
|
* Makefile and makefile, in that order, if it wasn't.
|
||||||
*/
|
*/
|
||||||
if (!noBuiltins) {
|
if (!noBuiltins) {
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
sysMkPath = Lst_Init();
|
sysMkPath = Lst_Init();
|
||||||
Dir_Expand(_PATH_DEFSYSMK, sysIncPath, sysMkPath);
|
Dir_Expand(_PATH_DEFSYSMK, sysIncPath, sysMkPath);
|
||||||
@ -756,7 +756,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Lst_IsEmpty(makefiles)) {
|
if (!Lst_IsEmpty(makefiles)) {
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
ln = Lst_Find(makefiles, NULL, ReadMakefile);
|
ln = Lst_Find(makefiles, NULL, ReadMakefile);
|
||||||
if (ln != NULL)
|
if (ln != NULL)
|
||||||
@ -816,7 +816,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
/* print the values of any variables requested by the user */
|
/* print the values of any variables requested by the user */
|
||||||
if (!Lst_IsEmpty(variables)) {
|
if (!Lst_IsEmpty(variables)) {
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
for (ln = Lst_First(variables); ln != NULL;
|
for (ln = Lst_First(variables); ln != NULL;
|
||||||
ln = Lst_Succ(ln)) {
|
ln = Lst_Succ(ln)) {
|
||||||
|
@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#include "job.h"
|
#include "job.h"
|
||||||
|
|
||||||
static Lst toBeMade; /* The current fringe of the graph. These
|
static Lst *toBeMade; /* The current fringe of the graph. These
|
||||||
* are nodes which await examination by
|
* are nodes which await examination by
|
||||||
* MakeOODate. It is added to by
|
* MakeOODate. It is added to by
|
||||||
* Make_Update and subtracted from by
|
* Make_Update and subtracted from by
|
||||||
@ -264,7 +264,7 @@ static int
|
|||||||
MakeAddChild(void *gnp, void *lp)
|
MakeAddChild(void *gnp, void *lp)
|
||||||
{
|
{
|
||||||
GNode *gn = gnp;
|
GNode *gn = gnp;
|
||||||
Lst l = lp;
|
Lst *l = lp;
|
||||||
|
|
||||||
if (!gn->make && !(gn->type & OP_USE)) {
|
if (!gn->make && !(gn->type & OP_USE)) {
|
||||||
Lst_EnQueue(l, gn);
|
Lst_EnQueue(l, gn);
|
||||||
@ -299,7 +299,7 @@ int
|
|||||||
Make_HandleUse(GNode *cgn, GNode *pgn)
|
Make_HandleUse(GNode *cgn, GNode *pgn)
|
||||||
{
|
{
|
||||||
GNode *gn; /* A child of the .USE node */
|
GNode *gn; /* A child of the .USE node */
|
||||||
LstNode ln; /* An element in the children list */
|
LstNode *ln; /* An element in the children list */
|
||||||
|
|
||||||
if (cgn->type & (OP_USE | OP_TRANSFORM)) {
|
if (cgn->type & (OP_USE | OP_TRANSFORM)) {
|
||||||
if ((cgn->type & OP_USE) || Lst_IsEmpty(pgn->commands)) {
|
if ((cgn->type & OP_USE) || Lst_IsEmpty(pgn->commands)) {
|
||||||
@ -376,7 +376,7 @@ Make_Update(GNode *cgn)
|
|||||||
{
|
{
|
||||||
GNode *pgn; /* the parent node */
|
GNode *pgn; /* the parent node */
|
||||||
char *cname; /* the child's name */
|
char *cname; /* the child's name */
|
||||||
LstNode ln; /* Element in parents and iParents lists */
|
LstNode *ln; /* Element in parents and iParents lists */
|
||||||
char *p1;
|
char *p1;
|
||||||
|
|
||||||
cname = Var_Value(TARGET, cgn, &p1);
|
cname = Var_Value(TARGET, cgn, &p1);
|
||||||
@ -653,7 +653,7 @@ MakeStartJobs(void)
|
|||||||
* have been.
|
* have been.
|
||||||
*/
|
*/
|
||||||
if (!Lst_IsEmpty(gn->preds)) {
|
if (!Lst_IsEmpty(gn->preds)) {
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
for (ln = Lst_First(gn->preds); ln != NULL; ln = Lst_Succ(ln)){
|
for (ln = Lst_First(gn->preds); ln != NULL; ln = Lst_Succ(ln)){
|
||||||
GNode *pgn = Lst_Datum(ln);
|
GNode *pgn = Lst_Datum(ln);
|
||||||
@ -777,10 +777,10 @@ MakePrintStatus(void *gnp, void *cyclep)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
Boolean
|
Boolean
|
||||||
Make_Run(Lst targs)
|
Make_Run(Lst *targs)
|
||||||
{
|
{
|
||||||
GNode *gn; /* a temporary pointer */
|
GNode *gn; /* a temporary pointer */
|
||||||
Lst examine; /* List of targets to examine */
|
Lst *examine; /* List of targets to examine */
|
||||||
int errors; /* Number of errors the Job module reports */
|
int errors; /* Number of errors the Job module reports */
|
||||||
|
|
||||||
toBeMade = Lst_Init();
|
toBeMade = Lst_Init();
|
||||||
|
@ -125,16 +125,16 @@ typedef struct GNode {
|
|||||||
int cmtime; /* The modification time of its youngest
|
int cmtime; /* The modification time of its youngest
|
||||||
* child */
|
* child */
|
||||||
|
|
||||||
Lst iParents; /* Links to parents for which this is an
|
Lst *iParents; /* Links to parents for which this is an
|
||||||
* implied source, if any */
|
* implied source, if any */
|
||||||
Lst cohorts; /* Other nodes for the :: operator */
|
Lst *cohorts; /* Other nodes for the :: operator */
|
||||||
Lst parents; /* Nodes that depend on this one */
|
Lst *parents; /* Nodes that depend on this one */
|
||||||
Lst children; /* Nodes on which this one depends */
|
Lst *children; /* Nodes on which this one depends */
|
||||||
Lst successors; /* Nodes that must be made after this one */
|
Lst *successors;/* Nodes that must be made after this one */
|
||||||
Lst preds; /* Nodes that must be made before this one */
|
Lst *preds; /* Nodes that must be made before this one */
|
||||||
|
|
||||||
Lst context; /* The local variables */
|
Lst *context; /* The local variables */
|
||||||
Lst commands; /* Creation commands */
|
Lst *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
|
* Suff_FindDeps and opaque to everyone
|
||||||
@ -283,13 +283,13 @@ typedef struct IFile {
|
|||||||
/*
|
/*
|
||||||
* Global Variables
|
* Global Variables
|
||||||
*/
|
*/
|
||||||
extern Lst create; /* The list of target names specified on the
|
extern Lst *create; /* The list of target names specified on the
|
||||||
* command line. used to resolve #if
|
* command line. used to resolve #if
|
||||||
* make(...) statements */
|
* make(...) statements */
|
||||||
extern Lst dirSearchPath; /* The list of directories to search when
|
extern Lst *dirSearchPath; /* The list of directories to search when
|
||||||
* looking for targets */
|
* looking for targets */
|
||||||
extern IFile curFile; /* current makefile */
|
extern IFile curFile; /* current makefile */
|
||||||
extern Lst parseIncPath; /* The list of directories to search when
|
extern Lst *parseIncPath; /* The list of directories to search when
|
||||||
* looking for includes */
|
* looking for includes */
|
||||||
|
|
||||||
extern Boolean jobsRunning; /* True if jobs are running */
|
extern Boolean jobsRunning; /* True if jobs are running */
|
||||||
@ -314,7 +314,7 @@ extern Boolean queryFlag; /* TRUE if we aren't supposed to really make
|
|||||||
|
|
||||||
extern Boolean checkEnvFirst; /* TRUE if environment should be searched for
|
extern Boolean checkEnvFirst; /* TRUE if environment should be searched for
|
||||||
* all variables before the global context */
|
* all variables before the global context */
|
||||||
extern Lst envFirstVars; /* List of specific variables for which the
|
extern Lst *envFirstVars; /* List of specific variables for which the
|
||||||
* environment should be searched before the
|
* environment should be searched before the
|
||||||
* global context */
|
* global context */
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ extern time_t now; /* The time at the start of this whole
|
|||||||
|
|
||||||
extern Boolean oldVars; /* Do old-style variable substitution */
|
extern Boolean oldVars; /* Do old-style variable substitution */
|
||||||
|
|
||||||
extern Lst sysIncPath; /* The system include path. */
|
extern Lst *sysIncPath; /* The system include path. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* debug control:
|
* debug control:
|
||||||
@ -377,6 +377,6 @@ Boolean Make_OODate(GNode *);
|
|||||||
int Make_HandleUse(GNode *, GNode *);
|
int Make_HandleUse(GNode *, GNode *);
|
||||||
void Make_Update(GNode *);
|
void Make_Update(GNode *);
|
||||||
void Make_DoAllVar(GNode *);
|
void Make_DoAllVar(GNode *);
|
||||||
Boolean Make_Run(Lst);
|
Boolean Make_Run(Lst *);
|
||||||
|
|
||||||
#endif /* _MAKE_H_ */
|
#endif /* _MAKE_H_ */
|
||||||
|
@ -40,18 +40,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* arch.c */
|
/* arch.c */
|
||||||
ReturnStatus Arch_ParseArchive(char **, Lst, GNode *);
|
ReturnStatus Arch_ParseArchive(char **, Lst *, GNode *);
|
||||||
void Arch_Touch(GNode *);
|
void Arch_Touch(GNode *);
|
||||||
void Arch_TouchLib(GNode *);
|
void Arch_TouchLib(GNode *);
|
||||||
int Arch_MTime(GNode *);
|
int Arch_MTime(GNode *);
|
||||||
int Arch_MemMTime(GNode *);
|
int Arch_MemMTime(GNode *);
|
||||||
void Arch_FindLib(GNode *, Lst);
|
void Arch_FindLib(GNode *, Lst *);
|
||||||
Boolean Arch_LibOODate(GNode *);
|
Boolean Arch_LibOODate(GNode *);
|
||||||
void Arch_Init(void);
|
void Arch_Init(void);
|
||||||
void Arch_End(void);
|
void Arch_End(void);
|
||||||
|
|
||||||
/* compat.c */
|
/* compat.c */
|
||||||
void Compat_Run(Lst);
|
void Compat_Run(Lst *);
|
||||||
int Compat_RunCommand(void *, void *);
|
int Compat_RunCommand(void *, void *);
|
||||||
|
|
||||||
/* cond.c */
|
/* cond.c */
|
||||||
@ -88,7 +88,7 @@ void Parse_File(char *, FILE *);
|
|||||||
void Parse_Init(void);
|
void Parse_Init(void);
|
||||||
void Parse_End(void);
|
void Parse_End(void);
|
||||||
void Parse_FromString(char *, int);
|
void Parse_FromString(char *, int);
|
||||||
Lst Parse_MainName(void);
|
Lst *Parse_MainName(void);
|
||||||
|
|
||||||
/* str.c */
|
/* str.c */
|
||||||
void str_init(void);
|
void str_init(void);
|
||||||
@ -105,7 +105,7 @@ Boolean Suff_IsTransform(char *);
|
|||||||
GNode *Suff_AddTransform(char *);
|
GNode *Suff_AddTransform(char *);
|
||||||
int Suff_EndTransform(void *, void *);
|
int Suff_EndTransform(void *, void *);
|
||||||
void Suff_AddSuffix(char *);
|
void Suff_AddSuffix(char *);
|
||||||
Lst Suff_GetPath(char *);
|
Lst *Suff_GetPath(char *);
|
||||||
void Suff_DoPaths(void);
|
void Suff_DoPaths(void);
|
||||||
void Suff_AddInclude(char *);
|
void Suff_AddInclude(char *);
|
||||||
void Suff_AddLib(char *);
|
void Suff_AddLib(char *);
|
||||||
@ -120,7 +120,7 @@ void Targ_Init(void);
|
|||||||
void Targ_End(void);
|
void Targ_End(void);
|
||||||
GNode *Targ_NewGN(char *);
|
GNode *Targ_NewGN(char *);
|
||||||
GNode *Targ_FindNode(char *, int);
|
GNode *Targ_FindNode(char *, int);
|
||||||
Lst Targ_FindList(Lst, int);
|
Lst *Targ_FindList(Lst *, int);
|
||||||
Boolean Targ_Ignore(GNode *);
|
Boolean Targ_Ignore(GNode *);
|
||||||
Boolean Targ_Silent(GNode *);
|
Boolean Targ_Silent(GNode *);
|
||||||
Boolean Targ_Precious(GNode *);
|
Boolean Targ_Precious(GNode *);
|
||||||
|
@ -101,8 +101,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
*/
|
*/
|
||||||
#define CONTINUE 1
|
#define CONTINUE 1
|
||||||
#define DONE 0
|
#define DONE 0
|
||||||
static Lst targets; /* targets we're working on */
|
static Lst *targets; /* targets we're working on */
|
||||||
static Lst targCmds; /* command lines for targets */
|
static Lst *targCmds; /* command lines for targets */
|
||||||
static Boolean inLine; /* true if currently in a dependency
|
static Boolean inLine; /* true if currently in a dependency
|
||||||
* line or its commands */
|
* line or its commands */
|
||||||
static int fatals = 0;
|
static int fatals = 0;
|
||||||
@ -113,10 +113,10 @@ static GNode *mainNode; /* The main target to create. This is the
|
|||||||
|
|
||||||
IFile curFile; /* current makefile */
|
IFile curFile; /* current makefile */
|
||||||
|
|
||||||
static Lst includes; /* stack of IFiles generated by
|
static Lst *includes; /* stack of IFiles generated by
|
||||||
* #includes */
|
* #includes */
|
||||||
Lst parseIncPath; /* list of directories for "..." includes */
|
Lst *parseIncPath; /* list of directories for "..." includes */
|
||||||
Lst sysIncPath; /* list of directories for <...> includes */
|
Lst *sysIncPath; /* list of directories for <...> includes */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* specType contains the SPECial TYPE of the current target. It is
|
* specType contains the SPECial TYPE of the current target. It is
|
||||||
@ -212,7 +212,7 @@ static int ParseFindKeyword(char *);
|
|||||||
static int ParseLinkSrc(void *, void *);
|
static int ParseLinkSrc(void *, void *);
|
||||||
static int ParseDoOp(void *, void *);
|
static int ParseDoOp(void *, void *);
|
||||||
static int ParseAddDep(void *, void *);
|
static int ParseAddDep(void *, void *);
|
||||||
static void ParseDoSrc(int, char *, Lst);
|
static void ParseDoSrc(int, char *, Lst *);
|
||||||
static int ParseFindMain(void *, void *);
|
static int ParseFindMain(void *, void *);
|
||||||
static int ParseAddDir(void *, void *);
|
static int ParseAddDir(void *, void *);
|
||||||
static int ParseClearPath(void *, void *);
|
static int ParseClearPath(void *, void *);
|
||||||
@ -376,8 +376,8 @@ ParseDoOp(void *gnp, void *opp)
|
|||||||
* and the new instance is linked to all parents of the initial
|
* and the new instance is linked to all parents of the initial
|
||||||
* instance.
|
* instance.
|
||||||
*/
|
*/
|
||||||
GNode *cohort;
|
GNode *cohort;
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
cohort = Targ_NewGN(gn->name);
|
cohort = Targ_NewGN(gn->name);
|
||||||
/*
|
/*
|
||||||
@ -464,7 +464,7 @@ ParseAddDep(void *pp, void *sp)
|
|||||||
*---------------------------------------------------------------------
|
*---------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
ParseDoSrc(int tOp, char *src, Lst allsrc)
|
ParseDoSrc(int tOp, char *src, Lst *allsrc)
|
||||||
{
|
{
|
||||||
GNode *gn = NULL;
|
GNode *gn = NULL;
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ ParseDoSrc(int tOp, char *src, Lst allsrc)
|
|||||||
}
|
}
|
||||||
if ((gn->type & OP_OPMASK) == OP_DOUBLEDEP) {
|
if ((gn->type & OP_OPMASK) == OP_DOUBLEDEP) {
|
||||||
GNode *cohort;
|
GNode *cohort;
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
for (ln=Lst_First(gn->cohorts); ln != NULL; ln = Lst_Succ(ln)){
|
for (ln=Lst_First(gn->cohorts); ln != NULL; ln = Lst_Succ(ln)){
|
||||||
cohort = Lst_Datum(ln);
|
cohort = Lst_Datum(ln);
|
||||||
@ -670,14 +670,14 @@ ParseDoDependency (char *line)
|
|||||||
GNode *gn; /* a general purpose temporary node */
|
GNode *gn; /* a general purpose temporary node */
|
||||||
int op; /* the operator on the line */
|
int op; /* the operator on the line */
|
||||||
char savec; /* a place to save a character */
|
char savec; /* a place to save a character */
|
||||||
Lst paths; /* List of search paths to alter when parsing
|
Lst *paths; /* List of search paths to alter when parsing
|
||||||
* a list of .PATH targets */
|
* a list of .PATH targets */
|
||||||
int tOp; /* operator from special target */
|
int tOp; /* operator from special target */
|
||||||
Lst sources; /* list of archive source names after
|
Lst *sources; /* list of archive source names after
|
||||||
* expansion */
|
* expansion */
|
||||||
Lst curTargs; /* list of target names to be found and added
|
Lst *curTargs; /* list of target names to be found and added
|
||||||
* to the targets list */
|
* to the targets list */
|
||||||
Lst curSrcs; /* list of sources in order */
|
Lst *curSrcs; /* list of sources in order */
|
||||||
|
|
||||||
tOp = 0;
|
tOp = 0;
|
||||||
|
|
||||||
@ -870,7 +870,7 @@ ParseDoDependency (char *line)
|
|||||||
* Call on the suffix module to give us a path to
|
* Call on the suffix module to give us a path to
|
||||||
* modify.
|
* modify.
|
||||||
*/
|
*/
|
||||||
Lst path;
|
Lst *path;
|
||||||
|
|
||||||
specType = ExPath;
|
specType = ExPath;
|
||||||
path = Suff_GetPath(&line[5]);
|
path = Suff_GetPath(&line[5]);
|
||||||
@ -880,7 +880,7 @@ ParseDoDependency (char *line)
|
|||||||
&line[5]);
|
&line[5]);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (paths == (Lst)NULL) {
|
if (paths == NULL) {
|
||||||
paths = Lst_Init();
|
paths = Lst_Init();
|
||||||
}
|
}
|
||||||
Lst_AtEnd(paths, path);
|
Lst_AtEnd(paths, path);
|
||||||
@ -900,7 +900,7 @@ ParseDoDependency (char *line)
|
|||||||
* use Dir_Destroy in the destruction of the path as the
|
* use Dir_Destroy in the destruction of the path as the
|
||||||
* Dir module could have added a directory to the path...
|
* Dir module could have added a directory to the path...
|
||||||
*/
|
*/
|
||||||
Lst emptyPath = Lst_Init();
|
Lst *emptyPath = Lst_Init();
|
||||||
|
|
||||||
Dir_Expand(line, emptyPath, curTargs);
|
Dir_Expand(line, emptyPath, curTargs);
|
||||||
|
|
||||||
@ -2573,10 +2573,10 @@ Parse_End(void)
|
|||||||
*
|
*
|
||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
Lst
|
Lst *
|
||||||
Parse_MainName(void)
|
Parse_MainName(void)
|
||||||
{
|
{
|
||||||
Lst listmain; /* result list */
|
Lst *listmain; /* result list */
|
||||||
|
|
||||||
listmain = Lst_Init();
|
listmain = Lst_Init();
|
||||||
|
|
||||||
|
@ -97,10 +97,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
|
||||||
static Lst sufflist; /* Lst of suffixes */
|
static Lst *sufflist; /* Lst of suffixes */
|
||||||
static Lst suffClean; /* Lst of suffixes to be cleaned */
|
static Lst *suffClean; /* Lst of suffixes to be cleaned */
|
||||||
static Lst srclist; /* Lst of sources */
|
static Lst *srclist; /* Lst of sources */
|
||||||
static Lst transforms; /* Lst of transformation rules */
|
static Lst *transforms; /* Lst of transformation rules */
|
||||||
|
|
||||||
static int sNum = 0; /* Counter for assigning suffix numbers */
|
static int sNum = 0; /* Counter for assigning suffix numbers */
|
||||||
|
|
||||||
@ -114,13 +114,13 @@ typedef struct _Suff {
|
|||||||
#define SUFF_INCLUDE 0x01 /* One which is #include'd */
|
#define SUFF_INCLUDE 0x01 /* One which is #include'd */
|
||||||
#define SUFF_LIBRARY 0x02 /* One which contains a library */
|
#define SUFF_LIBRARY 0x02 /* One which contains a library */
|
||||||
#define SUFF_NULL 0x04 /* The empty suffix */
|
#define SUFF_NULL 0x04 /* The empty suffix */
|
||||||
Lst searchPath; /* The path along which files of this suffix
|
Lst *searchPath; /* The path along which files of this suffix
|
||||||
* may be found */
|
* may be found */
|
||||||
int sNum; /* The suffix number */
|
int sNum; /* The suffix number */
|
||||||
int refCount; /* Reference count of list membership */
|
int refCount; /* Reference count of list membership */
|
||||||
Lst parents; /* Suffixes we have a transformation to */
|
Lst *parents; /* Suffixes we have a transformation to */
|
||||||
Lst children; /* Suffixes we have a transformation from */
|
Lst *children; /* Suffixes we have a transformation from */
|
||||||
Lst ref; /* List of lists this suffix is referenced */
|
Lst *ref; /* List of lists this suffix is referenced */
|
||||||
} Suff;
|
} Suff;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -135,7 +135,7 @@ typedef struct _Src {
|
|||||||
int children; /* Count of existing children (so we don't free
|
int children; /* Count of existing children (so we don't free
|
||||||
* this thing too early or never nuke it) */
|
* this thing too early or never nuke it) */
|
||||||
#ifdef DEBUG_SRC
|
#ifdef DEBUG_SRC
|
||||||
Lst cp; /* Debug; children list */
|
Lst *cp; /* Debug; children list */
|
||||||
#endif
|
#endif
|
||||||
} Src;
|
} Src;
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ typedef struct _Src {
|
|||||||
* function...
|
* function...
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Lst l;
|
Lst *l;
|
||||||
Src *s;
|
Src *s;
|
||||||
} LstSrc;
|
} LstSrc;
|
||||||
|
|
||||||
@ -160,20 +160,20 @@ static int SuffSuffHasNameP(void *, void *);
|
|||||||
static int SuffSuffIsPrefix(void *, void *);
|
static int SuffSuffIsPrefix(void *, void *);
|
||||||
static int SuffGNHasNameP(void *, void *);
|
static int SuffGNHasNameP(void *, void *);
|
||||||
static void SuffFree(void *);
|
static void SuffFree(void *);
|
||||||
static void SuffInsert(Lst, Suff *);
|
static void SuffInsert(Lst *, Suff *);
|
||||||
static void SuffRemove(Lst, Suff *);
|
static void SuffRemove(Lst *, Suff *);
|
||||||
static Boolean SuffParseTransform(char *, Suff **, Suff **);
|
static Boolean SuffParseTransform(char *, Suff **, Suff **);
|
||||||
static int SuffRebuildGraph(void *, void *);
|
static int SuffRebuildGraph(void *, void *);
|
||||||
static int SuffAddSrc(void *, void *);
|
static int SuffAddSrc(void *, void *);
|
||||||
static int SuffRemoveSrc(Lst);
|
static int SuffRemoveSrc(Lst *);
|
||||||
static void SuffAddLevel(Lst, Src *);
|
static void SuffAddLevel(Lst *, Src *);
|
||||||
static Src *SuffFindThem(Lst, Lst);
|
static Src *SuffFindThem(Lst *, Lst *);
|
||||||
static Src *SuffFindCmds(Src *, Lst);
|
static Src *SuffFindCmds(Src *, Lst *);
|
||||||
static int SuffExpandChildren(void *, void *);
|
static int SuffExpandChildren(void *, void *);
|
||||||
static Boolean SuffApplyTransform(GNode *, GNode *, Suff *, Suff *);
|
static Boolean SuffApplyTransform(GNode *, GNode *, Suff *, Suff *);
|
||||||
static void SuffFindDeps(GNode *, Lst);
|
static void SuffFindDeps(GNode *, Lst *);
|
||||||
static void SuffFindArchiveDeps(GNode *, Lst);
|
static void SuffFindArchiveDeps(GNode *, Lst *);
|
||||||
static void SuffFindNormalDeps(GNode *, Lst);
|
static void SuffFindNormalDeps(GNode *, Lst *);
|
||||||
static int SuffPrintName(void *, void *);
|
static int SuffPrintName(void *, void *);
|
||||||
static int SuffPrintSuff(void *, void *);
|
static int SuffPrintSuff(void *, void *);
|
||||||
static int SuffPrintTrans(void *, void *);
|
static int SuffPrintTrans(void *, void *);
|
||||||
@ -363,9 +363,9 @@ SuffFree(void *sp)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
SuffRemove(Lst l, Suff *s)
|
SuffRemove(Lst *l, Suff *s)
|
||||||
{
|
{
|
||||||
LstNode ln = Lst_Member(l, s);
|
LstNode *ln = Lst_Member(l, s);
|
||||||
|
|
||||||
if (ln != NULL) {
|
if (ln != NULL) {
|
||||||
Lst_Remove(l, ln);
|
Lst_Remove(l, ln);
|
||||||
@ -387,9 +387,9 @@ SuffRemove(Lst l, Suff *s)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
SuffInsert(Lst l, Suff *s)
|
SuffInsert(Lst *l, Suff *s)
|
||||||
{
|
{
|
||||||
LstNode ln; /* current element in l we're examining */
|
LstNode *ln; /* current element in l we're examining */
|
||||||
Suff *s2 = NULL; /* the suffix descriptor in this element */
|
Suff *s2 = NULL; /* the suffix descriptor in this element */
|
||||||
|
|
||||||
if (Lst_Open(l) == FAILURE) {
|
if (Lst_Open(l) == FAILURE) {
|
||||||
@ -473,11 +473,11 @@ Suff_ClearSuffixes(void)
|
|||||||
static Boolean
|
static Boolean
|
||||||
SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr)
|
SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr)
|
||||||
{
|
{
|
||||||
LstNode srcLn; /* element in suffix list of trans source*/
|
LstNode *srcLn; /* element in suffix list of trans source*/
|
||||||
Suff *src; /* Source of transformation */
|
Suff *src; /* Source of transformation */
|
||||||
LstNode targLn; /* element in suffix list of trans target*/
|
LstNode *targLn; /* element in suffix list of trans target*/
|
||||||
char *str2; /* Extra pointer (maybe target suffix) */
|
char *str2; /* Extra pointer (maybe target suffix) */
|
||||||
LstNode singleLn; /* element in suffix list of any suffix
|
LstNode *singleLn; /* element in suffix list of any suffix
|
||||||
* that exactly matches str */
|
* that exactly matches str */
|
||||||
Suff *single = NULL;/* Source of possible transformation to
|
Suff *single = NULL;/* Source of possible transformation to
|
||||||
* null suffix */
|
* null suffix */
|
||||||
@ -576,7 +576,7 @@ Suff_AddTransform(char *line)
|
|||||||
GNode *gn; /* GNode of transformation rule */
|
GNode *gn; /* GNode of transformation rule */
|
||||||
Suff *s, /* source suffix */
|
Suff *s, /* source suffix */
|
||||||
*t; /* target suffix */
|
*t; /* target suffix */
|
||||||
LstNode ln; /* Node for existing transformation */
|
LstNode *ln; /* Node for existing transformation */
|
||||||
|
|
||||||
ln = Lst_Find(transforms, line, SuffGNHasNameP);
|
ln = Lst_Find(transforms, line, SuffGNHasNameP);
|
||||||
if (ln == NULL) {
|
if (ln == NULL) {
|
||||||
@ -698,7 +698,7 @@ SuffRebuildGraph(void *transformp, void *sp)
|
|||||||
GNode *transform = transformp;
|
GNode *transform = transformp;
|
||||||
Suff *s = sp;
|
Suff *s = sp;
|
||||||
char *cp;
|
char *cp;
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
Suff *s2 = NULL;
|
Suff *s2 = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -768,7 +768,7 @@ void
|
|||||||
Suff_AddSuffix(char *str)
|
Suff_AddSuffix(char *str)
|
||||||
{
|
{
|
||||||
Suff *s; /* new suffix descriptor */
|
Suff *s; /* new suffix descriptor */
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
ln = Lst_Find(sufflist, str, SuffSuffHasNameP);
|
ln = Lst_Find(sufflist, str, SuffSuffHasNameP);
|
||||||
if (ln == NULL) {
|
if (ln == NULL) {
|
||||||
@ -807,10 +807,10 @@ Suff_AddSuffix(char *str)
|
|||||||
* None
|
* None
|
||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
Lst
|
Lst *
|
||||||
Suff_GetPath(char *sname)
|
Suff_GetPath(char *sname)
|
||||||
{
|
{
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
Suff *s;
|
Suff *s;
|
||||||
|
|
||||||
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP);
|
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP);
|
||||||
@ -843,11 +843,11 @@ Suff_GetPath(char *sname)
|
|||||||
void
|
void
|
||||||
Suff_DoPaths(void)
|
Suff_DoPaths(void)
|
||||||
{
|
{
|
||||||
Suff *s;
|
Suff *s;
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
Lst inIncludes; /* Cumulative .INCLUDES path */
|
Lst *inIncludes; /* Cumulative .INCLUDES path */
|
||||||
Lst inLibs; /* Cumulative .LIBS path */
|
Lst *inLibs; /* Cumulative .LIBS path */
|
||||||
|
|
||||||
if (Lst_Open(sufflist) == FAILURE) {
|
if (Lst_Open(sufflist) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
@ -905,7 +905,7 @@ Suff_DoPaths(void)
|
|||||||
void
|
void
|
||||||
Suff_AddInclude(char *sname)
|
Suff_AddInclude(char *sname)
|
||||||
{
|
{
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
Suff *s;
|
Suff *s;
|
||||||
|
|
||||||
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP);
|
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP);
|
||||||
@ -934,7 +934,7 @@ Suff_AddInclude(char *sname)
|
|||||||
void
|
void
|
||||||
Suff_AddLib(char *sname)
|
Suff_AddLib(char *sname)
|
||||||
{
|
{
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
Suff *s;
|
Suff *s;
|
||||||
|
|
||||||
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP);
|
ln = Lst_Find(sufflist, sname, SuffSuffHasNameP);
|
||||||
@ -1028,7 +1028,7 @@ SuffAddSrc(void *sp, void *lsp)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
SuffAddLevel(Lst l, Src *targ)
|
SuffAddLevel(Lst *l, Src *targ)
|
||||||
{
|
{
|
||||||
LstSrc ls;
|
LstSrc ls;
|
||||||
|
|
||||||
@ -1051,9 +1051,9 @@ SuffAddLevel(Lst l, Src *targ)
|
|||||||
*----------------------------------------------------------------------
|
*----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
SuffRemoveSrc(Lst l)
|
SuffRemoveSrc(Lst *l)
|
||||||
{
|
{
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
Src *s;
|
Src *s;
|
||||||
int t = 0;
|
int t = 0;
|
||||||
|
|
||||||
@ -1075,7 +1075,7 @@ SuffRemoveSrc(Lst l)
|
|||||||
free(s->pref);
|
free(s->pref);
|
||||||
else {
|
else {
|
||||||
#ifdef DEBUG_SRC
|
#ifdef DEBUG_SRC
|
||||||
LstNode ln = Lst_Member(s->parent->cp, s);
|
LstNode *ln = Lst_Member(s->parent->cp, s);
|
||||||
if (ln != NULL)
|
if (ln != NULL)
|
||||||
Lst_Remove(s->parent->cp, ln);
|
Lst_Remove(s->parent->cp, ln);
|
||||||
#endif
|
#endif
|
||||||
@ -1118,7 +1118,7 @@ SuffRemoveSrc(Lst l)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static Src *
|
static Src *
|
||||||
SuffFindThem (Lst srcs, Lst slst)
|
SuffFindThem(Lst *srcs, Lst *slst)
|
||||||
{
|
{
|
||||||
Src *s; /* current Src */
|
Src *s; /* current Src */
|
||||||
Src *rs; /* returned Src */
|
Src *rs; /* returned Src */
|
||||||
@ -1180,9 +1180,9 @@ SuffFindThem (Lst srcs, Lst slst)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static Src *
|
static Src *
|
||||||
SuffFindCmds (Src *targ, Lst slst)
|
SuffFindCmds (Src *targ, Lst *slst)
|
||||||
{
|
{
|
||||||
LstNode ln; /* General-purpose list node */
|
LstNode *ln; /* General-purpose list node */
|
||||||
GNode *t, /* Target GNode */
|
GNode *t, /* Target GNode */
|
||||||
*s; /* Source GNode */
|
*s; /* Source GNode */
|
||||||
int prefLen;/* The length of the defined prefix */
|
int prefLen;/* The length of the defined prefix */
|
||||||
@ -1272,8 +1272,8 @@ SuffExpandChildren(void *cgnp, void *pgnp)
|
|||||||
GNode *cgn = cgnp;
|
GNode *cgn = cgnp;
|
||||||
GNode *pgn = pgnp;
|
GNode *pgn = pgnp;
|
||||||
GNode *gn; /* New source 8) */
|
GNode *gn; /* New source 8) */
|
||||||
LstNode prevLN; /* Node after which new source should be put */
|
LstNode *prevLN; /* Node after which new source should be put */
|
||||||
LstNode ln; /* List element for old source */
|
LstNode *ln; /* List element for old source */
|
||||||
char *cp; /* Expanded value */
|
char *cp; /* Expanded value */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1293,7 +1293,7 @@ SuffExpandChildren(void *cgnp, void *pgnp)
|
|||||||
cp = Var_Subst(NULL, cgn->name, pgn, TRUE);
|
cp = Var_Subst(NULL, cgn->name, pgn, TRUE);
|
||||||
|
|
||||||
if (cp != NULL) {
|
if (cp != NULL) {
|
||||||
Lst members = Lst_Init();
|
Lst *members = Lst_Init();
|
||||||
|
|
||||||
if (cgn->type & OP_ARCHV) {
|
if (cgn->type & OP_ARCHV) {
|
||||||
/*
|
/*
|
||||||
@ -1401,8 +1401,8 @@ SuffExpandChildren(void *cgnp, void *pgnp)
|
|||||||
Lst_Remove(pgn->children, ln);
|
Lst_Remove(pgn->children, ln);
|
||||||
DEBUGF(SUFF, ("\n"));
|
DEBUGF(SUFF, ("\n"));
|
||||||
} else if (Dir_HasWildcards(cgn->name)) {
|
} else if (Dir_HasWildcards(cgn->name)) {
|
||||||
Lst exp; /* List of expansions */
|
Lst *exp; /* List of expansions */
|
||||||
Lst path; /* Search path along which to expand */
|
Lst *path; /* Search path along which to expand */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find a path along which to expand the word.
|
* Find a path along which to expand the word.
|
||||||
@ -1495,7 +1495,7 @@ SuffExpandChildren(void *cgnp, void *pgnp)
|
|||||||
static Boolean
|
static Boolean
|
||||||
SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
|
SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
|
||||||
{
|
{
|
||||||
LstNode ln; /* General node */
|
LstNode *ln; /* General node */
|
||||||
char *tname; /* Name of transformation rule */
|
char *tname; /* Name of transformation rule */
|
||||||
GNode *gn; /* Node for same */
|
GNode *gn; /* Node for same */
|
||||||
|
|
||||||
@ -1592,7 +1592,7 @@ SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
SuffFindArchiveDeps(GNode *gn, Lst slst)
|
SuffFindArchiveDeps(GNode *gn, Lst *slst)
|
||||||
{
|
{
|
||||||
char *eoarch; /* End of archive portion */
|
char *eoarch; /* End of archive portion */
|
||||||
char *eoname; /* End of member portion */
|
char *eoname; /* End of member portion */
|
||||||
@ -1669,7 +1669,7 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
|
|||||||
* through the entire list, we just look at suffixes to which the
|
* through the entire list, we just look at suffixes to which the
|
||||||
* member's suffix may be transformed...
|
* member's suffix may be transformed...
|
||||||
*/
|
*/
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use first matching suffix...
|
* Use first matching suffix...
|
||||||
@ -1723,13 +1723,13 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
|
|||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
SuffFindNormalDeps(GNode *gn, Lst slst)
|
SuffFindNormalDeps(GNode *gn, Lst *slst)
|
||||||
{
|
{
|
||||||
char *eoname; /* End of name */
|
char *eoname; /* End of name */
|
||||||
char *sopref; /* Start of prefix */
|
char *sopref; /* Start of prefix */
|
||||||
LstNode ln; /* Next suffix node to check */
|
LstNode *ln; /* Next suffix node to check */
|
||||||
Lst srcs; /* List of sources at which to look */
|
Lst *srcs; /* List of sources at which to look */
|
||||||
Lst targs; /* List of targets to which things can be
|
Lst *targs; /* List of targets to which things can be
|
||||||
* transformed. They all have the same file,
|
* transformed. They all have the same file,
|
||||||
* but different suff and pref fields */
|
* but different suff and pref fields */
|
||||||
Src *bottom; /* Start of found transformation path */
|
Src *bottom; /* Start of found transformation path */
|
||||||
@ -2121,7 +2121,7 @@ Suff_FindDeps(GNode *gn)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SuffFindDeps(GNode *gn, Lst slst)
|
SuffFindDeps(GNode *gn, Lst *slst)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (gn->type & OP_DEPS_FOUND) {
|
if (gn->type & OP_DEPS_FOUND) {
|
||||||
@ -2146,7 +2146,7 @@ SuffFindDeps(GNode *gn, Lst slst)
|
|||||||
* set the TARGET variable to the node's name in order to give it a
|
* set the TARGET variable to the node's name in order to give it a
|
||||||
* value).
|
* value).
|
||||||
*/
|
*/
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
Suff *s;
|
Suff *s;
|
||||||
|
|
||||||
ln = Lst_Find(sufflist, LIBSUFF, SuffSuffHasNameP);
|
ln = Lst_Find(sufflist, LIBSUFF, SuffSuffHasNameP);
|
||||||
@ -2192,7 +2192,7 @@ void
|
|||||||
Suff_SetNull(char *name)
|
Suff_SetNull(char *name)
|
||||||
{
|
{
|
||||||
Suff *s;
|
Suff *s;
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
ln = Lst_Find(sufflist, name, SuffSuffHasNameP);
|
ln = Lst_Find(sufflist, name, SuffSuffHasNameP);
|
||||||
if (ln != NULL) {
|
if (ln != NULL) {
|
||||||
|
@ -88,8 +88,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
|
||||||
static Lst allTargets; /* the list of all targets found so far */
|
static Lst *allTargets; /* the list of all targets found so far */
|
||||||
static Lst allGNs; /* List of all the GNodes */
|
static Lst *allGNs; /* List of all the GNodes */
|
||||||
static Hash_Table targets; /* a hash table of same */
|
static Hash_Table targets; /* a hash table of same */
|
||||||
|
|
||||||
#define HTSIZE 191 /* initial size of hash table */
|
#define HTSIZE 191 /* initial size of hash table */
|
||||||
@ -276,11 +276,11 @@ Targ_FindNode(char *name, int flags)
|
|||||||
* an error message will be printed for each name which can't be found.
|
* an error message will be printed for each name which can't be found.
|
||||||
* -----------------------------------------------------------------------
|
* -----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
Lst
|
Lst *
|
||||||
Targ_FindList(Lst names, int flags)
|
Targ_FindList(Lst *names, int flags)
|
||||||
{
|
{
|
||||||
Lst nodes; /* result list */
|
Lst *nodes; /* result list */
|
||||||
LstNode ln; /* name list element */
|
LstNode *ln; /* name list element */
|
||||||
GNode *gn; /* node in tLn */
|
GNode *gn; /* node in tLn */
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ static char varNoError[] = "";
|
|||||||
GNode *VAR_GLOBAL; /* variables from the makefile */
|
GNode *VAR_GLOBAL; /* variables from the makefile */
|
||||||
GNode *VAR_CMD; /* variables defined on the command-line */
|
GNode *VAR_CMD; /* variables defined on the command-line */
|
||||||
|
|
||||||
static Lst allVars; /* List of all variables */
|
static Lst *allVars; /* List of all variables */
|
||||||
|
|
||||||
#define FIND_CMD 0x1 /* look in VAR_CMD when searching */
|
#define FIND_CMD 0x1 /* look in VAR_CMD when searching */
|
||||||
#define FIND_GLOBAL 0x2 /* look in VAR_GLOBAL as well */
|
#define FIND_GLOBAL 0x2 /* look in VAR_GLOBAL as well */
|
||||||
@ -207,7 +207,7 @@ static Var *
|
|||||||
VarFind(char *name, GNode *ctxt, int flags)
|
VarFind(char *name, GNode *ctxt, int flags)
|
||||||
{
|
{
|
||||||
Boolean localCheckEnvFirst;
|
Boolean localCheckEnvFirst;
|
||||||
LstNode var;
|
LstNode *var;
|
||||||
Var *v;
|
Var *v;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -379,7 +379,7 @@ VarDelete(void *vp)
|
|||||||
void
|
void
|
||||||
Var_Delete(char *name, GNode *ctxt)
|
Var_Delete(char *name, GNode *ctxt)
|
||||||
{
|
{
|
||||||
LstNode ln;
|
LstNode *ln;
|
||||||
|
|
||||||
DEBUGF(VAR, ("%s:delete %s\n", ctxt->name, name));
|
DEBUGF(VAR, ("%s:delete %s\n", ctxt->name, name));
|
||||||
ln = Lst_Find(ctxt->context, name, VarCmp);
|
ln = Lst_Find(ctxt->context, name, VarCmp);
|
||||||
|
Loading…
Reference in New Issue
Block a user