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