version 1.68, 2003/06/03 02:56:12 |
version 1.69, 2004/04/07 13:11:36 |
|
|
*---------------------------------------------------------------------- |
*---------------------------------------------------------------------- |
*/ |
*/ |
static int |
static int |
ParseFindKeyword(str) |
ParseFindKeyword(const char *str) /* keyword to look up */ |
const char *str; /* String to find */ |
|
{ |
{ |
int start, |
int start, |
end, |
end, |
|
|
*--------------------------------------------------------------------- |
*--------------------------------------------------------------------- |
*/ |
*/ |
static void |
static void |
ParseLinkSrc(pgn, cgn) |
ParseLinkSrc( |
GNode *pgn; /* The parent node */ |
GNode *pgn, /* The parent node */ |
GNode *cgn; /* The child node */ |
GNode *cgn) /* The child node */ |
{ |
{ |
if (Lst_AddNew(&pgn->children, cgn)) { |
if (Lst_AddNew(&pgn->children, cgn)) { |
if (specType == Not) |
if (specType == Not) |
|
|
*--------------------------------------------------------------------- |
*--------------------------------------------------------------------- |
*/ |
*/ |
static int |
static int |
ParseDoOp(gn, op) |
ParseDoOp( |
GNode *gn; /* The node to which the operator is to be |
GNode *gn, /* The node to which the operator is to be applied */ |
* applied */ |
int op) /* The operator to apply */ |
int op; /* The operator to apply */ |
|
{ |
{ |
/* |
/* |
* If the dependency mask of the operator and the node don't match and |
* If the dependency mask of the operator and the node don't match and |
|
|
*--------------------------------------------------------------------- |
*--------------------------------------------------------------------- |
*/ |
*/ |
static int |
static int |
ParseAddDep(p, s) |
ParseAddDep(GNode *p, GNode *s) |
GNode *p; |
|
GNode *s; |
|
{ |
{ |
if (p->order < s->order) { |
if (p->order < s->order) { |
/* XXX: This can cause loops, and loops can cause unmade targets, |
/* XXX: This can cause loops, and loops can cause unmade targets, |
|
|
*--------------------------------------------------------------------- |
*--------------------------------------------------------------------- |
*/ |
*/ |
static void |
static void |
ParseDoSrc(tOp, src) |
ParseDoSrc( |
int tOp; /* operator (if any) from special targets */ |
int tOp, /* operator (if any) from special targets */ |
const char *src; /* name of the source to handle */ |
const char *src) /* name of the source to handle */ |
|
|
{ |
{ |
GNode *gn = NULL; |
GNode *gn = NULL; |
|
|
|
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
static int |
static int |
ParseFindMain(gnp, dummy) |
ParseFindMain( |
void *gnp; /* Node to examine */ |
void *gnp, /* Node to examine */ |
void *dummy UNUSED; |
void *dummy UNUSED) |
{ |
{ |
GNode *gn = (GNode *)gnp; |
GNode *gn = (GNode *)gnp; |
if ((gn->type & OP_NOTARGET) == 0) { |
if ((gn->type & OP_NOTARGET) == 0) { |
|
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
static void |
static void |
ParseAddDir(path, name) |
ParseAddDir(void *path, void *name) |
void *path; |
|
void *name; |
|
{ |
{ |
Dir_AddDir((Lst)path, (char *)name); |
Dir_AddDir((Lst)path, (char *)name); |
} |
} |
|
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
static void |
static void |
ParseClearPath(p) |
ParseClearPath(void *p) |
void *p; |
|
{ |
{ |
Lst path = (Lst)p; |
Lst path = (Lst)p; |
|
|
|
|
*--------------------------------------------------------------------- |
*--------------------------------------------------------------------- |
*/ |
*/ |
static void |
static void |
ParseDoDependency(line) |
ParseDoDependency(char *line) /* the line to parse */ |
char *line; /* the line to parse */ |
|
{ |
{ |
char *cp; /* our current position */ |
char *cp; /* our current position */ |
GNode *gn; /* a general purpose temporary node */ |
GNode *gn; /* a general purpose temporary node */ |
|
|
* A new element is added to the commands list of the node. |
* A new element is added to the commands list of the node. |
*/ |
*/ |
static void |
static void |
ParseAddCmd(gnp, cmd) |
ParseAddCmd( |
void *gnp; /* the node to which the command is to be added */ |
void *gnp, /* the node to which the command is to be added */ |
void *cmd; /* the command to add */ |
void *cmd) /* the command to add */ |
{ |
{ |
GNode *gn = (GNode *)gnp; |
GNode *gn = (GNode *)gnp; |
/* if target already supplied, ignore commands */ |
/* if target already supplied, ignore commands */ |
|
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
static void |
static void |
ParseHasCommands(gnp) |
ParseHasCommands(void *gnp) /* Node to examine */ |
void *gnp; /* Node to examine */ |
|
{ |
{ |
GNode *gn = (GNode *)gnp; |
GNode *gn = (GNode *)gnp; |
if (!Lst_IsEmpty(&gn->commands)) { |
if (!Lst_IsEmpty(&gn->commands)) { |
|
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
void |
void |
Parse_AddIncludeDir(dir) |
Parse_AddIncludeDir(const char *dir) /* The name of the directory to add */ |
const char *dir; /* The name of the directory to add */ |
|
{ |
{ |
Dir_AddDir(parseIncPath, dir); |
Dir_AddDir(parseIncPath, dir); |
} |
} |
|
|
*--------------------------------------------------------------------- |
*--------------------------------------------------------------------- |
*/ |
*/ |
static void |
static void |
ParseDoInclude(file) |
ParseDoInclude(char *file)/* file specification */ |
char *file; /* file specification */ |
|
{ |
{ |
char endc; /* the character which ends the file spec */ |
char endc; /* the character which ends the file spec */ |
char *cp; /* current position in file spec */ |
char *cp; /* current position in file spec */ |
|
|
*--------------------------------------------------------------------- |
*--------------------------------------------------------------------- |
*/ |
*/ |
static void |
static void |
ParseTraditionalInclude(file) |
ParseTraditionalInclude(char *file) /* file specification */ |
char *file; /* file specification */ |
|
{ |
{ |
char *cp; /* current position in file spec */ |
char *cp; /* current position in file spec */ |
|
|
|
|
*--------------------------------------------------------------------- |
*--------------------------------------------------------------------- |
*/ |
*/ |
static void |
static void |
ParseConditionalInclude(file) |
ParseConditionalInclude(char *file)/* file specification */ |
char *file; /* file specification */ |
|
{ |
{ |
char *cp; /* current position in file spec */ |
char *cp; /* current position in file spec */ |
|
|
|
|
|
|
/* Common part to lookup and read an include file. */ |
/* Common part to lookup and read an include file. */ |
static void |
static void |
ParseLookupIncludeFile(spec, endSpec, isSystem, errIfNotFound) |
ParseLookupIncludeFile(char *spec, char *endSpec, bool isSystem, |
char *spec; |
bool errIfNotFound) |
char *endSpec; |
|
bool isSystem; |
|
bool errIfNotFound; |
|
{ |
{ |
char *file; |
char *file; |
char *fullname; |
char *fullname; |
|
|
/* Strip comments from the line. May return either a copy of the line, or |
/* Strip comments from the line. May return either a copy of the line, or |
* the line itself. */ |
* the line itself. */ |
static char * |
static char * |
strip_comments(copy, line) |
strip_comments(Buffer copy, const char *line) |
Buffer copy; |
|
const char *line; |
|
{ |
{ |
const char *comment; |
const char *comment; |
const char *p; |
const char *p; |
|
|
} |
} |
|
|
static bool |
static bool |
ParseIsCond(linebuf, copy, line) |
ParseIsCond(Buffer linebuf, Buffer copy, char *line) |
Buffer linebuf; |
|
Buffer copy; |
|
char *line; |
|
{ |
{ |
|
|
char *stripped; |
char *stripped; |
|
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
static void |
static void |
ParseFinishDependency() |
ParseFinishDependency(void) |
{ |
{ |
Array_Every(>argets, Suff_EndTransform); |
Array_Every(>argets, Suff_EndTransform); |
Array_Every(>argets, ParseHasCommands); |
Array_Every(>argets, ParseHasCommands); |
|
|
} |
} |
|
|
static void |
static void |
ParseDoCommands(line) |
ParseDoCommands(const char *line) |
const char *line; |
|
{ |
{ |
/* add the command to the list of |
/* add the command to the list of |
* commands of all targets in the dependency spec */ |
* commands of all targets in the dependency spec */ |
|
|
} |
} |
|
|
void |
void |
Parse_File(name, stream) |
Parse_File( |
const char *name; /* the name of the file being read */ |
const char *name, /* the name of the file being read */ |
FILE *stream; /* Stream open to makefile to parse */ |
FILE *stream) /* Stream open to makefile to parse */ |
{ |
{ |
char *cp, /* pointer into the line */ |
char *cp, /* pointer into the line */ |
*line; /* the line we're working on */ |
*line; /* the line we're working on */ |
|
|
} |
} |
|
|
void |
void |
Parse_Init() |
Parse_Init(void) |
{ |
{ |
mainNode = NULL; |
mainNode = NULL; |
Static_Lst_Init(parseIncPath); |
Static_Lst_Init(parseIncPath); |
|
|
|
|
#ifdef CLEANUP |
#ifdef CLEANUP |
void |
void |
Parse_End() |
Parse_End(void) |
{ |
{ |
Lst_Destroy(&targCmds, (SimpleProc)free); |
Lst_Destroy(&targCmds, (SimpleProc)free); |
Lst_Destroy(sysIncPath, Dir_Destroy); |
Lst_Destroy(sysIncPath, Dir_Destroy); |
|
|
|
|
|
|
void |
void |
Parse_MainName(listmain) |
Parse_MainName(Lst listmain) /* result list */ |
Lst listmain; /* result list */ |
|
{ |
{ |
|
|
if (mainNode == NULL) { |
if (mainNode == NULL) { |