forked from darktable-org/darktable
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlua.h
More file actions
101 lines (78 loc) · 3.19 KB
/
Copy pathlua.h
File metadata and controls
101 lines (78 loc) · 3.19 KB
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
/*
This file is part of darktable,
copyright (c) 2012 Jeremy Rosen
darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
darktable is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with darktable. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LUA_LUA_H
#define LUA_LUA_H
/* this file can safely be included when lua is disabled */
/* these include are out of the ifdef to avoid compile errors when compiling with/without lua
users that accidentally use it won't be affected by the ifdef USE_LUA
*/
#include <glib.h>
#include "common/dtpthread.h"
#ifdef USE_LUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <lautoc.h>
/**
(0,+1)
find or create the global darktable module table and push it on the stack
*/
int dt_lua_push_darktable_lib(lua_State *L);
/**
(-1,+1)
check that the top of the stack is a table, creates or find a subtable named "name",
adds it on top of the stack, and remove the previous table
used to easily do a tree organisation of objects
*/
void dt_lua_goto_subtable(lua_State *L, const char *sub_name);
void dt_lua_init_lock();
void dt_lua_lock_internal(const char *function, const char *file, int line, gboolean silent);
void dt_lua_unlock_internal(const char *function, int line);
#define dt_lua_debug_stack(L) dt_lua_debug_stack_internal(L, __FUNCTION__, __LINE__)
void dt_lua_debug_stack_internal(lua_State *L, const char *function, int line);
#define dt_lua_debug_table(L, index) dt_lua_debug_table_internal(L, index, __FUNCTION__, __LINE__)
void dt_lua_debug_table_internal(lua_State *L, int t, const char *function, int line);
#define dt_lua_lock() dt_lua_lock_internal(__FUNCTION__, __FILE__, __LINE__, FALSE)
#define dt_lua_lock_silent() dt_lua_lock_internal(__FUNCTION__, __FILE__, __LINE__, TRUE)
#define dt_lua_unlock() dt_lua_unlock_internal( __FUNCTION__, __LINE__)
typedef struct
{
lua_State *state;
dt_pthread_mutex_t mutex;
int pending_threads ;
bool ending;
GMainLoop *loop;
GMainContext *context;
GThreadPool *pool;
GAsyncQueue * stacked_job_queue;
GAsyncQueue * alien_job_queue;
GAsyncQueue * string_job_queue;
} dt_lua_state_t;
void dt_lua_redraw_screen();
#else
/* defines to easily have a few lua types when lua is not available */
typedef int lua_State;
typedef int (*lua_CFunction)(lua_State *L);
typedef int luaA_Type;
#define LUAA_INVALID_TYPE -1
typedef struct
{
int unused; // if this is empty clang++ complains that the struct has size 0 in C and size 1 in C++
} dt_lua_state_t;
#endif
#endif
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;