subroutinecall_textprivate
subroutine call_text(list, name, id, has_result, b)
Write how a call of a form looks. Square brackets mark what is optional.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| list | type(entity_list_t) | in | the entities | |
| name | character(len=*) | in | the generic | |
| id | integer | in | a procedure of the form | |
| has_result | logical | in | true for a function | |
| b | type(buffer_t) | inout | the HTML |
Calls
Source
Show the code
subroutine call_text(list, name, id, has_result, b)
type(entity_list_t), intent(in) :: list !! the entities
character(len=*), intent(in) :: name !! the generic
integer, intent(in) :: id !! a procedure of the form
logical, intent(in) :: has_result !! true for a function
type(buffer_t), intent(inout) :: b !! the HTML
character(len=:), allocatable :: low, symbol, left, right
integer :: k, n
associate (e => list%box(id)%e)
n = size(e%more%arg_ids)
low = lowercase(name)
if (index(low, 'operator(') == 1 .and. n >= 1 .and. n <= 2) then
symbol = name(10:len(name) - 1)
call argument_name(list, e%more%arg_ids(1), left)
call add(b, 'result = ')
if (n == 1) then
call html_escape(symbol//' '//left, b, .false.)
else
call argument_name(list, e%more%arg_ids(2), right)
call html_escape(left//' '//symbol//' '//right, b, .false.)
end if
return
end if
if (index(low, 'assignment(') == 1 .and. n == 2) then
call argument_name(list, e%more%arg_ids(1), left)
call argument_name(list, e%more%arg_ids(2), right)
call html_escape(left//' = '//right, b, .false.)
return
end if
if (has_result) then
call add(b, 'result = ')
else
call add(b, 'call ')
end if
call html_escape(name, b, .false.)
call add(b, '(')
do k = 1, n
call argument_name(list, e%more%arg_ids(k), left)
if (e%more%arg_ids(k) > 0) then
if (list%box(e%more%arg_ids(k))%e%optional) then
if (k > 1) call add(b, ' ')
call add(b, '[')
if (k > 1) call add(b, ', ')
call html_escape(left, b, .false.)
call add(b, ']')
cycle
end if
end if
if (k > 1) call add(b, ', ')
call html_escape(left, b, .false.)
end do
call add(b, ')')
end associate
end subroutine call_text