Welcome to mirror list, hosted at ThFree Co, Russian Federation.

script_internal.h « script « src - github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3839457acd3335b1d1cccec886e99a7c28527775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
 * \file   script_internal.h
 * \brief  Project scripting engine internal API.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */
#if !defined(PREMAKE_SCRIPT_INTERNAL_H)
#define PREMAKE_SCRIPT_INTERNAL_H

#include "script.h"
#include "session/session.h"

#define lua_c
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"


/* string constants for script variables and functions */
#define ACTION_KEY         "_ACTION"
#define BLOCKS_KEY         "blocks"
#define CONFIGURATION_KEY  "configuration"
#define FILE_KEY           "_FILE"
#define PROJECT_KEY        "project"
#define PROJECTS_KEY       "projects"
#define SOLUTION_KEY       "solution"
#define SOLUTIONS_KEY      "_SOLUTIONS"


/** Used to specify type of object for engine_get/set_active_object */
enum ObjectType
{
	SolutionObject = 0x01,
	ProjectObject  = 0x02,
	BlockObject    = 0x04
};

#define OPTIONAL     (0)
#define REQUIRED     (1)

lua_State*  script_get_lua(Script script);

/* internal state management */
int         script_internal_create_block(lua_State* L);
int         script_internal_get_active_object(lua_State* L, enum ObjectType type, int is_required);
void        script_internal_set_active_object(lua_State* L, enum ObjectType type);
const char* script_internal_script_dir(lua_State* L);
void        script_internal_populate_object(lua_State* L, struct FieldInfo* fields);

/* Generic project object field getter/setter API */
int  fn_accessor_register_all(lua_State* L);
int  fn_accessor_set_string_value(lua_State* L, struct FieldInfo* field);
int  fn_accessor_set_list_value(lua_State* L, struct FieldInfo* field);

/* script function handlers */
int  fn_accessor(lua_State* L);
int  fn_configuration(lua_State* L);
int  fn_configurations(lua_State* L);
int  fn_dofile(lua_State* L);
int  fn_error(lua_State* L);
int  fn_getcwd(lua_State* L);
int  fn_include(lua_State* L);
int  fn_match(lua_State* L);
int  fn_project(lua_State* L);
int  fn_solution(lua_State* L);

/* Project object unloading API. The unload functions "interface" provides an
 * opportunity to mock the actual implementation for automated testing */
struct UnloadFuncs
{
	int (*unload_solution)(lua_State* L, Solution sln);
	int (*unload_project)(lua_State* L, Project prj);
	int (*unload_block)(lua_State* L, Block blk);
};

int  unload_all(lua_State* L, Array slns, struct UnloadFuncs* funcs);
int  unload_solution(lua_State* L, Solution sln);
int  unload_project(lua_State* L, Project prj);
int  unload_block(lua_State* L, Block blk);

#endif