Sage-ST ä

Binlib

Documentation

Global Declarations (Constants, Types, Variables)
BinaryDelete BinaryDeleteA BinaryInsert
BinaryInsertA BinaryLocate BinaryLocateHandle BinarySearch
BinarySearchA





  type CompareProcType is access
  function (r1 : in     ModSys.S_Natural) return ModSys.S_Integer;

  pragma Convention
          (WIN32,
           CompareProcType);

  type HandleCompareProcType is access
  function (handle : in     System.Address;
            RecNum : in     ModSys.S_Natural) return ModSys.S_Integer;

  pragma Convention
          (WIN32,
           HandleCompareProcType);




  procedure BinaryDelete
             (Keys          : in     ModSys.Byte_U_Array;
              Num_Keys      : in out ModSys.S_Natural;
              Location      : in     ModSys.S_Natural;
              Record_Length : in     ModSys.S_Natural);

  --*
  --  BinaryDelete - Delete record from a binary list.
  --
  --
  --  This routine deletes a record from a sorted list of records.  The user
  --  must specify the record number of the record to be deleted.  The
  --  routine deletes the record from the list, returns the user an updated
  --  record array and decrements the number of records by one to account
  --  for the deleted record.
  --
  --  CALLING SEQUENCE -
  --
  --    BinaryDelete (Keys, Num_Keys, Location, Record_Length)
  --
  --  ENTRY -
  --
  --    Keys : ModSys.byte_u_array
  --      An array of characters containing the records.
  --
  --    Num_Keys : ModSys.S_Natural
  --      The number of records in the array 'Keys'.
  --
  --    Location : ModSys.S_Natural
  --      The record number of the record to be deleted.
  --
  --    Record_Length : ModSys.S_Natural
  --      The number of bytes in each record.
  --
  --  EXIT -
  --
  --    Keys : ModSys.byte_u_array
  --      An updated record array is returned w/the specified record deleted.
  --
  --    Num_Keys : ModSys.S_Natural
  --      Number of records in array 'Keys' is decremented by one to account
  --      for this record.
  --




  procedure BinaryDeleteA
             (Keys          : in     System.Address;
              Num_Keys      : in out ModSys.S_Natural;
              Location      : in     ModSys.S_Natural;
              Record_Length : in     ModSys.S_Natural);

  --*
  --  BinaryDeleteA - Delete a record from a binary list.
  --
  --
  --  This routine deletes a record from a sorted list of records.
  --  The user must specify the record number of the record to be
  --  deleted.  The routine deletes the record from the list and
  --  returns the user an updated record array and decrements the
  --  number of records by one to account for the deleted record.
  --
  --  CALLING SEQUENCE -
  --
  --    BinaryDeleteA (Keys, Num_Keys, Location, Record_Length)
  --
  --  ENTRY -
  --
  --    Keys : System.Address
  --      Address of an array of characters containing the records.
  --
  --    Num_Keys : ModSys.S_Natural
  --      The number of records in the array 'Keys'.
  --
  --    Location : ModSys.S_Natural
  --      The record number of the record to be deleted.
  --
  --    Record_Length : ModSys.S_Natural
  --      The number of bytes in each record.
  --
  --  EXIT -
  --
  --    Keys : System.Address
  --      An updated record array is returned w/the specified record deleted.
  --
  --    Num_Keys : ModSys.S_Natural
  --      Number of records in array 'Keys' is decremented by one to account
  --      for this record.
  --




  procedure BinaryInsert
             (Keys          : in     ModSys.Byte_U_Array;
              Key_To_Add    : in     ModSys.Byte_U_Array;
              Num_Keys      : in out ModSys.S_Natural;
              Location      : in     ModSys.S_Natural;
              Record_Length : in     ModSys.S_Natural);

  --*
  --  BinaryInsert - Insert a record in a binary list.
  --
  --
  --  This routine adds a record to a set of sorted records.
  --  The user must specify the record position where the record
  --  to be inserted belongs.  This information is returned from
  --  the BinarySearch routine.  The record array is updated to
  --  include the specified record and the number of records
  --  is updated.
  --
  --  CALLING SEQUENCE -
  --
  --    BinaryInsert (Keys, Key_To_Add, Num_Keys, Location, Record_Length)
  --
  --  ENTRY -
  --
  --    Keys : ModSys.byte_u_array
  --      An array of characters containing the records.
  --
  --    Key_To_Add : ModSys.byte_u_array
  --      The record to be added to the list of records.
  --
  --    Num_Keys : ModSys.S_Natural
  --      The number of records in the array 'Keys'.
  --
  --    Location : ModSys.S_Natural
  --      The record number where the record is to be inserted.
  --
  --    Record_Length : ModSys.S_Natural
  --      The number of bytes in each record.
  --
  --  EXIT -
  --
  --    Keys : ModSys.byte_u_array
  --      An updated record array is returned w/the specified record inserted.
  --
  --    Num_Keys : ModSys.S_Natural
  --      Number of records in array 'Keys' is incremented by one to include
  --      this record.
  --




  procedure BinaryInsertA
             (Keys          : in     System.Address;
              Key_To_Add    : in     System.Address;
              Num_Keys      : in out ModSys.S_Natural;
              Location      : in     ModSys.S_Natural;
              Record_Length : in     ModSys.S_Natural);

  --*
  --  BinaryInsertA - Insert a record in a binary list.
  --
  --
  --  This routine adds a record to a set of sorted records.  The
  --  user must specify the record position where the record to be
  --  inserted belongs.  This information is returned from the
  --  BinarySearch routine.  The record array is updated to include
  --  the specified record and the number of records is updated.
  --
  --  CALLING SEQUENCE -
  --
  --    BinaryInsertA (Keys, Key_To_Add, Num_Keys, Location, Record_Length)
  --
  --  ENTRY -
  --
  --    Keys : System.Address
  --      Address of an array of characters containing the records.
  --
  --    Key_To_Add : System.Address
  --      Address of the record to be added to the list of records.
  --
  --    Num_Keys : ModSys.S_Natural
  --      The number of records in the array 'Keys'.
  --
  --    Location : ModSys.S_Natural
  --      The record number where the record is to be inserted.
  --
  --    Record_Length : ModSys.S_Natural
  --      The number of bytes in each record.
  --
  --  EXIT -
  --
  --    Keys : System.Address
  --      An updated record array is returned w/the specified record inserted.
  --
  --    Num_Keys : ModSys.S_Natural
  --      Number of records in array 'Keys' is incremented by one to include
  --      this record.
  --




  function BinaryLocate
            (number_Of_Keys : in     ModSys.S_Natural;
             CompareProc    : in     CompareProcType) return ModSys.S_Integer;

  --*
  --  BinaryLocate - Perform a binary locate on user records.
  --
  --  This procedure must be used with a Compare function having the
  --  following format
  --
  --    function Compare (r1 : in     Modsys.S_Natural) return ModSys.S_Integer;
  --




  function BinaryLocateHandle
            (handle       : in     System.Address;
             NumberOfKeys : in     ModSys.S_Natural;
             CompareProc  : in     HandleCompareProcType) return ModSys.S_Integer;

  --*
  --  BinaryLocateHandle - Perform a binary locate on user records in a handle.
  --
  --  This procedure must be instantiated with a Compare function having the
  --  following format
  --
  --    function Compare (Handle       : in     System.Address,
  --                      NumberOfKeys : in     ModSys.S_Natural) return ModSys.S_Integer;
  --




  function BinarySearch
            (Keys          : in     ModSys.Byte_U_Array;
             Key_To_Find   : in     ModSys.Byte_U_Array;
             Num_Keys      : in     ModSys.S_Natural;
             Key_Start     : in     ModSys.S_Natural;
             Key_Length    : in     ModSys.S_Natural;
             Record_Length : in     ModSys.S_Natural) return ModSys.S_Integer;

  --*
  --  BinarySearch - Perform a binary search on a sorted list.
  --
  --
  --  This routine performs a binary search on an array of sorted
  --  records.  The records may be any length but must be sorted
  --  by a key which is the first element of the record.  The key may
  --  have a maximum of 64 characters and must be the same size
  --  for each record in the array.  This routine returns the
  --  record number of the first record in the array which matches
  --  the specified key.  If the key is not found then the negative
  --  of the record position to insert the key is returned.
  --
  --  CALLING SEQUENCE -
  --
  --    I := BinarySearch (Keys, Key_To_Find, Num_Keys, Key_Start,
  --                       Key_Length, Record_Length)
  --
  --  ENTRY -
  --
  --    Keys : ModSys.byte_u_array
  --      An array of characters containing the records to search.
  --
  --    Key_To_Find : ModSys.byte_u_array
  --      The key of the record to find.
  --
  --    Num_Keys : ModSys.S_Natural
  --      The number of records in the array 'Keys'.
  --
  --    Key_Start : ModSys.S_Natural
  --      The start character in the record of the key.
  --
  --    Key_Length : ModSys.S_Natural
  --      The number of bytes in the key.  Maximum value is 64.
  --
  --    Record_Length : ModSys.S_Natural
  --      The number of bytes in each record.
  --
  --  EXIT -
  --
  --    I : ModSys.S_Integer
  --      If 'I' is greater than zero, it represents the record number of the
  --      record with the specified key if less than zero, it represents the
  --      record number where the specified key would be if it were inserted.
  --




  function BinarySearchA
            (Keys          : in     System.Address;
             Key_To_Find   : in     System.Address;
             Num_Keys      : in     ModSys.S_Natural;
             Key_Start     : in     ModSys.S_Natural;
             Key_Length    : in     ModSys.S_Natural;
             Record_Length : in     ModSys.S_Natural) return ModSys.S_Integer;

  --*
  --  BinarySearchA - Perform a binary search on a address of bytes.
  --
  --
  --  This routine performs a binary search on an array of sorted
  --  records.  The records may be any length but must be sorted by
  --  a key which is the first element of the record.  The key may have a
  --  maximum of 64 characters long and must be the same size for
  --  each record in the array.  This routine returns the record
  --  number of the first record in the array which matches the
  --  specified key.  If the key is not found then the negative of
  --  the record position to insert the key is returned.  This
  --  procedure uses an ASCII character comparison.  For other types
  --  of comparisons, use the 'BinaryLocate' or 'BinaryLocateLong'
  --  procedures instantiated with your own compare procedure.
  --
  --  CALLING SEQUENCE -
  --
  --    I := BinarySearchA (Keys, Key_To_Find, Num_Keys, Key_Start, Key_Length,
  --                        Record_Length)
  --
  --  ENTRY -
  --
  --    Keys : System.Address
  --      The address of the array of records to search.
  --
  --    Key_To_Find : System.Address
  --      The address of the key of the record to find.
  --
  --    Num_Keys : ModSys.S_Natural
  --      The number of records in the array 'Keys'.
  --
  --    Key_Start : ModSys.S_Natural
  --      The start character in the record of the key (1..n).
  --
  --    Key_Length : ModSys.S_Natural
  --      The number of bytes in the key.  Maximum value is 64.
  --
  --    Record_Length : ModSys.S_Natural
  --      The number of bytes in each record.
  --
  --  EXIT -
  --
  --    I : ModSys.S_Integer
  --      If 'I' is greater than zero, it represents the record number of the
  --      record with the specified key; if less than zero, it represents the
  --      record number where the specified key would be if it were inserted.
  --




Send mail to   warren.merrill@inl.gov with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance