<commit_before>-----------------------------------------------------------------------
--  mat-frames-targets - Representation of stack frames
--  Copyright (C) 2015 <NAME>
--  Written by <NAME> (<EMAIL>)
--
--  Licensed under the Apache License, Version 2.0 (the "License");
--  you may not use this file except in compliance with the License.
--  You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
--  Unless required by applicable law or agreed to in writing, software
--  distributed under the License is distributed on an "AS IS" BASIS,
--  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--  See the License for the specific language governing permissions and
--  limitations under the License.
-----------------------------------------------------------------------

package body MAT.Frames.Targets is

   --  ------------------------------
   --  Insert in the frame tree the new stack frame represented by <tt>Pc</tt>.
   --  If the frame is already known, the frame reference counter is incremented.
   --  The frame represented by <tt>Pc</tt> is returned in <tt>Result</tt>.
   --  ------------------------------
   procedure Insert (Frame  : in out Target_Frames;
                     Pc     : in Frame_Table;
                     Result : out Frame_Type) is
   begin
      Frame.Frames.Insert (Pc, Result);
   end Insert;

   --  ------------------------------
   --  Get the number of different stack frames which have been registered.
   --  ------------------------------
   function Get_Frame_Count (Frame : in Target_Frames) return Natural is
   begin
      return Frame.Frames.Get_Frame_Count;
   end Get_Frame_Count;

   protected body Frames_Type is

      --  ------------------------------
      --  Get the number of different stack frames which have been registered.
      --  ------------------------------
      function Get_Frame_Count return Natural is
      begin
         return Root.Used;
      end Get_Frame_Count;

      --  ------------------------------
      --  Insert in the frame tree the new stack frame represented by <tt>Pc</tt>.
      --  If the frame is already known, the frame reference counter is incremented.
      --  The frame represented by <tt>Pc</tt> is returned in <tt>Result</tt>.
      --  ------------------------------
      procedure Insert (Pc     : in Frame_Table;
                        Result : out Frame_Type) is
      begin
         MAT.Frames.Insert (Root, Pc, Result);
      end Insert;

      --  ------------------------------
      --  Clear and destroy all the frame instances.
      --  ------------------------------
      procedure Clear is
      begin
         Destroy (Root);
      end Clear;

   end Frames_Type;

   --  ------------------------------<commit_msg>Fix Get_Frame_Count to return the number of different stack frames<commit_after>-----------------------------------------------------------------------
--  mat-frames-targets - Representation of stack frames
--  Copyright (C) 2015, 2021 <NAME>
--  Written by <NAME> (<EMAIL>)
--
--  Licensed under the Apache License, Version 2.0 (the "License");
--  you may not use this file except in compliance with the License.
--  You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
--  Unless required by applicable law or agreed to in writing, software
--  distributed under the License is distributed on an "AS IS" BASIS,
--  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--  See the License for the specific language governing permissions and
--  limitations under the License.
-----------------------------------------------------------------------

package body MAT.Frames.Targets is

   --  ------------------------------
   --  Insert in the frame tree the new stack frame represented by <tt>Pc</tt>.
   --  If the frame is already known, the frame reference counter is incremented.
   --  The frame represented by <tt>Pc</tt> is returned in <tt>Result</tt>.
   --  ------------------------------
   procedure Insert (Frame  : in out Target_Frames;
                     Pc     : in Frame_Table;
                     Result : out Frame_Type) is
   begin
      Frame.Frames.Insert (Pc, Result);
   end Insert;

   --  ------------------------------
   --  Get the number of different stack frames which have been registered.
   --  ------------------------------
   function Get_Frame_Count (Frame : in Target_Frames) return Natural is
   begin
      return Frame.Frames.Get_Frame_Count;
   end Get_Frame_Count;

   protected body Frames_Type is

      --  ------------------------------
      --  Get the number of different stack frames which have been registered.
      --  ------------------------------
      function Get_Frame_Count return Natural is
      begin
         return Count_Children (Root, True);
      end Get_Frame_Count;

      --  ------------------------------
      --  Insert in the frame tree the new stack frame represented by <tt>Pc</tt>.
      --  If the frame is already known, the frame reference counter is incremented.
      --  The frame represented by <tt>Pc</tt> is returned in <tt>Result</tt>.
      --  ------------------------------
      procedure Insert (Pc     : in Frame_Table;
                        Result : out Frame_Type) is
      begin
         MAT.Frames.Insert (Root, Pc, Result);
      end Insert;

      --  ------------------------------
      --  Clear and destroy all the frame instances.
      --  ------------------------------
      procedure Clear is
      begin
         Destroy (Root);
      end Clear;

   end Frames_Type;

   --  ------------------------------
{'fraction_non_alphanumeric': 0.23443801507978257, 'fraction_numerical': 0.003506926179203928, 'mean_word_length': 1.3130575831305757, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5884282', 'n_tokens_mistral': 1372, 'n_tokens_neox': 1315, 'n_words': 538}