2 * Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
4 * This file is part of Jam - see jam.c for Copyright information.
7 * compile.h - compile parsed jam statements
9 * 01/22/01 (seiwald) - replace evaluate_if() with compile_eval()
10 * 01/24/01 (seiwald) - 'while' statement
11 * 03/02/02 (seiwald) - rules can be invoked via variable names
12 * 02/28/02 (seiwald) - merge EXEC_xxx flags in with RULE_xxx
13 * 10/22/02 (seiwald) - working return/break/continue statements
14 * 11/04/02 (seiwald) - const-ing for string literals
16 #ifndef JAMH_COMPILE_H
17 #define JAMH_COMPILE_H
19 extern void compile_builtins (void);
21 extern LIST
*compile_append (PARSE
*parse
, LOL
*args
, int *jmp
);
22 extern LIST
*compile_break (PARSE
*parse
, LOL
*args
, int *jmp
);
23 extern LIST
*compile_foreach (PARSE
*parse
, LOL
*args
, int *jmp
);
24 extern LIST
*compile_if (PARSE
*parse
, LOL
*args
, int *jmp
);
25 extern LIST
*compile_eval (PARSE
*parse
, LOL
*args
, int *jmp
);
26 extern LIST
*compile_include (PARSE
*parse
, LOL
*args
, int *jmp
);
27 extern LIST
*compile_list (PARSE
*parse
, LOL
*args
, int *jmp
);
28 extern LIST
*compile_local (PARSE
*parse
, LOL
*args
, int *jmp
);
29 extern LIST
*compile_null (PARSE
*parse
, LOL
*args
, int *jmp
);
30 extern LIST
*compile_on (PARSE
*parse
, LOL
*args
, int *jmp
);
31 extern LIST
*compile_rule (PARSE
*parse
, LOL
*args
, int *jmp
);
32 extern LIST
*compile_rules (PARSE
*parse
, LOL
*args
, int *jmp
);
33 extern LIST
*compile_set (PARSE
*parse
, LOL
*args
, int *jmp
);
34 extern LIST
*compile_setcomp (PARSE
*parse
, LOL
*args
, int *jmp
);
35 extern LIST
*compile_setexec (PARSE
*parse
, LOL
*args
, int *jmp
);
36 extern LIST
*compile_settings (PARSE
*parse
, LOL
*args
, int *jmp
);
37 extern LIST
*compile_switch (PARSE
*parse
, LOL
*args
, int *jmp
);
38 extern LIST
*compile_while (PARSE
*parse
, LOL
*args
, int *jmp
);
40 extern LIST
*evaluate_rule (const char *rulename
, LOL
*args
, LIST
*result
);
43 /* conditions for compile_if() */
45 EXPR_NOT
, /* ! cond */
46 EXPR_AND
, /* cond && cond */
47 EXPR_OR
, /* cond || cond */
49 EXPR_EXISTS
, /* arg */
50 EXPR_EQUALS
, /* arg = arg */
51 EXPR_NOTEQ
, /* arg != arg */
52 EXPR_LESS
, /* arg < arg */
53 EXPR_LESSEQ
, /* arg <= arg */
54 EXPR_MORE
, /* arg > arg */
55 EXPR_MOREEQ
, /* arg >= arg */
56 EXPR_IN
/* arg in arg */
60 /* Flags for compile_return */
62 JMP_NONE
, /* flow continues */
63 JMP_BREAK
, /* break out of loop */
64 JMP_CONTINUE
, /* step to end of loop */
65 JMP_RETURN
/* return from rule */