99
99
#define LGI_PARENT_IS_RETVAL (G_MAXINT - 1)
101
/* Yet another special value for 'parent' argument, meaning that the
102
value already contains address of caller-allocated space into which
103
the result should be marshalled. */
104
#define LGI_PARENT_CALLER_ALLOC (G_MAXINT - 2)
101
106
/* Marshalls single value from Lua to GLib/C. Returns number of temporary
102
107
entries pushed to Lua stack, which should be popped before function call
114
119
/* Marshalls single value from GLib/C to Lua. If parent is non-0, it
115
120
is stack index of parent structure/array in which this C value
117
void lgi_marshal_2lua (lua_State *L, GITypeInfo *ti, GITransfer xfer,
122
void lgi_marshal_2lua (lua_State *L, GITypeInfo *ti, GIArgInfo *ai,
123
GIDirection dir, GITransfer xfer,
118
124
gpointer source, int parent,
119
125
GICallableInfo *ci, void **args);
156
162
the arg record is part of). */
157
163
void lgi_record_2lua (lua_State *L, gpointer addr, gboolean own, int parent);
159
/* Gets pointer to C-structure from given Lua-side object. Expects
160
repo typetable of expected argument pushed on the top of the stack,
162
gpointer lgi_record_2c (lua_State *L, int narg, gboolean optional,
165
/* Gets pointer to C-structure from given Lua-side object, or copies
166
record to specified address. Expects repo typetable of expected
167
argument pushed on the top of the stack, removes it. */
168
void lgi_record_2c (lua_State *L, gint narg, gpointer target, gboolean by_value,
169
gboolean own, gboolean optional, gboolean nothrow);
165
171
/* Creates Lua-side part (proxy) of given object. If the object is not
166
172
owned (own == FALSE), an ownership is automatically acquired. Returns
167
173
number of elements pushed to the stack, i.e. always 1. */
169
lgi_object_2lua (lua_State *L, gpointer obj, gboolean own);
174
int lgi_object_2lua (lua_State *L, gpointer obj, gboolean own,
171
177
/* Gets pointer to C-side object represented by given Lua proxy. If
172
178
gtype is not G_TYPE_INVALID, the real type is checked to conform to
173
179
requested type. */
175
lgi_object_2c (lua_State *L, int narg, GType gtype, gboolean optional,
176
gboolean nothrow, gboolean transfer);
180
gpointer lgi_object_2c (lua_State *L, int narg, GType gtype, gboolean optional,
181
gboolean nothrow, gboolean transfer);
178
183
#if !GLIB_CHECK_VERSION(2, 30, 0)
179
184
/* Workaround for broken g_struct_info_get_size() for GValue, see