diff options
author | harti <harti@FreeBSD.org> | 2005-04-11 07:20:10 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2005-04-11 07:20:10 +0000 |
commit | e0e1cda47d1ab672740932980f0528e49c020775 (patch) | |
tree | 60d3956bc33947fb68e3718f818abf16c726d320 /usr.bin/make/cond.h | |
parent | f2968c80c994b77c5c1dafc45fce7be685d043e1 (diff) | |
download | FreeBSD-src-e0e1cda47d1ab672740932980f0528e49c020775.zip FreeBSD-src-e0e1cda47d1ab672740932980f0528e49c020775.tar.gz |
Rework the directive parsing code. Instead of using a lot of strcmp()s
on every line that starts with a dot use a minimal perfect hash
function and a single strcmp() on the first word after the dot
to find out whether it is really a directive call and, if yes, which
one. Then directly dispatch to a handler function for that directive
(or fall through to the dependency handling code). This makes the
directive parse a little bit more strict about the syntax: the directive
word must be followed by a character that is not alphanumerical and not
an underline (making .undefFOO illegal); .endif and .else can only be
followed by comments.
Diffstat (limited to 'usr.bin/make/cond.h')
-rw-r--r-- | usr.bin/make/cond.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.bin/make/cond.h b/usr.bin/make/cond.h index ecd9a80..9a8dbdc 100644 --- a/usr.bin/make/cond.h +++ b/usr.bin/make/cond.h @@ -48,7 +48,26 @@ #define COND_SKIP 1 /* Skip the next lines */ #define COND_INVALID 2 /* Not a conditional statement */ -int Cond_Eval(char *, int); +enum { + COND_IF, + COND_IFDEF, + COND_IFNDEF, + COND_IFMAKE, + COND_IFNMAKE, + COND_ELSE, + COND_ELIF, + COND_ELIFDEF, + COND_ELIFNDEF, + COND_ELIFMAKE, + COND_ELIFNMAKE, + COND_ENDIF, +}; + +void Cond_If(char *, int, int); +void Cond_Else(char *, int, int); +void Cond_Endif(char *, int, int); void Cond_End(void); +extern Boolean skipLine; + #endif /* cond_h_6e96ad7c */ |