D.1.3 Valid_State_Trace Procedure

The main documentation of the Valid_State_Trace Procedure contains additional explanation of this code listing.

  function Valid_State_Trace (Trace) result(Valid)

    ! Input variables.

    ! Variable to be checked.
    type(Trace_type), intent(in) :: Trace 

    ! Output variables.

    type(logical) :: Valid  ! Logical state.


    ! Start out true.

    Valid = .true.

    ! Check for association of pointered internals.

    Valid = Valid .and. ASSOCIATED(Trace%Initialized)
      Valid = Valid .and. ASSOCIATED(Trace%Trace)
    if (.not.Valid) return

    ! Check for validity of internals.

    select case (Trace%Dimensionality)
    case (1)
      Valid = Valid .and. Valid_State(Trace%Index1)
      Valid = Valid .and. Valid_State(Trace%Mask1)
    case (2)                        
      Valid = Valid .and. Valid_State(Trace%Index2)
      Valid = Valid .and. Valid_State(Trace%Mask2)
    end select
    if (.not.Valid) return

    ! Checks on the validity of Index.

    ! <none so far>

  end function Valid_State_Trace

Michael L. Hall