[libdvbpsi-devel] rev 1 of the rename script

Daniel Kamil Kozar git at videolan.org
Mon Jan 11 09:43:17 CET 2016


libdvbpsi | branch: master | Daniel Kamil Kozar <dkk089 at gmail.com> | Wed Sep 30 18:47:32 2015 +0200| [c1ace456bb2a820a4346d6fc5aafe268c917c4dc] | committer: Daniel Kamil Kozar

rev 1 of the rename script

> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=c1ace456bb2a820a4346d6fc5aafe268c917c4dc
---

 dr-api-rename.pl |   66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/dr-api-rename.pl b/dr-api-rename.pl
new file mode 100755
index 0000000..3f6bf5c
--- /dev/null
+++ b/dr-api-rename.pl
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use File::Find;
+use Tie::File;
+use Data::Dumper;
+
+my @dr_headers;
+
+sub wanted_dr_h {
+  push @dr_headers, $File::Find::name if /^dr_[0-f]{2}\.h$/;
+}
+
+find(\&wanted_dr_h, 'src/descriptors');
+
+for(@dr_headers) {
+  my $hdrinfo = parse_header($_);
+  next if not defined $hdrinfo;
+}
+
+exit 0;
+
+sub parse_header {
+  my $dr_h = shift;
+  my $sname;
+  my $decode_start;
+  my $fname;
+  my @decode_decl;
+  my @file;
+  tie @file, 'Tie::File', $dr_h or die "Can't open $dr_h";
+  print $dr_h . "\n";
+  
+  for(@file) {
+    if(/^typedef struct dvbpsi_(.*?)_dr_(?:t|s)$/) {
+      $sname = $1;
+      last;
+    }
+  }
+  return undef if not defined $sname;
+  
+  for(my $i = 0 ; $i < scalar(@file) ; ++$i) {
+    if($file[$i] =~ /^dvbpsi_${sname}_dr_t *?\* *?dvbpsi_Decode(.*?)Dr/) {
+      $fname = $1;
+      $decode_start = $i;
+      push @decode_decl, $file[$i];
+      last if($file[$i] =~ /.*;.*/);
+      $i++;
+      while(1) {
+        push @decode_decl, $file[$i];
+        if($file[$i] =~ /.*;.*/) {
+          last;
+        }
+        else {
+          $i++;
+        }
+      }
+    }
+  }
+  return undef if not defined $fname;
+  
+  
+  
+  untie @file;
+  return 0;
+}



More information about the libdvbpsi-devel mailing list