]> git.sesse.net Git - vlc/commitdiff
zsh completion:
authorRafaël Carré <funman@videolan.org>
Tue, 15 Jan 2008 10:37:12 +0000 (10:37 +0000)
committerRafaël Carré <funman@videolan.org>
Tue, 15 Jan 2008 10:37:12 +0000 (10:37 +0000)
    don't use "mmap" which already exists in stdio.h as a function
    use an evil hack to get module_t structure
    permit to compile from the source tree when VLC was built in an external build tree: make BUILDDIR=../../XXX

extras/Makefile
extras/zsh.cpp

index 22644156c2e04e6c187f51e8ac52cf29c6c04b64..971e50cd6f3b03454a614077f4a489a8dc0d3bc2 100644 (file)
@@ -1,2 +1,4 @@
+BUILDDIR ?= ..
+
 zsh: zsh.cpp
-       g++ -I.. -I../include zsh.cpp ../src/.libs/libvlc.so -o zsh `top_builddir=.. ../vlc-config vlc builtin --cflags --libs`
+       g++ ${CXXFLAGS} -I${BUILDDIR} -I${BUILDDIR}/include -I../include zsh.cpp ${BUILDDIR}/src/.libs/libvlc.so -o zsh `top_builddir=${BUILDDIR} ${BUILDDIR}/vlc-config vlc builtin --cflags --libs`
index 1fe867fa81a6d79259df6dfdfe58e55551a0dd65..3b7645997246e184e4f9f7c425447a000e7356cc 100644 (file)
@@ -27,7 +27,7 @@
 #include <utility>
 #include <iostream>
 #include <algorithm>
-typedef std::multimap<std::string, std::string> mmap;
+typedef std::multimap<std::string, std::string> mumap;
 typedef std::multimap<int, std::string> mcmap;
 
 typedef std::pair<std::string, std::string> mpair;
@@ -35,15 +35,20 @@ typedef std::pair<int, std::string> mcpair;
 
 #include <vlc/vlc.h>
 
-void ParseModules( libvlc_int_t *p_libvlc, mmap &mods, mcmap &mods2 );
-void PrintModuleList( libvlc_int_t *p_libvlc, mmap &mods, mcmap &mods2 );
-void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 );
+/* evil hack */
+#undef __PLUGIN__
+#undef __BUILTIN__
+#include <../src/modules/modules.h>
+
+void ParseModules( libvlc_int_t *p_libvlc, mumap &mods, mcmap &mods2 );
+void PrintModuleList( libvlc_int_t *p_libvlc, 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,
                    char *psz_text, char *psz_longtext, char *psz_args );
 
-int main( int i_argc, char **ppsz_argv )
+int main( int i_argc, const char **ppsz_argv )
 {
-    mmap mods;
+    mumap mods;
     mcmap mods2;
     /* Create a libvlc structure */
     int i_ret = VLC_Create();
@@ -107,7 +112,7 @@ int main( int i_argc, char **ppsz_argv )
 
 }
 
-void ParseModules( libvlc_int_t *p_libvlc, mmap &mods, mcmap &mods2 )
+void ParseModules( libvlc_int_t *p_libvlc, mumap &mods, mcmap &mods2 )
 {
     vlc_list_t      *p_list = NULL;;
     module_t        *p_module;
@@ -151,7 +156,7 @@ void ParseModules( libvlc_int_t *p_libvlc, mmap &mods, mcmap &mods2 )
     }
 }
 
-void PrintModuleList( libvlc_int_t *p_libvlc, mmap &mods, mcmap &mods2 )
+void PrintModuleList( libvlc_int_t *p_libvlc, mumap &mods, mcmap &mods2 )
 {
     vlc_list_t      *p_list = NULL;;
     module_t        *p_module;
@@ -195,7 +200,7 @@ void PrintModuleList( libvlc_int_t *p_libvlc, mmap &mods, mcmap &mods2 )
     return;
 }
 
-void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
+void ParseOption( module_config_t *p_item, mumap &mods, mcmap &mods2 )
 {
     char *psz_arguments = strdup( "" );
     char *psz_exclusive;
@@ -207,14 +212,14 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
 #define DUP( x ) strdup( x ? x : "" )
 
     //Skip deprecated options
-    if( p_item->psz_current )
+    if( p_item->b_removed )
         return;
 
     switch( p_item->i_type )
     {
     case CONFIG_ITEM_MODULE:
     {
-        std::pair<mmap::iterator, mmap::iterator> range = mods.equal_range( p_item->psz_type );
+        std::pair<mumap::iterator, mumap::iterator> range = mods.equal_range( p_item->psz_type );
         std::string list = (*range.first).second;
         ++range.first;
         while( range.first != range.second )