Add a utility to convert raptor timestamps back into localtime.
authorWilliam Roberts <williamr@symbian.org>
Wed, 03 Jun 2009 18:33:51 +0100
changeset 3 8b87ea768cb8
parent 2 a600c1a596f7
child 4 60053dab7e2a
Add a utility to convert raptor timestamps back into localtime. Lots of change to the find_public_apis.pl script, trying to get more insight Add filename globbing to the sbs_findstr.pl script, so you can scan *compile*
williamr/convert_time.pl
williamr/find_public_apis.pl
williamr/sbs_findstr.pl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/williamr/convert_time.pl	Wed Jun 03 18:33:51 2009 +0100
@@ -0,0 +1,23 @@
+#! perl
+
+# Copyright (c) 2009 Symbian Foundation Ltd
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Symbian Foundation Ltd - initial contribution.
+# 
+# Contributors:
+#
+# Description:
+# Convert timestamps into localtime.
+
+my $line;
+while ($line = <>)
+  {
+  chomp $line;
+  my $timestring = localtime($line);
+  print "$timestring\n";
+  }
\ No newline at end of file
--- a/williamr/find_public_apis.pl	Mon Jun 01 15:26:59 2009 +0100
+++ b/williamr/find_public_apis.pl	Wed Jun 03 18:33:51 2009 +0100
@@ -20,6 +20,9 @@
 use strict;
 my $debug = 0;
 
+my @public_included = ();
+my $reason;
+
 sub is_public_api($$)
   {
   my ($file,$name) = @_;
@@ -27,34 +30,70 @@
   if ($name =~ /^epoc32\/include\/platform\//)
     {
     # /epoc32/include/platform files are "Platform by export"
+    $reason = "Platform by export";
     return 0; # Not public
     }
   
+  if ($name =~ /\./ && $name !~ /\.(h|rh|hrh|inl|c|hpp)$/i)
+    {
+    # Not a file which contains APIs anyway
+    $reason = "Wrong extension";
+    return 0; # not public
+    }
+
   open FILE, "<$file" or print "ERROR: Cannot open $file: $!\n" and return 1; # assume Public
   my @lines = <FILE>; # they are all of a modest size
   close FILE;
   
+  my @includelines = grep /^\s*#include\s+/, @lines;
+  my @includefiles = ();
+  foreach my $includeline (@includelines)
+    {
+    if ($includeline =~ /^\s*#include\s+["<](.*\.([^.]+))[">]/)
+      {
+      my $filename = $1;
+      my $extension = $2;
+      
+      # print "++ $filename ($extension)\n";
+      if ($extension =~ /mbg|rsg|rls|ra/i)
+        {
+        # generated file referenced by #include
+        push @includefiles, $filename; 
+        print STDERR "** $file - $includeline";
+        }
+      }
+    }
+  
   my @apitaglines = grep /\@published|\@internal/, @lines;
   if (scalar @apitaglines == 0)
     {
     # no API classification tags - must be "Public by export" 
-    return 1; # Public API
-    }
-  
-  if ($debug)
-    {
-    print join("\n\t", $file, @apitaglines), "\n";
+    $reason = "Public by export";
     }
-  my @publishedAll = grep /\@publishedAll/, @apitaglines;
-  if (scalar @publishedAll == 0)
+  else
     {
-    # the API classification tags are all @publishedPartner or @internal
-    return 0; # not public
+    if ($debug)
+      {
+      print join("\n\t", $file, @apitaglines), "\n";
+      }
+    my @publishedAll = grep /\@publishedAll/, @apitaglines;
+    if (scalar @publishedAll == 0)
+      {
+      # the API classification tags are all @publishedPartner or @internal
+      $reason = "Platform by tag";
+      return 0; # not public
+      }
+    # contains at least one @publishedAll element - must be "Public by tag"
+    $reason = "Public by tag";
     }
-  # contains at least one @publishedAll element - must be "Public by tag"
+  push @public_included, @includefiles;   # #included files are therefore also public
   return 1; # Public API
   }
 
+my %classification;
+my %origin;
+my %ignoring_case;
+
 sub scan_directory($$)
   {
   my ($path, $name) = @_;
@@ -76,13 +115,50 @@
     
     if (is_public_api($newpath,$newname))
       {
-      print "$newname\n";
+      # print "PUBLIC\t$newname\t$reason\n";
       }
     else
       {
-      # print "PARTNER\t$newname\n";
+      # print "PARTNER\t$newname\t$reason\n";
+      }
+    $classification{$newname} = $reason;
+    $origin{$newname} = "Symbian^2";
+    $ignoring_case{lc $newname} = $newname;
+    }
+  }
+
+scan_directory("/epoc32/include", "epoc32/include");
+
+foreach my $file (@public_included)
+  {
+  # print "PUBLIC\tepoc32/include/$file\tIncluded\n";
+  my $newname = "epoc32/include/$file";
+  $newname = $ignoring_case{lc $newname};
+  $classification{$newname} = "Public by Inclusion";
+  }
+
+# Read list of Symbian^1 files
+my $line;
+while ($line = <>)
+  {
+  chomp $line;
+  $line =~ s/\\/\//g; # Unix separators please
+  if ($line =~ /(epoc32\/include\/.*)\s*$/)
+    {
+    my $name = $1;
+    $origin{$name} = "Symbian^1";
+    if (!defined $ignoring_case{lc $name})
+      {
+      $classification{$name} = "Deleted";
       }
     }
   }
 
-scan_directory("/epoc32/include", "epoc32/include");
+print "Filename\tClassification\tReason\tOrigin\n";
+foreach my $file (sort keys %classification)
+  {
+  my $reason = $classification{$file};
+  my $type = "Platform";
+  $type = "Public" if ($reason =~ /Public/);
+  print "$file\t$type\t$reason\t$origin{$file}\n";
+  }
\ No newline at end of file
--- a/williamr/sbs_findstr.pl	Mon Jun 01 15:26:59 2009 +0100
+++ b/williamr/sbs_findstr.pl	Wed Jun 03 18:33:51 2009 +0100
@@ -20,6 +20,8 @@
 my $line;
 my $skipping = 1;
 
+@ARGV = map {glob} @ARGV;
+
 while ($line =<>)
   {
   if (substr($line,0,9) eq "</recipe>")