flu_binding Module

This module provides the Fortran Lua interface.

It defines a flu_state which encapsulates the Lua state and is used to reference a Lua script. The main content are then the wrapper implementations which ease the usage of the Lua functions declared in the lua_fif module.

Naming follows the Lua API, but replaces the lua_ prefix by flu_.


Uses

  • module~~flu_binding~~UsesGraph module~flu_binding flu_binding iso_c_binding iso_c_binding module~flu_binding->iso_c_binding module~lua_parameters lua_parameters module~flu_binding->module~lua_parameters module~flu_kinds_module flu_kinds_module module~flu_binding->module~flu_kinds_module module~dump_lua_fif_module dump_lua_fif_module module~flu_binding->module~dump_lua_fif_module module~lua_fif lua_fif module~flu_binding->module~lua_fif module~lua_parameters->iso_c_binding module~dump_lua_fif_module->iso_c_binding module~lua_fif->iso_c_binding module~lua_fif->module~lua_parameters

Used by

  • module~~flu_binding~~UsedByGraph module~flu_binding flu_binding module~aot_top_module aot_top_module module~aot_top_module->module~flu_binding module~aot_extdouble_top_module aot_extdouble_top_module module~aot_top_module->module~aot_extdouble_top_module module~aot_err_module aot_err_module module~aot_top_module->module~aot_err_module module~aot_quadruple_top_module aot_quadruple_top_module module~aot_top_module->module~aot_quadruple_top_module module~aot_extdouble_table_module aot_extdouble_table_module module~aot_extdouble_table_module->module~flu_binding module~aot_extdouble_table_module->module~aot_top_module module~aot_table_ops_module aot_table_ops_module module~aot_extdouble_table_module->module~aot_table_ops_module module~aot_extdouble_table_module->module~aot_extdouble_top_module module~aot_extdouble_table_module->module~aot_err_module module~aot_table_module aot_table_module module~aot_table_module->module~flu_binding module~aot_table_module->module~aot_top_module module~aot_table_module->module~aot_extdouble_table_module module~aot_quadruple_table_module aot_quadruple_table_module module~aot_table_module->module~aot_quadruple_table_module module~aot_table_module->module~aot_table_ops_module module~aot_table_module->module~aot_err_module module~aot_quadruple_vector_module aot_quadruple_vector_module module~aot_quadruple_vector_module->module~flu_binding module~aot_quadruple_vector_module->module~aot_top_module module~aot_quadruple_vector_module->module~aot_table_ops_module module~aot_quadruple_vector_module->module~aot_quadruple_top_module module~aot_quadruple_table_module->module~flu_binding module~aot_quadruple_table_module->module~aot_top_module module~aot_quadruple_table_module->module~aot_table_ops_module module~aot_quadruple_table_module->module~aot_err_module module~aot_quadruple_table_module->module~aot_quadruple_top_module module~aot_extdouble_fun_module aot_extdouble_fun_module module~aot_extdouble_fun_module->module~flu_binding module~aot_extdouble_fun_module->module~aot_table_module module~aot_extdouble_fun_module->module~aot_extdouble_top_module module~aot_path_module aot_path_module module~aot_path_module->module~flu_binding module~aot_path_module->module~aot_table_module module~aot_fun_module aot_fun_module module~aot_path_module->module~aot_fun_module module~aotus_module aotus_module module~aot_path_module->module~aotus_module module~aot_extdouble_vector_module aot_extdouble_vector_module module~aot_extdouble_vector_module->module~flu_binding module~aot_extdouble_vector_module->module~aot_top_module module~aot_extdouble_vector_module->module~aot_table_ops_module module~aot_extdouble_vector_module->module~aot_extdouble_top_module module~aot_quadruple_fun_module aot_quadruple_fun_module module~aot_quadruple_fun_module->module~flu_binding module~aot_quadruple_fun_module->module~aot_table_module module~aot_quadruple_fun_module->module~aot_quadruple_top_module module~aot_table_ops_module->module~flu_binding module~aot_table_ops_module->module~aot_top_module module~aot_references_module aot_references_module module~aot_references_module->module~flu_binding module~aot_references_module->module~aot_table_ops_module module~aot_fun_module->module~flu_binding module~aot_fun_module->module~aot_top_module module~aot_fun_module->module~aot_table_module module~aot_fun_module->module~aot_extdouble_fun_module module~aot_fun_module->module~aot_quadruple_fun_module module~aot_fun_module->module~aot_references_module module~aot_extdouble_top_module->module~flu_binding module~aot_extdouble_top_module->module~aot_err_module module~aot_err_module->module~flu_binding module~aot_vector_module aot_vector_module module~aot_vector_module->module~flu_binding module~aot_vector_module->module~aot_top_module module~aot_vector_module->module~aot_quadruple_vector_module module~aot_vector_module->module~aot_extdouble_vector_module module~aot_vector_module->module~aot_table_ops_module module~aotus_module->module~flu_binding module~aotus_module->module~aot_top_module module~aotus_module->module~aot_table_module module~aotus_module->module~aot_vector_module program~test test program~test->module~flu_binding module~aot_quadruple_top_module->module~flu_binding module~aot_quadruple_top_module->module~aot_err_module module~aot_quadruple_out_module aot_quadruple_out_module module~aot_quadruple_out_module->module~aot_quadruple_top_module module~aot_extdouble_out_module aot_extdouble_out_module module~aot_extdouble_out_module->module~aot_extdouble_top_module module~aot_out_module aot_out_module module~aot_out_module->module~aot_quadruple_out_module module~aot_out_module->module~aot_extdouble_out_module

