Change the json_value variable to a logical.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | intent(inout) | :: | p | |||
logical(kind=LK), | intent(in), | optional | :: | val | if the value is also to be set (if not present, then .false. is used). |
|
character(kind=CK,len=*), | intent(in), | optional | :: | name | if the name is also to be changed. |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
subroutine to_logical(p,val,name)
implicit none
type(json_value),intent(inout) :: p
logical(LK),intent(in),optional :: val !! if the value is also to be set
!! (if not present, then .false. is used).
character(kind=CK,len=*),intent(in),optional :: name !! if the name is also to be changed.
!set type and value:
call destroy_json_data(p)
p%var_type = json_logical
allocate(p%log_value)
if (present(val)) then
p%log_value = val
else
p%log_value = .false. !default value
end if
!name:
if (present(name)) p%name = trim(name)
end subroutine to_logical