X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=vlc-api.pl;h=dc8056f0eb6a52044f4954cc84ebfd515a57b32a;hb=c4232d210f01ec6c492612bc1789de6184f0652a;hp=8b22ff437652da8d57ffeb87c0016d328607dbbf;hpb=58f0b81b680496abeb750649e245d8ef626e9d09;p=vlc diff --git a/vlc-api.pl b/vlc-api.pl index 8b22ff4376..dc8056f0eb 100755 --- a/vlc-api.pl +++ b/vlc-api.pl @@ -19,9 +19,10 @@ #* #* You should have received a copy of the GNU General Public License #* along with this program; if not, write to the Free Software -#* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. +#* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. #*****************************************************************************/ +use IO::Handle; use strict; my $srcdir = $ENV{'top_srcdir'}; @@ -30,19 +31,24 @@ my $srcdir = $ENV{'top_srcdir'}; # Reads to-be exported APIs # my %new_APIs; +my $new_sym = IO::Handle->new(); +open $new_sym, '> libvlc.sym' or die "libvlc.sym: $!\n"; while () { if (/VLC_EXPORT\(\s*(\w.*\S)\s*,\s*(\w*)\s*,\s*\(\s*(\w.*\S)\s*\)\s*\)[^)]*$/) { $new_APIs{$2} = [ ( $1, $3 ) ]; + print { $new_sym } "$2\n"; } } +close $new_sym; + # # Write header's header # -open my $new_sym, '> vlc_symbols.h.new' or die "$!"; +open $new_sym, '> vlc_symbols.h.new' or die "vlc_symbols.h.new: $!\n"; print { $new_sym } "/*\n". " * This file is automatically generated. DO NOT EDIT!\n". @@ -53,29 +59,8 @@ print { $new_sym } "# define __VLC_SYMBOLS_H\n". "\n". "# ifdef HAVE_SHARED_LIBVLC\n". - "/*\n". - " * In an ideal world, plugins would include all the headers they need.\n". - " * But of course, many, if not all, of them don't, so we have to make sure\n". - " * the whole libvlc API is defined here in any case when included from a\n". - " * plugin.\n". - " */\n". - "# ifdef __PLUGIN__\n". - "# ifdef __cplusplus\n". - "extern \"C\" {\n". - "# endif\n"; - -foreach (keys %new_APIs) -{ - print { $new_sym } - $new_APIs{$_}[0]." $_ (".$new_APIs{$_}[1].");\n"; -} - -print { $new_sym } - "# ifdef __cplusplus\n". - "}\n". - "# endif\n". - "# endif /* __PLUGIN__ */\n". - "# else /* HAVE_LIBVLC_SHARED */\n". + "# error You are not supposed to include this file!\n". + "# endif\n". "/*\n". " * This is the big VLC API structure for plugins :\n". " * Changing its layout breaks plugin's binary compatibility,\n". @@ -96,7 +81,8 @@ my @API; my @deprecated_API; my $parse = 0; -open my $oldfd, "< $srcdir/include/vlc_symbols.h"; +my $oldfd = IO::Handle->new(); +open $oldfd, "< $srcdir/include/vlc_symbols.h"; while (<$oldfd>) { @@ -176,7 +162,7 @@ foreach (keys %new_APIs) # print { $new_sym } "};\n". - "# if defined (__PLUGIN__)\n"; + "# if defined (__PLUGIN__)\n"; foreach (@API) { @@ -184,11 +170,11 @@ foreach (@API) } print { $new_sym } - "# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)\n". + "# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)\n". "/******************************************************************\n". " * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.\n". " ******************************************************************/\n". - "# define STORE_SYMBOLS( p_symbols ) \\\n"; + "# define STORE_SYMBOLS( p_symbols ) \\\n"; foreach (@API) { @@ -201,8 +187,7 @@ foreach (@deprecated_API) print { $new_sym } "\n". - "# endif /* __PLUGIN__ */\n". - "# endif /* HAVE_SHARED_LIBVLC */\n". + "# endif /* __PLUGIN__ */\n". "#endif /* __VLC_SYMBOLS_H */\n"; close $new_sym;