changeset 116:e45b8d57b9e8

tweak context.pm
author anatofuz
date Mon, 02 Dec 2019 12:19:50 +0900
parents 83aadf17d3d0
children ceabe608b773
files src/file.h src/gearsTools/lib/Gears/Context.pm
diffstat 2 files changed, 34 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/file.h	Mon Dec 02 11:45:48 2019 +0900
+++ b/src/file.h	Mon Dec 02 12:19:50 2019 +0900
@@ -1,3 +1,12 @@
+typedef struct file {
+    enum { FD_NONE, FD_PIPE, FD_INODE } type;
+    int          ref;   // reference count
+    char         readable;
+    char         writable;
+    struct pipe  *pipe;
+    struct inode *ip;
+    uint         off;
+} file;
 // in-memory copy of an inode
 struct inode {
     uint    dev;        // Device number
--- a/src/gearsTools/lib/Gears/Context.pm	Mon Dec 02 11:45:48 2019 +0900
+++ b/src/gearsTools/lib/Gears/Context.pm	Mon Dec 02 12:19:50 2019 +0900
@@ -58,7 +58,22 @@
           next;
        }
 
-       if ($line =~ /ALLOCATE_(?:PTR_)?ARRAY\(context,\s*(\w+),[\s\w]+\)/) {
+    #Element* element = &ALLOCATE(cbc_context, Element)->Element;
+       if ($line =~ /ALLOCATE\w*\((?:cbc_)?context,\s*(\w+)\)/) {
+          my $implementation = $1;
+          $counter{impl}->{$implementation}++;
+          $self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}++;
+          next;
+       }
+
+       if ($line =~ /ALLOCATE_(?:PTR_)?ARRAY\((?:cbc_)?context,\s*(\w+),[\s\w]+\)/) {
+          my $implementation = $1;
+          $counter{impl}->{$implementation}++;
+          $self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}++;
+          next;
+       }
+
+       if ($line =~ /new\s+(\w+?)\([\w\s]*\);/) {
           my $implementation = $1;
           $counter{impl}->{$implementation}++;
           $self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}++;
@@ -192,14 +207,15 @@
 
   my $header_paths = Gears::Util->find_headers_path($search_bash_path);
   map {
-    /(\w+)\.h/;
-    my $header_file = $1;
-    if (exists $res{$header_file}) {
-      if ($res{$header_file} =~ /^\d+$/){
-        $res{$header_file} = $_;
-      } elsif (($_ =~ /\.dg$/) && ($res{$header_file} =~ /\.h$/)) {
-        $res{$header_file} = $_;
-      }
+    if (/(\w+)\.h/) {
+        my $header_file = $1;
+        if (exists $res{$header_file}) {
+          if ($res{$header_file} =~ /^\d+$/){
+            $res{$header_file} = $_;
+          } elsif (($_ =~ /\.dg$/) && ($res{$header_file} =~ /\.h$/)) {
+            $res{$header_file} = $_;
+          }
+        }
     }
   } sort @$header_paths;
   return \%res;