LJ Archive

Constants Module

module m_ConstantsOnly
  integer, public, parameter :: TENNIS  = 1
  integer, public, parameter :: SWIM    = 2
  integer, public, parameter :: SAUNA   = 3
  integer, public, parameter :: HOT_TUB = 4
  integer, public, parameter :: &
   NUMBER_OF_ACTIVITIES = 4
  integer, public, parameter :: &
   MAX_MONTHLY_ACTIVITIES = 60
endmodule m_ConstantsOnly

Global Variables Module

module m_GlobalVariables
 use m_ConstantsOnly, only: MAX_MONTHLY_ACTIVITIES
 private ! makes sure not to export entities
    ! from m_ConstantsOnly

 integer, public, &
   dimension(MAX_MONTHLY_ACTIVITIES) :: &
   activities_list
 integer, public :: number_of_monthly_activities
endmodule m_GlobalVariables

Types and Procedures Module

module m_types_and_procs
 ! public procedures
 public :: SetActivity, GetActivity
 ! private procedures
 private :: SetStartTime, SetEndTime

 type, private :: t_act_schedule ! This type is
         ! private to this module

           ! yyyymmddhhmmss
  character(len=14) :: start_day_time
  integer :: duration_in_seconds
 endtype t_act_schedule

 type, public :: t_agenda ! This type is available
           ! to users of this module
  private ! The inside parts of this type are
     ! private to this module
   integer :: activity
   type(t_act_schedule) :: act_schedule
 endtype t_agenda

contains ! separates the data entities from the
    ! procedures
 subroutine SetActivity(an_activity)
  integer, intent(in) :: an_activity
  ! ...
 endsubroutine SetActivity

 function GetActivity() result(an_activity)
  ! ...
 subroutine SetStartTime()
  ! ...
 subroutine SetEndTime()
  ! ...
endmodule m_types_and_procs
LJ Archive