<commit_before>#!/usr/bin/perl
#
#   (c) Copyright 2000-2002  convergence integrated media GmbH.
#   (c) Copyright 2002       convergence GmbH.
#
#   All rights reserved.
#
#   Written by <NAME> <<EMAIL>>,
#              <NAME> <<EMAIL>> and
#              <NAME> <<EMAIL>>.
#
#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU Lesser General Public
#   License as published by the Free Software Foundation; either
#   version 2 of the License, or (at your option) any later version.
#
#   This library is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   Lesser General Public License for more details.
#
#   You should have received a copy of the GNU Lesser General Public
#   License along with this library; if not, write to the
#   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
#   Boston, MA 02111-1307, USA.
#

################################################################
#                                                              #
#  Documentation generator (early stage of implementation)     #
#                                                              #
#  - Reads header from stdin                                   #
#  - Writes HTML to several files                              #
#                                                              #
################################################################


html_create( INDEX, "index.html", "DirectFB Interfaces" );
html_create( TYPES, "types.html", "DirectFB Types" );

print INDEX "<P>\n",
            "  <CENTER><TABLE width=90% border=0 cellpadding=2>\n";

while (<>) {
   chomp;

   if ( /^\s*\/\*\s*$/ ) {
      %options = ();
      $comment = "";

      while (<>) {
         chomp;

         last if ( /^\s*\*\/\s*$/ );

         if (/^\s*\*\s*(.*)$/) {
            $line = $1;

            if ($line eq "" && $comment ne "") {
               $comment .= "    <br><br>\n";
            }
            elsif ($line =~ /^@(\w+)\s*=?\s*(.*)$/) {
               $options{$1} = $2;
            }
            else {
               $comment .= "      $line\n";
            }
         }
      }

      substitute_method_links (\$comment);
   }
   elsif ( /^\s*DECLARE_INTERFACE\s*\(\s*(\w+)\s\)\s*$/ ) {
      $interface_abstracts{$1} = $comment;

      print INDEX "    <TR><TD valign=top>\n",
                  "      <A href=\"$1.html\">$1</A>\n",
                  "    </TD><TD valign=top>\n",
                  "      $comment\n",
                  "    </TD></TR>\n";
   }
   elsif ( /^\s*DEFINE_INTERFACE\s*\(\s*(\w+),\s*$/ ) {
      parse_interface( $1 );
   }
   elsif ( /^\s*typedef\s+enum\s*\{?\s*$/ ) {
      parse_enum();
   }
   elsif ( /^\s*typedef\s+(struct|union)\s*\{?\s*$/ ) {
      parse_struct();
   }
   elsif ( /^\s*typedef\s+(\w+)\s+\(\*(\w+)\)\s*\(\s*$/ ) {
      parse_func( $1, $2 );
   }
   elsif ( /^\s*#define\s+([^\(\s]+)\s*(\([^\)]*\))?/ ) {
      $macro  = $1;
      $params = $2;

      chomp $params;

      if ($comment ne "" && !defined ($options{"internal"})) {
         parse_macro( $macro, $params );
      }
   }
   else {
      $comment = "";
   }
}

print INDEX "  </CENTER></TABLE>\n",
            "</P>\n";

html_close( INDEX );
html_close( TYPES );



sub substitute_method_links ($)
   {
      my $str = shift(@_);

      $$str =~ s/(I\w+)\:\:(\w+)\(\)/\<a\ href=\"\1\_\2\.html\"\>\1\:\:\2\(\)\<\/a\>/g;
   }

sub parse_comment ($$) {
   my ($head, $body) = @_;
   my $headline_mode = 1;

   $$head = "";
   $$body = "";


   while (<>)
      {
         chomp;
         last if /^\s*\*\/\s*$/;

         if ($headline_mode == 1)
            {
               if (/^\s*\*?\s*$/)
                  {
                     $headline_mode = 0;
                  }
               elsif (/^\s*\*?\s*(.+)$/)
                  {
                     $$head .= " $1";
                  }
            }
         else
            {
               if (/^\s*\*?\s*$/)
                  {
                     $$body .= " </P><P>";
                  }
               elsif (/^\s*\*?\s*(.+)$/)
                  {
                     $$body .= " $1";
                  }
            }
      }

   substitute_method_links ($head);
   substitute_method_links ($body);
}

sub parse_params () {
   my @entries;<commit_msg>Better style of using references.<commit_after>#!/usr/bin/perl
#
#   (c) Copyright 2000-2002  convergence integrated media GmbH.
#   (c) Copyright 2002       convergence GmbH.
#
#   All rights reserved.
#
#   Written by <NAME> <<EMAIL>>,
#              <NAME> <<EMAIL>> and
#              <NAME> <<EMAIL>>.
#
#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU Lesser General Public
#   License as published by the Free Software Foundation; either
#   version 2 of the License, or (at your option) any later version.
#
#   This library is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   Lesser General Public License for more details.
#
#   You should have received a copy of the GNU Lesser General Public
#   License along with this library; if not, write to the
#   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
#   Boston, MA 02111-1307, USA.
#

################################################################
#                                                              #
#  Documentation generator (early stage of implementation)     #
#                                                              #
#  - Reads header from stdin                                   #
#  - Writes HTML to several files                              #
#                                                              #
################################################################


html_create( INDEX, "index.html", "DirectFB Interfaces" );
html_create( TYPES, "types.html", "DirectFB Types" );

print INDEX "<P>\n",
            "  <CENTER><TABLE width=90% border=0 cellpadding=2>\n";

while (<>) {
   chomp;

   if ( /^\s*\/\*\s*$/ ) {
      %options = ();
      $comment = "";

      while (<>) {
         chomp;

         last if ( /^\s*\*\/\s*$/ );

         if (/^\s*\*\s*(.*)$/) {
            $line = $1;

            if ($line eq "" && $comment ne "") {
               $comment .= "    <br><br>\n";
            }
            elsif ($line =~ /^@(\w+)\s*=?\s*(.*)$/) {
               $options{$1} = $2;
            }
            else {
               $comment .= "      $line\n";
            }
         }
      }

      substitute_method_links (\$comment);
   }
   elsif ( /^\s*DECLARE_INTERFACE\s*\(\s*(\w+)\s\)\s*$/ ) {
      $interface_abstracts{$1} = $comment;

      print INDEX "    <TR><TD valign=top>\n",
                  "      <A href=\"$1.html\">$1</A>\n",
                  "    </TD><TD valign=top>\n",
                  "      $comment\n",
                  "    </TD></TR>\n";
   }
   elsif ( /^\s*DEFINE_INTERFACE\s*\(\s*(\w+),\s*$/ ) {
      parse_interface( $1 );
   }
   elsif ( /^\s*typedef\s+enum\s*\{?\s*$/ ) {
      parse_enum();
   }
   elsif ( /^\s*typedef\s+(struct|union)\s*\{?\s*$/ ) {
      parse_struct();
   }
   elsif ( /^\s*typedef\s+(\w+)\s+\(\*(\w+)\)\s*\(\s*$/ ) {
      parse_func( $1, $2 );
   }
   elsif ( /^\s*#define\s+([^\(\s]+)\s*(\([^\)]*\))?/ ) {
      $macro  = $1;
      $params = $2;

      chomp $params;

      if ($comment ne "" && !defined ($options{"internal"})) {
         parse_macro( $macro, $params );
      }
   }
   else {
      $comment = "";
   }
}

print INDEX "  </CENTER></TABLE>\n",
            "</P>\n";

html_close( INDEX );
html_close( TYPES );



sub substitute_method_links ($)
   {
      my $str = shift(@_);

      $$str =~ s/(I\w+)\:\:(\w+)\(\)/\<a\ href=\"\1\_\2\.html\"\>\1\:\:\2\(\)\<\/a\>/g;
   }

sub parse_comment ($$) {
   local (*head, *body) = @_;
   my $headline_mode = 1;

   $head = "";
   $body = "";


   while (<>)
      {
         chomp;
         last if /^\s*\*\/\s*$/;

         if ($headline_mode == 1)
            {
               if (/^\s*\*?\s*$/)
                  {
                     $headline_mode = 0;
                  }
               elsif (/^\s*\*?\s*(.+)$/)
                  {
                     $head .= " $1";
                  }
            }
         else
            {
               if (/^\s*\*?\s*$/)
                  {
                     $body .= " </P><P>";
                  }
               elsif (/^\s*\*?\s*(.+)$/)
                  {
                     $body .= " $1";
                  }
            }
      }

   substitute_method_links (\$head);
   substitute_method_links (\$body);
}

sub parse_params () {
   my @entries;
{'fraction_non_alphanumeric': 0.21208717142215233, 'fraction_numerical': 0.011458099303527296, 'mean_word_length': 1.3540454785827605, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2306500', 'n_tokens_mistral': 2940, 'n_tokens_neox': 2737, 'n_words': 625}