program mapping !---------------------------------------------------------------------- ! Main astro program !---------------------------------------------------------------------- external :: mapping_pack_set ! call gmaster_run(mapping_pack_set) ! end program mappingAll the job is done by gmaster_run which declares Mapping as the master program, and calls its package setup routine mapping_pack_set.
This package setup routine named name_pack_set, where name is the package name, contains e.g. for MAPPING
subroutine mapping_pack_set(pack) use gpack_def ! type(gpack_info_t), intent(out) :: pack ! external :: greg_pack_set external :: mapping_pack_init external :: mapping_pack_on_exit ! pack%name='mapping' pack%ext = '.map' pack%depend(1:1) = (/ locwrd(greg_pack_set) /) pack%init=locwrd(mapping_pack_init) pack%on_exit=locwrd(mapping_pack_on_exit) pack%authors="J.Pety, N.Rodriguez-Fernandez, S.Guilloteau, F.Gueth" ! end subroutine mapping_pack_setpack is here a Fortran derived-type variable, with the following elements
The initialisation routine referred to by pack%init must setup all the package languages, and execute any code require to provide the initial setup of the package. In addition, it is recommended to setup the messaging facility: in the example below this is done using name_message_set_id.
subroutine mapping_pack_init(gpack_id,error) use sic_def !---------------------------------------------------------------------- ! !---------------------------------------------------------------------- integer :: gpack_id logical :: error ! ! Local language call init_clean ! ! One time initialization call map_message_set_id(gpack_id) ! Set library id ! ! Language priorities call exec_program('SIC'//backslash//'SIC PRIORITY 1 CLEAN') ! ! Specific initializations ! end subroutine mapping_pack_init