Commit d550023d authored by Rafaël Carré's avatar Rafaël Carré

Fix zsh completion generation

parent a3bdb881
...@@ -37,6 +37,7 @@ typedef std::pair<int, std::string> mcpair; ...@@ -37,6 +37,7 @@ typedef std::pair<int, std::string> mcpair;
# include "config.h" # include "config.h"
#endif #endif
#include <vlc_common.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
/* evil hack */ /* evil hack */
...@@ -44,8 +45,8 @@ typedef std::pair<int, std::string> mcpair; ...@@ -44,8 +45,8 @@ typedef std::pair<int, std::string> mcpair;
#undef __BUILTIN__ #undef __BUILTIN__
#include <../src/modules/modules.h> #include <../src/modules/modules.h>
void ParseModules( libvlc_int_t *p_libvlc, mumap &mods, mcmap &mods2 ); void ParseModules( mumap &mods, mcmap &mods2 );
void PrintModuleList( libvlc_int_t *p_libvlc, mumap &mods, mcmap &mods2 ); void PrintModuleList( mumap &mods, mcmap &mods2 );
void ParseOption( module_config_t *p_item, mumap &mods, mcmap &mods2 ); void ParseOption( module_config_t *p_item, mumap &mods, mcmap &mods2 );
void PrintOption( char *psz_option, char i_short, char *psz_exlusive, void PrintOption( char *psz_option, char i_short, char *psz_exlusive,
char *psz_text, char *psz_longtext, char *psz_args ); char *psz_text, char *psz_longtext, char *psz_args );
...@@ -55,22 +56,19 @@ int main( int i_argc, const char **ppsz_argv ) ...@@ -55,22 +56,19 @@ int main( int i_argc, const char **ppsz_argv )
mumap mods; mumap mods;
mcmap mods2; mcmap mods2;
/* Create a libvlc structure */ /* Create a libvlc structure */
int i_ret = VLC_Create();
libvlc_int_t *p_libvlc;
if( i_ret < 0 ) libvlc_exception_t ex;
{ libvlc_exception_init(&ex);
return i_ret;
} const char * const argv[] = { "vlc" };
libvlc_instance_t *p_libvlc_instance = libvlc_new(1, argv, &ex);
/* Initialize libvlc */ if( !p_libvlc_instance || libvlc_exception_raised(&ex) )
i_ret = VLC_Init( 0, i_argc, ppsz_argv );
if( i_ret < 0 )
{ {
VLC_Destroy( 0 ); libvlc_exception_clear(&ex);
return i_ret; return 1;
} }
p_libvlc = (libvlc_int_t*)vlc_object_get( i_ret );
printf("#compdef vlc\n\n" printf("#compdef vlc\n\n"
"#This file is autogenerated by zsh.cpp\n" "#This file is autogenerated by zsh.cpp\n"
...@@ -78,10 +76,10 @@ int main( int i_argc, const char **ppsz_argv ) ...@@ -78,10 +76,10 @@ int main( int i_argc, const char **ppsz_argv )
"local context state line ret=1\n" "local context state line ret=1\n"
"local modules\n\n" ); "local modules\n\n" );
PrintModuleList( p_libvlc, mods, mods2 ); PrintModuleList( mods, mods2 );
printf( "_arguments -S -s \\\n" ); printf( "_arguments -S -s \\\n" );
ParseModules( p_libvlc, mods, mods2 ); ParseModules( mods, mods2 );
printf( " \"(--module)-p[print help on module]:print help on module:($modules)\"\\\n" ); printf( " \"(--module)-p[print help on module]:print help on module:($modules)\"\\\n" );
printf( " \"(-p)--module[print help on module]:print help on module:($modules)\"\\\n" ); printf( " \"(-p)--module[print help on module]:print help on module:($modules)\"\\\n" );
printf( " \"(--help)-h[print help]\"\\\n" ); printf( " \"(--help)-h[print help]\"\\\n" );
...@@ -105,34 +103,26 @@ int main( int i_argc, const char **ppsz_argv ) ...@@ -105,34 +103,26 @@ int main( int i_argc, const char **ppsz_argv )
printf( "return ret\n" ); printf( "return ret\n" );
/* Exit early since we did not release all the objects we used, libvlc_release( p_libvlc_instance );
* but we don't care, our task is over */
return 0;
/* Finish the threads */
VLC_CleanUp( 0 );
/* Destroy the libvlc structure */
VLC_Destroy( 0 );
return i_ret;
return 0;
} }
void ParseModules( libvlc_int_t *p_libvlc, mumap &mods, mcmap &mods2 ) void ParseModules( mumap &mods, mcmap &mods2 )
{ {
vlc_list_t *p_list = NULL;; module_t **p_list;
module_t *p_module; module_t *p_module;
module_config_t *p_item; module_config_t *p_item;
int i_index; int i_index;
int i_items; int i_items;
size_t i_modules;
/* List the plugins */ /* List the plugins */
p_list = vlc_list_find( p_libvlc, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = module_list_get(&i_modules);
if( !p_list ) return; if( !p_list ) return;
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( i_index = 0; i_index < i_modules; i_index++ )
{ {
p_module = (module_t *)p_list->p_values[i_index].p_object; p_module = p_list[i_index];
/* Exclude empty plugins (submodules don't have config options, they /* Exclude empty plugins (submodules don't have config options, they
* are stored in the parent module) */ * are stored in the parent module) */
...@@ -163,21 +153,22 @@ void ParseModules( libvlc_int_t *p_libvlc, mumap &mods, mcmap &mods2 ) ...@@ -163,21 +153,22 @@ void ParseModules( libvlc_int_t *p_libvlc, mumap &mods, mcmap &mods2 )
} }
} }
void PrintModuleList( libvlc_int_t *p_libvlc, mumap &mods, mcmap &mods2 ) void PrintModuleList( mumap &mods, mcmap &mods2 )
{ {
vlc_list_t *p_list = NULL;; module_t **p_list = NULL;
module_t *p_module; module_t *p_module;
int i_index; int i_index;
int i_items; int i_items;
size_t i_modules;
/* List the plugins */ /* List the plugins */
p_list = vlc_list_find( p_libvlc, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = module_list_get(&i_modules);
if( !p_list ) return; if( !p_list ) return;
printf( "modules=\"" ); printf( "modules=\"" );
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( i_index = 0; i_index < i_modules; i_index++ )
{ {
p_module = (module_t *)p_list->p_values[i_index].p_object; p_module = p_list[i_index];
/* Exclude empty plugins (submodules don't have config options, they /* Exclude empty plugins (submodules don't have config options, they
* are stored in the parent module) */ * are stored in the parent module) */
......
...@@ -38,6 +38,13 @@ function find_libvlc { ...@@ -38,6 +38,13 @@ function find_libvlc {
return 1 return 1
} }
function find_libvlccore {
for i in $BUILDDIR/src/.libs/libvlccore.$SUFFIX $BUILDDIR/src/libvlccore.$SUFFIX; do
test -e $i && LIBVLCCORE=$i && return 0
done
return 1
}
while test -z "$LIBVLC"; do while test -z "$LIBVLC"; do
if ! find_libvlc; then if ! find_libvlc; then
/bin/echo -n "Please enter the directory where you built vlc: " /bin/echo -n "Please enter the directory where you built vlc: "
...@@ -47,6 +54,10 @@ done ...@@ -47,6 +54,10 @@ done
echo "libvlc found !" echo "libvlc found !"
if ! find_libvlccore; then
/bin/echo -n "libvlccore not found ! Linking will fail !"
fi
LD_LIBRARY_PATH=$BUILDDIR/src/.libs LD_LIBRARY_PATH=$BUILDDIR/src/.libs
if test -e ../../extras/contrib/config.mak -a ! "`grep HOST ../../extras/contrib/config.mak 2>/dev/null|awk '{print $3}'`" != "$HOST"; then if test -e ../../extras/contrib/config.mak -a ! "`grep HOST ../../extras/contrib/config.mak 2>/dev/null|awk '{print $3}'`" != "$HOST"; then
...@@ -58,7 +69,7 @@ if test -z "$CXX"; then ...@@ -58,7 +69,7 @@ if test -z "$CXX"; then
CXX=g++ CXX=g++
fi fi
ZSH_BUILD="$CXX $CPPFLAGS $CXXFLAGS -D__LIBVLC__ -DHAVE_CONFIG_H -I$BUILDDIR -I$BUILDDIR/include -I../../include zsh.cpp $LIBVLC -o zsh_gen" ZSH_BUILD="$CXX $CPPFLAGS $CXXFLAGS -D__LIBVLC__ -DHAVE_CONFIG_H -I$BUILDDIR -I$BUILDDIR/include -I../../include zsh.cpp $LIBVLC $LIBVLCCORE -o zsh_gen"
echo "Building zsh completion generator ... " echo "Building zsh completion generator ... "
echo $ZSH_BUILD echo $ZSH_BUILD
......
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