aot_path_open_table Subroutine

private subroutine aot_path_open_table(me, conf, thandle, openLua)

This subroutine opens all the tables on the way to the final head node of the given path.

The handle can be either passed in, to be used for the look up of the path, or, when specifying the optional openLua argument as true, it will return the handle to the newly opened Lua script.

Arguments

Type IntentOptional Attributes Name
type(aot_path_type), intent(inout) :: me

The path object to open as a function

type(flu_State) :: conf

The flu_state handle, which is either opened according to the path, or used to open the path in.

integer, intent(out) :: thandle

return handle of the last opened table

logical, intent(in), optional :: openLua

A flag to indicate, wether to open the Lua script, default is false, in which case the conf argument has to link to an actual Lua state handle.


Calls

proc~~aot_path_open_table~~CallsGraph proc~aot_path_open_table aot_path_open_table proc~aot_table_open aot_table_open proc~aot_path_open_table->proc~aot_table_open proc~open_config_file open_config_file proc~aot_path_open_table->proc~open_config_file proc~aot_table_push aot_table_push proc~aot_table_open->proc~aot_table_push proc~aot_table_top aot_table_top proc~aot_table_open->proc~aot_table_top proc~flu_createtable flu_createtable proc~aot_table_open->proc~flu_createtable proc~flu_getglobal flu_getglobal proc~aot_table_open->proc~flu_getglobal proc~flu_gettop flu_gettop proc~aot_table_open->proc~flu_gettop interface~flu_dump flu_dump proc~open_config_file->interface~flu_dump proc~aot_err_handler aot_err_handler proc~open_config_file->proc~aot_err_handler proc~flu_isopen flu_isopen proc~open_config_file->proc~flu_isopen proc~flu_pcall flu_pcall proc~open_config_file->proc~flu_pcall proc~flul_loadfile fluL_loadfile proc~open_config_file->proc~flul_loadfile proc~flul_newstate fluL_newstate proc~open_config_file->proc~flul_newstate proc~flul_openlibs fluL_openlibs proc~open_config_file->proc~flul_openlibs proc~flu_dump_tobuf flu_dump_toBuf interface~flu_dump->proc~flu_dump_tobuf proc~flu_tolstring flu_tolstring proc~aot_err_handler->proc~flu_tolstring proc~aot_table_push->proc~flu_getglobal interface~flu_pushinteger flu_pushinteger proc~aot_table_push->interface~flu_pushinteger proc~flu_getfield flu_getfield proc~aot_table_push->proc~flu_getfield proc~flu_gettable flu_gettable proc~aot_table_push->proc~flu_gettable proc~flu_pop flu_pop proc~aot_table_push->proc~flu_pop proc~flu_pushnil flu_pushnil proc~aot_table_push->proc~flu_pushnil proc~flu_type flu_type proc~aot_table_push->proc~flu_type proc~aot_table_top->proc~flu_gettop proc~flu_istable flu_isTable proc~aot_table_top->proc~flu_istable proc~aot_table_top->proc~flu_pop interface~lua_createtable lua_createtable proc~flu_createtable->interface~lua_createtable interface~lua_getglobal lua_getglobal proc~flu_getglobal->interface~lua_getglobal interface~lua_gettop lua_gettop proc~flu_gettop->interface~lua_gettop interface~lua_pcallk lua_pcallk proc~flu_pcall->interface~lua_pcallk interface~lual_loadfilex luaL_loadfilex proc~flul_loadfile->interface~lual_loadfilex interface~lual_newstate luaL_newstate proc~flul_newstate->interface~lual_newstate interface~lual_openlibs luaL_openlibs proc~flul_openlibs->interface~lual_openlibs proc~flu_pushint flu_pushint interface~flu_pushinteger->proc~flu_pushint proc~flu_pushlong flu_pushlong interface~flu_pushinteger->proc~flu_pushlong interface~dump_lua_tobuf dump_lua_toBuf proc~flu_dump_tobuf->interface~dump_lua_tobuf interface~lua_getfield lua_getfield proc~flu_getfield->interface~lua_getfield interface~lua_gettable lua_gettable proc~flu_gettable->interface~lua_gettable interface~lua_type lua_type proc~flu_istable->interface~lua_type interface~lua_settop lua_settop proc~flu_pop->interface~lua_settop interface~lua_pushnil lua_pushnil proc~flu_pushnil->interface~lua_pushnil interface~lua_tolstring lua_tolstring proc~flu_tolstring->interface~lua_tolstring proc~flu_type->interface~lua_type interface~lua_pushinteger lua_pushinteger proc~flu_pushint->interface~lua_pushinteger proc~flu_pushlong->interface~lua_pushinteger

Called by

proc~~aot_path_open_table~~CalledByGraph proc~aot_path_open_table aot_path_open_table interface~aot_path_open aot_path_open interface~aot_path_open->proc~aot_path_open_table proc~aot_path_open_fun aot_path_open_fun interface~aot_path_open->proc~aot_path_open_fun proc~aot_path_open_fun->proc~aot_path_open_table

Source Code

  subroutine aot_path_open_table(me, conf, thandle, openLua)
    !> The path object to open as a function
    type(aot_path_type), intent(inout) :: me
    !> The flu_state handle, which is either opened according to
    !! the path, or used to open the path in.
    type(flu_state) :: conf
    !> return handle of the last opened table
    integer, intent(out) :: thandle
    !> A flag to indicate, wether to open the Lua script, default
    !! is false, in which case the conf argument has to link to
    !! an actual Lua state handle.
    logical, intent(in), optional :: openLua

    logical :: new_conf
    type(aot_path_node_type), pointer :: curNode => NULL()
    integer :: myHandle = 0
    integer :: prevHandle = -1

    if (present(openLua)) then
      new_conf = openLua
    else
      new_conf = .false.
    end if

    if (new_conf) then
      call open_config_file(conf, me%LuaFilename)
    end if

    curNode => me%GlobalNode

    if (curNode%NodeType == 'table') then
      select case(curNode%ID_kind)
      case('key')
        call aot_table_open(L=conf, thandle=me%roothandle, key=curNode%key)
      end select
      if (associated(curNode%child)) then
        curNode => curNode%child
        myHandle = me%rootHandle
      end if
    end if

    do while(associated(curNode%child))
      prevHandle = myHandle

      select case(curNode%ID_kind)
      case('key')
        call aot_table_open(L=conf, thandle=myHandle, parent=prevHandle, &
          &                 key=curNode%key)
      case('position')
        call aot_table_open(L=conf, thandle=myHandle, parent=prevHandle, &
          &                 pos=curNode%pos)
      end select
      curNode => curNode%child

    end do

    thandle = myHandle

  end subroutine aot_path_open_table