Contents


Variables

TypeVisibilityAttributesNameInitial
integer, public, parameter:: FLU_TNONE =int(LUA_TNONE)
integer, public, parameter:: FLU_TNIL =int(LUA_TNIL)
integer, public, parameter:: FLU_TBOOLEAN =int(LUA_TBOOLEAN)
integer, public, parameter:: FLU_TLIGHTUSERDATA =int(LUA_TLIGHTUSERDATA)
integer, public, parameter:: FLU_TNUMBER =int(LUA_TNUMBER)
integer, public, parameter:: FLU_TSTRING =int(LUA_TSTRING)
integer, public, parameter:: FLU_TTABLE =int(LUA_TTABLE)
integer, public, parameter:: FLU_TFUNCTION =int(LUA_TFUNCTION)
integer, public, parameter:: FLU_TUSERDATA =int(LUA_TUSERDATA)
integer, public, parameter:: FLU_TTHREAD =int(LUA_TTHREAD)

Interfaces

public interface flu_pushnumber

  • private subroutine flu_pushreal(L, n)

    Arguments

    TypeIntentOptionalAttributesName
    type(flu_State) :: L
    real :: n
  • private subroutine flu_pushdouble(L, n)

    Arguments

    TypeIntentOptionalAttributesName
    type(flu_State) :: L
    real(kind=c_double) :: n

public interface flu_pushinteger

  • private subroutine flu_pushint(L, n)

    Arguments

    TypeIntentOptionalAttributesName
    type(flu_State) :: L
    integer(kind=int_k) :: n
  • private subroutine flu_pushlong(L, n)

    Arguments

    TypeIntentOptionalAttributesName
    type(flu_State) :: L
    integer(kind=long_k) :: n

public interface flu_dump

  • private subroutine flu_dump_toBuf(L, buf, length, iError)

    Dump to a buffer and return the pointer to the resulting string.

    Arguments

    TypeIntentOptionalAttributesName
    type(flu_State) :: L
    type(cbuf_type), intent(out) :: buf
    integer :: length
    integer :: iError

interface

  • private subroutine c_free(ptr) bind(c, name="0")

    Arguments

    TypeIntentOptionalAttributesName
    type(c_ptr), value:: ptr

Abstract Interfaces

abstract interface

Interoperable interface required for a function that is callable from Lua.

  • public function lua_Function(s) result(val) bind(c)

    Arguments

    TypeIntentOptionalAttributesName
    type(c_ptr), value:: s

    Return Value integer(kind=c_int)


Derived Types

type, public :: flu_State

Encapsulation of the Lua state.

Read more…

Components

TypeVisibilityAttributesNameInitial
type(c_ptr), private :: state =c_null_ptr
logical, private :: opened_libs =.false.

type, public :: cbuf_type

Components

TypeVisibilityAttributesNameInitial
type(c_ptr), private :: ptr =c_null_ptr
character, private, pointer:: buffer(:)=> NULL()

Functions

public function flu_getfield(L, index, k) result(luatype)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index
character(len=*) :: k

Return Value integer

public function flu_getglobal(L, k) result(luatype)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
character(len=*) :: k

Return Value integer

public function flu_gettable(L, index) result(luatype)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value integer

public function flu_gettop(L) result(stacktop)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L

Return Value integer

public function flu_isBoolean(L, index) result(is_boolean)

