next up previous contents index
Next: Language Definition Up: Initializing SIC: Languages and Previous: Initializing SIC: Languages and   Contents   Index

Packages

A main program using SIC is reduced to practically nothing: For example, the main program of Mapping is
program mapping
  !----------------------------------------------------------------------
  ! Main astro program
  !----------------------------------------------------------------------
  external :: mapping_pack_set
  !
  call gmaster_run(mapping_pack_set)
  !
end program mapping
All 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_set
pack 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


next up previous contents index
Next: Language Definition Up: Initializing SIC: Languages and Previous: Initializing SIC: Languages and   Contents   Index
Gildas manager 2024-04-16