tem_lua_requires_module Module

This module is used to track the requires in loaded Lua scripts.

The purpose of this functionality is it to enable the loading of all Lua scripts on a single process and broadcasting them to all others, without the need to access the files by all processes.


Uses

  • module~~tem_lua_requires_module~~UsesGraph module~tem_lua_requires_module tem_lua_requires_module module~flu_binding flu_binding module~tem_lua_requires_module->module~flu_binding module~aot_table_module aot_table_module module~tem_lua_requires_module->module~aot_table_module module~aotus_module aotus_module module~tem_lua_requires_module->module~aotus_module iso_c_binding iso_c_binding module~tem_lua_requires_module->iso_c_binding module~env_module env_module module~tem_lua_requires_module->module~env_module module~env_module->module~flu_binding module~env_module->module~aotus_module mpi mpi module~env_module->mpi iso_fortran_env iso_fortran_env module~env_module->iso_fortran_env

Used by

  • module~~tem_lua_requires_module~~UsedByGraph module~tem_lua_requires_module tem_lua_requires_module module~tem_aux_module tem_aux_module module~tem_aux_module->module~tem_lua_requires_module

Contents


Variables

TypeVisibilityAttributesNameInitial
character, private, parameter:: nl =C_NEW_LINE
character(len=1300), private, parameter:: track_rq_Lua ="track_rq = {}"//nl//"track_rq.nesting = 0"//nl//"track_rq.code = {}"//nl//"track_rq.open_files = {}"//nl//"track_rq.open_files.count = 0"//nl//"track_rq.open_files.name = {}"//nl//"track_rq.open_files.file = {}"//nl//"track_rq.open_files.head = {}"//nl//nl//"track_rq.rq_orig = require"//nl//"function require(name)"//nl//"  track_rq.nesting = track_rq.nesting+1"//nl//"  local orig_ret = track_rq.rq_orig(name)"//nl//"  track_rq.nesting = track_rq.nesting-1"//nl//"  return orig_ret"//nl//"end"//nl//nl//"track_rq.search_orig = package.searchers[2]"//nl//"function track_rq.searcher(name)"//nl//"  local modfun, fname = track_rq.search_orig(name)"//nl//"  local nest = track_rq.nesting"//nl//"  if fname then"//nl//"    track_rq.open_files.count = track_rq.open_files.count + 1"//nl//"    if nest > 1 then"//nl//"      track_rq.open_files.head[nest] "//"= track_rq.open_files.head[nest-1]"//nl//"      for i = 1,nest-1 do"//nl//"        track_rq.open_files.head[i] "//"= track_rq.open_files.head[i] + 1"//nl//"      end"//nl//"    else"//nl//"      track_rq.open_files.head[nest] = track_rq.open_files.count"//nl//"    end"//nl//"    local head = track_rq.open_files.head[nest]"//nl//"    table.insert(track_rq.open_files.name, head, name)"//nl//"    table.insert(track_rq.open_files.file, head, fname)"//nl//"    track_rq.code[name] = modfun"//nl//"    return modfun, fname"//nl//"  else"//nl//"    return modfun"//nl//"  end"//nl//"end"//nl//"package.searchers[2] = track_rq.searcher"

This script amends the require and the Lua searcher, such that they report the loaded Lua files in the track_rq table.

The filled table can then be used to fetch all required files for the given script. It therefore should be executed before the actual configuration, and evaluated after the configuration script is executed.

character(len=500), private, parameter:: rq_store_Lua ="rq_store = {}"//nl//"rq_store.file = {}"//nl//"rq_store.code = {}"//nl//nl//"function rq_store.searcher(name)"//nl//"  if rq_store.code[name] then"//nl//"    local mycode = rq_store.code[name]"//nl//"    local myfile = rq_store.file[name]"//nl//"    rq_store.code[name] = nil"//nl//"    rq_store.file[name] = nil"//nl//"    return mycode, myfile"//nl//"  else"//nl//"    return 'Module '..name..' not found in the rq_store!'"//nl//"  end"//nl//"end"//nl//"package.searchers[2] = rq_store.searcher"

Subroutines

public subroutine tem_require_track_rq(L)

Load the track_rq script into the Lua state.

Read more…

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L

public subroutine tem_pop_from_track_rq(L, modname, buffer)

Subroutine to pop the code from the tracked required files.

Read more…

Arguments

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

Name of the module to pop.

type(cbuf_type) :: buffer

Buffer to hold the code.

public subroutine tem_require_rq_store(L)

Load the rq_store script into the Lua state.

Read more…

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L

public subroutine tem_push_to_rq_store(L, modname, filename, buffer)

Push a script in a buffer into the rq_store.

Read more…

Arguments

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

Name of the module to store.

character(len=*), intent(in) :: filename

Original file name.

character, intent(in) :: buffer(:)

Actual buffer holding the code.

public subroutine tem_get_required_Lua(L, fileList, labelList)

Obtain the recorded open files by track_rq from the Lua state.

Read more…

Arguments

TypeIntentOptionalAttributesName
type(flu_State) :: L

Lua state to get the requires from

character(len=PathLen), intent(out), allocatable:: fileList(:)

List of required filenames in the Lua state.

character(len=LabelLen), intent(out), allocatable:: labelList(:)

List of the module names associated to the corresponding files.