1 #include <time.h>
2 
3 struct CONTEXT;
4 
5 struct DEFERRED
6 {
7 	struct DEFERRED *next;
8 	struct NODE *node;
9 	int (*run)(struct CONTEXT *context, struct DEFERRED *info);
10 	void *user;
11 };
12 
13 struct CONTEXT
14 {
15 	struct HEAP *luaheap;
16 	struct lua_State *lua;
17 
18 	const char *filename;
19 	const char *filename_short;
20 	char script_directory[512];
21 
22 	struct HEAP *graphheap;
23 	struct GRAPH *graph;
24 	struct CACHE *cache;
25 
26 	struct NODE *defaulttarget;
27 	struct NODE *target;
28 
29 	/* this heap is used for dependency lookups that has to happen after we
30 		parsed the whole file */
31 	struct HEAP *deferredheap;
32 	struct DEFERRED *firstdeferred;
33 
34 	time_t globaltimestamp;
35 	time_t buildtime;
36 
37 	int exit_on_error;
38 	int num_commands;
39 	volatile int errorcode;
40 	volatile int current_cmd_num;
41 };
42 
43 const char *context_get_path(struct lua_State *L);
44 struct CONTEXT *context_get_pointer(struct lua_State *L);
45 int context_default_target(struct CONTEXT *context, struct NODE *node);
46 
47 int context_build_prepare(struct CONTEXT *context);
48 int context_build_clean(struct CONTEXT *context);
49 int context_build_make(struct CONTEXT *context);
50 
51 extern const char *CONTEXT_LUA_SCRIPTARGS_TABLE;
52 extern const char *CONTEXT_LUA_TARGETS_TABLE;
53 extern const char *CONTEXT_LUA_PATH;
54 extern const char *CONTEXT_LUA_WORKPATH;
55