Only defined as a Macro, using lua_type:

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isFunction(L, index) result(is_function)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isnumber(L, index) result(is_number)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isString(L, index) result(is_string)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isTable(L, index) result(is_Table)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isNoneOrNil(L, index) result(is_NoneOrNil)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isNil(L, index) result(is_Nil)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isNone(L, index) result(is_None)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_islightuserdata(L, index) result(is_lightuserdata)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_next(L, index) result(exists)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer, intent(in) :: index

Return Value logical

public function flu_pcall(L, nargs, nresults, errfunc) result(errcode)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: nargs
integer :: nresults
integer :: errfunc

Return Value integer

public function flu_rawgeti(L, index, n) result(luatype)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer, intent(in) :: index
integer, intent(in) :: n

Return Value integer

public function flu_tolstring(L, index, len) result(string)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index
integer :: len

Return Value character,pointer, dimension(:)

public function flu_todouble(L, index) result(number)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value real(kind=c_double)

public function flu_tonumber(L, index) result(number)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value real

public function flu_toBoolean(L, index) result(bool)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_touserdata(L, index) result(ptr)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value type(c_ptr)

public function flu_topointer(L, index) result(intptr)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value integer(kind=long_k)

public function flu_type(L, index) result(flut)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value integer

public function flu_getmetatable(L, index) result(errcode)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

Return Value integer

public function fluL_loadfile(L, filename) result(errcode)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
character(len=*) :: filename

Return Value integer

public function fluL_loadbuffer(L, buffer, bufName) result(errcode)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
character :: buffer(:)
character(len=*), optional :: bufName

Return Value integer

public function fluL_loadstring(L, string) result(errcode)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
character(len=*) :: string

Return Value integer

public function fluL_newstate() result(new_state)

Arguments

None

Return Value type(flu_State)

public function fluL_newmetatable(L, tname) result(errcode)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
character(len=*) :: tname

Return Value integer

public function fluL_ref(L, t) result(ref)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: t

Return Value integer

public function flu_copyptr(lua_state) result(L)

Copy an existing Lua state.

Read more…

Arguments

TypeIntentOptionalAttributesName
type(c_ptr), intent(in) :: lua_state

Return Value type(flu_State)

public function flu_isopen(L) result(is_open)

Arguments

TypeIntentOptionalAttributesName
type(flu_State), intent(in) :: L

Return Value logical


Subroutines

public subroutine flu_close(L)

Close a previously opened Lua script.

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L

Handle to the Lua state to close.

public subroutine flu_createtable(L, narr, nrec)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: narr
integer :: nrec

public subroutine flu_insert(L, index)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

public subroutine flu_pop(L, n)

Wrapper for lua_pop that pops n elements from the Lua API stack.

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L

Handle to the Lua script

integer, intent(in), optional :: n

Number of elements to pop from the Lua API stack, defaults to 1.

public subroutine flu_pushboolean(L, b)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
logical :: b

public subroutine flu_pushstring(L, string)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
character(len=*), intent(in) :: string

public subroutine flu_pushnil(L)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L

public subroutine flu_pushvalue(L, index)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index

public subroutine flu_pushlightuserdata(L, ptr)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
type(c_ptr) :: ptr

public subroutine flu_settable(L, n)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer, intent(in) :: n

public subroutine flu_settop(L, n)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer, intent(in) :: n

public subroutine flu_setfield(L, index, k)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer :: index
character(len=*) :: k

public subroutine flu_setglobal(L, k)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
character(len=*), intent(in) :: k

public subroutine flu_pushcclosure(L, fn, n)

Arguments

TypeIntentOptionalAttributesName
type(flu_State), value:: L
procedure(lua_Function) :: fn
integer :: n

public subroutine flu_register(L, fn_name, fn)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
character(len=*), intent(in) :: fn_name
procedure(lua_Function) :: fn

public subroutine fluL_openlibs(L)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L

public subroutine fluL_setmetatable(L, tname)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
character(len=*) :: tname

public subroutine flu_free_cbuf(buf)

Free an allocated cbuf.

Read more…

Arguments

TypeIntentOptionalAttributesName
type(cbuf_type) :: buf

private subroutine flu_pushint(L, n)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer(kind=int_k) :: n

private subroutine flu_pushlong(L, n)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
integer(kind=long_k) :: n

private subroutine flu_pushreal(L, n)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
real :: n

private subroutine flu_pushdouble(L, n)

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
real(kind=c_double) :: n

private subroutine flu_dump_toBuf(L, buf, length, iError)

Dump to a buffer and return the pointer to the resulting string.

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L
type(cbuf_type), intent(out) :: buf
integer :: length
integer :: iError