summaryrefslogtreecommitdiff
path: root/src/lib/elua/Elua.h
blob: e9bd6eeee90b109796124a5e37a99d2fce88234e (plain) (blame)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/**
 * @file Elua.h
 * @brief Elua Library
 *
 * @defgroup Elua Elua
 */

/**
 *
 * @section intro Elua library
 *
 * The Elua library was created to ease integration of EFL Lua into other EFL
 * libraries or applications. Using the Elua library you can easily create a
 * Lua state that is fully set up for running EFL Lua bindings.
 *
 * You can find the API documentation at @ref Elua
*/
#ifndef _ELUA_H
#define _ELUA_H

#ifdef EAPI
# undef EAPI
#endif

#ifdef _WIN32
# ifdef EFL_ELUA_BUILD
#  ifdef DLL_EXPORT
#   define EAPI __declspec(dllexport)
#  else
#   define EAPI
#  endif /* ! DLL_EXPORT */
# else
#  define EAPI __declspec(dllimport)
# endif /* ! EFL_ELUA_BUILD */
#else
# ifdef __GNUC__
#  if __GNUC__ >= 4
#   define EAPI __attribute__ ((visibility("default")))
#  else
#   define EAPI
#  endif
# else
#  define EAPI
# endif
#endif /* ! _WIN32 */

#ifdef __cplusplus
extern "C" {
#endif

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#ifdef EFL_BETA_API_SUPPORT

#include <Eina.h>

#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

typedef struct _Elua_State Elua_State;

EAPI int elua_init(void);
EAPI int elua_shutdown(void);

EAPI Elua_State *elua_state_new(const char *progname);
EAPI Elua_State *elua_state_from_lua_get(lua_State *L);

EAPI void elua_state_free(Elua_State *es);

EAPI void elua_state_dirs_set(Elua_State *es, const char *core,
                              const char *mods, const char *apps);
EAPI void elua_state_dirs_fill(Elua_State *es, Eina_Bool ignore_env);

EAPI Eina_Stringshare *elua_state_core_dir_get(const Elua_State *es);
EAPI Eina_Stringshare *elua_state_mod_dir_get(const Elua_State *es);
EAPI Eina_Stringshare *elua_state_apps_dir_get(const Elua_State *es);

EAPI Eina_Stringshare *elua_state_prog_name_get(const Elua_State *es);

EAPI void elua_state_include_path_add(Elua_State *es, const char *path);

EAPI Eina_Bool elua_state_require_ref_push(Elua_State *es);
EAPI Eina_Bool elua_state_appload_ref_push(Elua_State *es);

EAPI lua_State *elua_state_lua_state_get(const Elua_State *es);

EAPI int elua_report_error(const Elua_State *es, const char *pname, int status);

EAPI Eina_Bool elua_state_setup_i18n(const Elua_State *es);
EAPI Eina_Bool elua_state_setup_modules(const Elua_State *es);

EAPI int elua_io_loadfile(const Elua_State *es, const char *fname);
EAPI void elua_io_register(const Elua_State *es);

EAPI int elua_io_popen(lua_State *L);
EAPI int elua_module_init(lua_State *L);
EAPI int elua_module_system_init(lua_State *L);

EAPI int elua_util_require(Elua_State *es, const char *libname);
EAPI int elua_util_file_run(Elua_State *es, const char *fname);
EAPI int elua_util_string_run(Elua_State *es, const char *chunk,
                              const char *chname);
EAPI Eina_Bool elua_util_app_load(Elua_State *es, const char *appname);
EAPI int elua_util_script_run(Elua_State *es, int argc, char **argv, int n,
                              int *quit);

#endif

#ifdef __cplusplus
} // extern "C" {
#endif

#endif