subroutineread_commonprivate
subroutine read_common(list, unit, line, doc, s)
Read a common statement, adding a common block entity for each block it names.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| list | type(entity_list_t) | inout | the entities | |
| unit | integer | in | the entity it is in | |
| line | character(len=*) | in | the statement | |
| doc | type(doc_lines_t) | in | the statement's documentation | |
| s | type(settings_t) | in | the settings |
Calls
Source
Show the code
subroutine read_common(list, unit, line, doc, s)
type(entity_list_t), intent(inout) :: list !! the entities
integer, intent(in) :: unit !! the entity it is in
character(len=*), intent(in) :: line !! the statement
type(doc_lines_t), intent(in) :: doc !! the statement's documentation
type(settings_t), intent(in) :: s !! the settings
character(len=:), allocatable :: rest, name
integer :: a, b, next, id
rest = strip(line(7:))
do while (len(rest) > 0)
name = ''
if (rest(1:1) == '/') then
b = index(rest(2:), '/') + 1
name = strip(rest(2:b - 1))
rest = strip(rest(b + 1:))
end if
next = top_index(rest, '/')
a = merge(next - 1, len(rest), next > 0)
if (is_procedure(list%box(unit)%e%kind)) list%box(unit)%e%more%common_block = .true.
id = list%add(E_COMMON, unit)
associate (c => list%box(id)%e)
c%name = name
c%permission = 'public'
c%more%args = top_split(rest(:a), ',')
allocate (c%attribs(0))
if (allocated(doc%lines)) then
call set_doc(c, s, doc%lines)
else
call set_doc(c, s, [string_t ::])
end if
end associate
rest = strip(rest(a + 1:))
end do
end subroutine read_common