Commit 17bb975a authored by Rémi Duraffort's avatar Rémi Duraffort

lua: remove leading '__' in function name

parent 189185bf
...@@ -51,29 +51,6 @@ typedef struct ...@@ -51,29 +51,6 @@ typedef struct
/***************************************************************************** /*****************************************************************************
* Generic vlc_object_t wrapper creation * Generic vlc_object_t wrapper creation
*****************************************************************************/ *****************************************************************************/
int __vlclua_push_vlc_object( lua_State *L, vlc_object_t *p_obj,
lua_CFunction pf_gc )
{
vlc_object_t **udata = (vlc_object_t **)
lua_newuserdata( L, sizeof( vlc_object_t * ) );
*udata = p_obj;
if( luaL_newmetatable( L, "vlc_object" ) )
{
/* Hide the metatable */
lua_pushliteral( L, "none of your business" );
lua_setfield( L, -2, "__metatable" );
if( pf_gc ) /* FIXME */
{
/* Set the garbage collector if needed */
lua_pushcfunction( L, pf_gc );
lua_setfield( L, -2, "__gc" );
}
}
lua_setmetatable( L, -2 );
return 1;
}
int vlclua_gc_release( lua_State *L ) int vlclua_gc_release( lua_State *L )
{ {
vlc_object_t **p_obj = (vlc_object_t **)luaL_checkudata( L, 1, "vlc_object" ); vlc_object_t **p_obj = (vlc_object_t **)luaL_checkudata( L, 1, "vlc_object" );
...@@ -118,6 +95,30 @@ static int vlclua_get_input( lua_State *L ) ...@@ -118,6 +95,30 @@ static int vlclua_get_input( lua_State *L )
return 1; return 1;
} }
#undef vlclua_push_vlc_object
int vlclua_push_vlc_object( lua_State *L, vlc_object_t *p_obj,
lua_CFunction pf_gc )
{
vlc_object_t **udata = (vlc_object_t **)
lua_newuserdata( L, sizeof( vlc_object_t * ) );
*udata = p_obj;
if( luaL_newmetatable( L, "vlc_object" ) )
{
/* Hide the metatable */
lua_pushliteral( L, "none of your business" );
lua_setfield( L, -2, "__metatable" );
if( pf_gc ) /* FIXME */
{
/* Set the garbage collector if needed */
lua_pushcfunction( L, pf_gc );
lua_setfield( L, -2, "__gc" );
}
}
lua_setmetatable( L, -2 );
return 1;
}
/***************************************************************************** /*****************************************************************************
* *
*****************************************************************************/ *****************************************************************************/
......
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
#ifndef VLC_LUA_OBJECTS_H #ifndef VLC_LUA_OBJECTS_H
#define VLC_LUA_OBJECTS_H #define VLC_LUA_OBJECTS_H
int __vlclua_push_vlc_object( lua_State *L, vlc_object_t *p_obj, int vlclua_push_vlc_object( lua_State *L, vlc_object_t *p_obj,
lua_CFunction pf_gc ); lua_CFunction pf_gc );
#define vlclua_push_vlc_object( a, b, c ) \ #define vlclua_push_vlc_object( a, b, c ) \
__vlclua_push_vlc_object( a, VLC_OBJECT( b ), c ) vlclua_push_vlc_object( a, VLC_OBJECT( b ), c )
int vlclua_gc_release( lua_State *L ); int vlclua_gc_release( lua_State *L );
#endif #endif
......
...@@ -263,7 +263,8 @@ static int vlclua_libvlc_command( lua_State *L ) ...@@ -263,7 +263,8 @@ static int vlclua_libvlc_command( lua_State *L )
return vlclua_push_ret( L, i_ret ); return vlclua_push_ret( L, i_ret );
} }
int __vlclua_var_toggle_or_set( lua_State *L, vlc_object_t *p_obj, #undef vlclua_var_toggle_or_set
int vlclua_var_toggle_or_set( lua_State *L, vlc_object_t *p_obj,
const char *psz_name ) const char *psz_name )
{ {
bool b_bool; bool b_bool;
......
...@@ -25,9 +25,10 @@ ...@@ -25,9 +25,10 @@
#ifndef VLC_LUA_VARIABLES_H #ifndef VLC_LUA_VARIABLES_H
#define VLC_LUA_VARIABLES_H #define VLC_LUA_VARIABLES_H
#define vlclua_var_toggle_or_set(a,b,c) \ int vlclua_var_toggle_or_set( lua_State *, vlc_object_t *, const char * );
__vlclua_var_toggle_or_set(a,VLC_OBJECT(b),c)
int __vlclua_var_toggle_or_set( lua_State *, vlc_object_t *, const char * ); #define vlclua_var_toggle_or_set( a, b, c ) \
vlclua_var_toggle_or_set( a, VLC_OBJECT( b ), c )
#endif #endif
...@@ -372,7 +372,8 @@ char *vlclua_find_file( vlc_object_t *p_this, const char *psz_luadirname, const ...@@ -372,7 +372,8 @@ char *vlclua_find_file( vlc_object_t *p_this, const char *psz_luadirname, const
* Meta data setters utility. * Meta data setters utility.
* Playlist item table should be on top of the stack when these are called * Playlist item table should be on top of the stack when these are called
*****************************************************************************/ *****************************************************************************/
void __vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L, #undef vlclua_read_meta_data
void vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L,
input_item_t *p_input ) input_item_t *p_input )
{ {
#define TRY_META( a, b ) \ #define TRY_META( a, b ) \
...@@ -406,7 +407,8 @@ void __vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L, ...@@ -406,7 +407,8 @@ void __vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L,
TRY_META( "trackid", TrackID ); TRY_META( "trackid", TrackID );
} }
void __vlclua_read_custom_meta_data( vlc_object_t *p_this, lua_State *L, #undef vlclua_read_custom_meta_data
void vlclua_read_custom_meta_data( vlc_object_t *p_this, lua_State *L,
input_item_t *p_input ) input_item_t *p_input )
{ {
/* Lock the input item and create the meta table if needed */ /* Lock the input item and create the meta table if needed */
...@@ -451,7 +453,8 @@ void __vlclua_read_custom_meta_data( vlc_object_t *p_this, lua_State *L, ...@@ -451,7 +453,8 @@ void __vlclua_read_custom_meta_data( vlc_object_t *p_this, lua_State *L,
/** /**
* Playlist item table should be on top of the stack when this is called * Playlist item table should be on top of the stack when this is called
*/ */
void __vlclua_read_options( vlc_object_t *p_this, lua_State *L, #undef vlclua_read_options
void vlclua_read_options( vlc_object_t *p_this, lua_State *L,
int *pi_options, char ***pppsz_options ) int *pi_options, char ***pppsz_options )
{ {
lua_getfield( L, -1, "options" ); lua_getfield( L, -1, "options" );
...@@ -477,7 +480,8 @@ void __vlclua_read_options( vlc_object_t *p_this, lua_State *L, ...@@ -477,7 +480,8 @@ void __vlclua_read_options( vlc_object_t *p_this, lua_State *L,
lua_pop( L, 1 ); /* pop "options" */ lua_pop( L, 1 ); /* pop "options" */
} }
int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L, #undef vlclua_playlist_add_internal
int vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
playlist_t *p_playlist, playlist_t *p_playlist,
input_item_t *p_parent, bool b_play ) input_item_t *p_parent, bool b_play )
{ {
...@@ -750,7 +754,8 @@ static int vlclua_add_modules_path_inner( lua_State *L, const char *psz_path ) ...@@ -750,7 +754,8 @@ static int vlclua_add_modules_path_inner( lua_State *L, const char *psz_path )
return count; return count;
} }
int __vlclua_add_modules_path( vlc_object_t *obj, lua_State *L, const char *psz_filename ) #undef vlclua_add_modules_path
int vlclua_add_modules_path( vlc_object_t *obj, lua_State *L, const char *psz_filename )
{ {
/* Setup the module search path: /* Setup the module search path:
* * "The script's directory"/modules * * "The script's directory"/modules
......
...@@ -135,19 +135,19 @@ int vlclua_dofile( vlc_object_t *p_this, lua_State *L, const char *url ); ...@@ -135,19 +135,19 @@ int vlclua_dofile( vlc_object_t *p_this, lua_State *L, const char *url );
/***************************************************************************** /*****************************************************************************
* Playlist and meta data internal utilities. * Playlist and meta data internal utilities.
*****************************************************************************/ *****************************************************************************/
void __vlclua_read_options( vlc_object_t *, lua_State *, int *, char *** ); void vlclua_read_options( vlc_object_t *, lua_State *, int *, char *** );
#define vlclua_read_options(a,b,c,d) __vlclua_read_options(VLC_OBJECT(a),b,c,d) #define vlclua_read_options( a, b, c, d ) vlclua_read_options( VLC_OBJECT( a ), b, c, d )
void __vlclua_read_meta_data( vlc_object_t *, lua_State *, input_item_t * ); void vlclua_read_meta_data( vlc_object_t *, lua_State *, input_item_t * );
#define vlclua_read_meta_data(a,b,c) __vlclua_read_meta_data(VLC_OBJECT(a),b,c) #define vlclua_read_meta_data( a, b, c ) vlclua_read_meta_data( VLC_OBJECT( a ), b, c )
void __vlclua_read_custom_meta_data( vlc_object_t *, lua_State *, void vlclua_read_custom_meta_data( vlc_object_t *, lua_State *,
input_item_t *); input_item_t *);
#define vlclua_read_custom_meta_data(a,b,c) __vlclua_read_custom_meta_data(VLC_OBJECT(a),b,c) #define vlclua_read_custom_meta_data( a, b, c ) vlclua_read_custom_meta_data( VLC_OBJECT( a ), b, c )
int __vlclua_playlist_add_internal( vlc_object_t *, lua_State *, playlist_t *, int vlclua_playlist_add_internal( vlc_object_t *, lua_State *, playlist_t *,
input_item_t *, bool ); input_item_t *, bool );
#define vlclua_playlist_add_internal(a,b,c,d,e) __vlclua_playlist_add_internal(VLC_OBJECT(a),b,c,d,e) #define vlclua_playlist_add_internal( a, b, c, d, e ) vlclua_playlist_add_internal( VLC_OBJECT( a ), b, c, d, e )
int __vlclua_add_modules_path( vlc_object_t *, lua_State *, const char *psz_filename ); int vlclua_add_modules_path( vlc_object_t *, lua_State *, const char *psz_filename );
#define vlclua_add_modules_path( a, b, c ) __vlclua_add_modules_path(VLC_OBJECT(a), b, c) #define vlclua_add_modules_path( a, b, c ) vlclua_add_modules_path( VLC_OBJECT( a ), b, c )
/** /**
* Per-interface private state * Per-interface private state
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment