1/*
2 * Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
3 *
4 * This file is part of Jam - see jam.c for Copyright information.
5 */
6
7/*
8 * compile.h - compile parsed jam statements
9 *
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
16 */
17
18void compile_builtins();
19
20LIST *compile_append( PARSE *parse, LOL *args, int *jmp );
21LIST *compile_break( PARSE *parse, LOL *args, int *jmp );
22LIST *compile_foreach( PARSE *parse, LOL *args, int *jmp );
23LIST *compile_if( PARSE *parse, LOL *args, int *jmp );
24LIST *compile_eval( PARSE *parse, LOL *args, int *jmp );
25LIST *compile_include( PARSE *parse, LOL *args, int *jmp );
26LIST *compile_list( PARSE *parse, LOL *args, int *jmp );
27LIST *compile_local( PARSE *parse, LOL *args, int *jmp );
28LIST *compile_null( PARSE *parse, LOL *args, int *jmp );
29LIST *compile_on( PARSE *parse, LOL *args, int *jmp );
30LIST *compile_rule( PARSE *parse, LOL *args, int *jmp );
31LIST *compile_rules( PARSE *parse, LOL *args, int *jmp );
32LIST *compile_set( PARSE *parse, LOL *args, int *jmp );
33LIST *compile_setcomp( PARSE *parse, LOL *args, int *jmp );
34LIST *compile_setexec( PARSE *parse, LOL *args, int *jmp );
35LIST *compile_settings( PARSE *parse, LOL *args, int *jmp );
36LIST *compile_switch( PARSE *parse, LOL *args, int *jmp );
37LIST *compile_while( PARSE *parse, LOL *args, int *jmp );
38
39LIST *evaluate_rule( const char *rulename, LOL *args, LIST *result, int *jmp );
40
41/* Conditions for compile_if() */
42
43# define EXPR_NOT	0	/* ! cond */
44# define EXPR_AND	1	/* cond && cond */
45# define EXPR_OR	2	/* cond || cond */
46
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 */
55
56/* Flags for compile_return */
57
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 */
62# define JMP_EOF	4	/* stop executing the current file */
63