functionnew_exprprivate
integer function new_expr(c, kind, a, b, third) result(id)
A new expression.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| c | type(fypp_t) | inout | the state | |
| kind | integer | in | what it is | |
| a | integer | in | optional | the first operand |
| b | integer | in | optional | the second operand |
| third | integer | in | optional | the third operand |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| id | integer |
Calls
Source
Show the code
integer function new_expr(c, kind, a, b, third) result(id)
type(fypp_t), intent(inout) :: c !! the state
integer, intent(in) :: kind !! what it is
integer, intent(in), optional :: a !! the first operand
integer, intent(in), optional :: b !! the second operand
integer, intent(in), optional :: third !! the third operand
type(expr_t), allocatable :: grown(:)
integer :: k
if (c%num_exprs == size(c%exprs)) then
allocate (grown(2*c%num_exprs))
do k = 1, c%num_exprs
call move_expr(c%exprs(k), grown(k))
end do
call move_alloc(grown, c%exprs)
end if
c%num_exprs = c%num_exprs + 1
id = c%num_exprs
c%exprs(id)%kind = kind
if (present(a)) c%exprs(id)%a = a
if (present(b)) c%exprs(id)%b = b
if (present(third)) c%exprs(id)%c = third
end function new_expr