aot_fun_put_single_v Subroutine

private subroutine aot_fun_put_single_v(L, fun, arg)

Put an array of singles into the list of arguments for the function.

Arguments

Type IntentOptional AttributesName
type(flu_state) :: L

Handle for the Lua script.

type(aot_fun_type) :: fun

Handle of the function, this argument should be put into.

real(kind=single_k), intent(in) :: arg(:)

Actual argument to hand over to the Lua function.


Calls

proc~~aot_fun_put_single_v~~CallsGraph proc~aot_fun_put_single_v aot_fun_put_single_v proc~flu_pushvalue flu_pushvalue proc~aot_fun_put_single_v->proc~flu_pushvalue proc~flu_settop flu_settop proc~aot_fun_put_single_v->proc~flu_settop interface~aot_table_from_1darray aot_table_from_1Darray proc~aot_fun_put_single_v->interface~aot_table_from_1darray interface~lua_pushvalue lua_pushvalue proc~flu_pushvalue->interface~lua_pushvalue interface~lua_settop lua_settop proc~flu_settop->interface~lua_settop proc~create_1darray_real create_1Darray_real interface~aot_table_from_1darray->proc~create_1darray_real proc~create_1darray_double create_1Darray_double interface~aot_table_from_1darray->proc~create_1darray_double proc~flu_gettop flu_gettop proc~create_1darray_real->proc~flu_gettop proc~flu_createtable flu_createtable proc~create_1darray_real->proc~flu_createtable interface~flu_pushinteger flu_pushinteger proc~create_1darray_real->interface~flu_pushinteger proc~flu_settable flu_settable proc~create_1darray_real->proc~flu_settable interface~flu_pushnumber flu_pushnumber proc~create_1darray_real->interface~flu_pushnumber proc~create_1darray_double->proc~flu_gettop proc~create_1darray_double->proc~flu_createtable proc~create_1darray_double->interface~flu_pushinteger proc~create_1darray_double->proc~flu_settable proc~create_1darray_double->interface~flu_pushnumber interface~lua_gettop lua_gettop proc~flu_gettop->interface~lua_gettop interface~lua_createtable lua_createtable proc~flu_createtable->interface~lua_createtable proc~flu_pushint flu_pushint interface~flu_pushinteger->proc~flu_pushint proc~flu_pushlong flu_pushlong interface~flu_pushinteger->proc~flu_pushlong interface~lua_settable lua_settable proc~flu_settable->interface~lua_settable proc~flu_pushdouble flu_pushdouble interface~flu_pushnumber->proc~flu_pushdouble proc~flu_pushreal flu_pushreal interface~flu_pushnumber->proc~flu_pushreal interface~lua_pushnumber lua_pushnumber proc~flu_pushdouble->interface~lua_pushnumber interface~lua_pushinteger lua_pushinteger proc~flu_pushint->interface~lua_pushinteger proc~flu_pushreal->interface~lua_pushnumber proc~flu_pushlong->interface~lua_pushinteger

Called by

proc~~aot_fun_put_single_v~~CalledByGraph proc~aot_fun_put_single_v aot_fun_put_single_v interface~aot_fun_put aot_fun_put interface~aot_fun_put->proc~aot_fun_put_single_v

Contents

Source Code


Source Code

  subroutine aot_fun_put_single_v(L, fun, arg)
    type(flu_state) :: L !! Handle for the Lua script.

    !> Handle of the function, this argument should be put into.
    type(aot_fun_type) :: fun

    !> Actual argument to hand over to the Lua function.
    real(kind=single_k), intent(in) :: arg(:)

    real(kind=double_k) :: locarg(size(arg))

    integer :: thandle

    ! Only do something, if the function is actually properly defined.
    if (fun%handle /= 0) then

      locarg = real(arg, kind=double_k)

      ! If the function was executed before this call, it has to be
      ! reset.
      if (fun%arg_count == -1) then
        ! Set the top of the stack to the reference of the function.
        ! Discarding anything above it.
        call flu_settop(L, fun%handle)
        ! Push a copy of the function itself on the stack again, before
        ! adding arguments, to savely survive popping of the function
        ! upon execution.
        call flu_pushvalue(L, fun%handle)
        ! Increase the argument count to 0 again (really start counting
        ! arguments afterwards.
        fun%arg_count = fun%arg_count+1
      end if

      call aot_table_from_1Darray(L, thandle, locarg)
      fun%arg_count = fun%arg_count+1
    end if

  end subroutine aot_fun_put_single_v