X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=vlc-api.pl;h=247a815cbf38dcfc4e7a6cf1fdab22a365ac2e2b;hb=76b20a6067ba09de6d689ee3e44d6e9f8bb0134a;hp=8753f3970f369fed36233f67fce402a601d3d728;hpb=85b29bdc288a1573d43bd524908be5748a9b3640;p=vlc diff --git a/vlc-api.pl b/vlc-api.pl index 8753f3970f..247a815cbf 100755 --- a/vlc-api.pl +++ b/vlc-api.pl @@ -2,7 +2,7 @@ #***************************************************************************** #* vlc-api.pl: VLC API maintenance script #***************************************************************************** -#* Copyright (C) 2005 VideoLAN (Centrale Réseaux) and its contributors +#* Copyright (C) 2005 the VideoLAN team #* $Id$ #* #* Authors: Rémi Denis-Courmont @@ -19,11 +19,14 @@ #* #* 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'}; + # # Reads to-be exported APIs # @@ -40,7 +43,8 @@ while () # # Write header's header # -open my $new_sym, '> include/vlc_symbols.h.new' or die "$!"; +my $new_sym=IO::Handle->new(); +open $new_sym, '> vlc_symbols.h.new' or die "$!"; print { $new_sym } "/*\n". " * This file is automatically generated. DO NOT EDIT!\n". @@ -50,6 +54,9 @@ print { $new_sym } "#ifndef __VLC_SYMBOLS_H\n". "# define __VLC_SYMBOLS_H\n". "\n". + "# ifdef HAVE_SHARED_LIBVLC\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". @@ -68,15 +75,25 @@ my $changes = 0; # my @API; my @deprecated_API; +my $parse = 0; + +my $oldfd = IO::Handle->new(); +open $oldfd, "< $srcdir/include/vlc_symbols.h"; -open my $oldfd, '< include/vlc_symbols.h'; while (<$oldfd>) { - if (/^ void \*(\w*)_deprecated;$/) + if (/^struct module_symbols_t/) + { + $parse = 1; + } + elsif ($parse == 0) { - if (defined $new_APIs{$2}) + } + elsif (/^ void \*(\w*)_deprecated;$/) + { + if (defined $new_APIs{$1}) { - print "[info] $2 was RESTORED!\n"; + print "[info] $1 was RESTORED!\n"; print { $new_sym } " ".$new_APIs{$1}[0]." (*$1_inner) (".$new_APIs{$1}[1].");\n"; delete $new_APIs{$1}; @@ -142,7 +159,7 @@ foreach (keys %new_APIs) print { $new_sym } "};\n". "# if defined (__PLUGIN__)\n"; - + foreach (@API) { print { $new_sym } "# define $_ (p_symbols)->${_}_inner\n"; @@ -175,10 +192,10 @@ close $new_sym; # if ($changes != 0) { - rename 'include/vlc_symbols.h.new', 'include/vlc_symbols.h'; + rename 'vlc_symbols.h.new', "$srcdir/include/vlc_symbols.h"; print "$changes API(s) changed.\n"; } else { - unlink 'include/vlc_symbols.h.new'; + unlink 'vlc_symbols.h.new'; }