[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Pkg-octave-devel] inline-octave-perl "whos" patch



inline-octave-perl 0.21-2 currently contains a patch which alters the format of the output of the octave "whos" function in sub get_defined_functions of Octave.pm. I assume this was done to improve the matching of the regex 3 lines later. In the new upstream source 0.22 this portion of the code is implemented using the octave "who" [w/o long output]. This seems functional to me but I don't know the original intent of the patch. Do we still need this section of the patch. I've attached the relevant section of the 0.21/0.22 upstream source diff and the current patch.

0.21/0.22 diff

@@ -430,11 +448,21 @@
sub get_defined_functions
{
   my $o = shift;
-   my $data= $o->interpret("whos('-functions')");
+   my $data= $o->interpret("who('-functions')");
   my @funclist;
-   while ( $data =~ /user(-defined|) function +- +- +(\w+)/g )
+   $compiled_fns_marker= 0;
+   while ( $data =~ /(.+)/g )
   {
-      push @funclist, $2;
+      my $line = $1;
+      if(       $line =~ /^\*\*\* .* compiled functions/ ) {
+         $compiled_fns_marker = 1;
+      } elsif ( $line =~ /^\*\*\* / ) {
+         $compiled_fns_marker = 0 ;
+      } elsif ( $line =~ /^[\w\s]+$/ && $compiled_fns_marker ) {
+ while( $line =~ /(\w+)/g ) { + push @funclist, $1;
+         }
+      }
   }
   return @funclist;


50_control-output-of-whos.dpatch

@@ -430,11 +430,12 @@
sub get_defined_functions
{
   my $o = shift;
+   $o->interpret('whos_line_format ="%ln:50;%rt:50;\n";');
   my $data= $o->interpret("whos('-functions')");
   my @funclist;
-   while ( $data =~ /user(-defined|) function +- +- +(\w+)/g )
+   while ( $data =~ /(\w+)\s+user(-defined|) function/g )
   {
-      push @funclist, $2;
+      push @funclist, $1;
   }
   return @funclist;



Reply to: