quic/qbox
Loading...
Searching...
No Matches
luafile_tool.h
1/*
2 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
3 * Author: GreenSocs 2022
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8#ifndef __LUAFILE_TOOL_H__
9#define __LUAFILE_TOOL_H__
10
11// Set to true (or use -DGC_LUA_VERBOSE=true argument) to show the parameters
12// set
13#ifndef GC_LUA_VERBOSE
14#define GC_LUA_VERBOSE false
15#endif
16
17// Set to true (or use -DGC_LUA_DEBUG=true argument) to show what was not set as
18// a parameter
19#ifndef GC_LUA_DEBUG
20#define GC_LUA_DEBUG false
21#endif
22
23#include <scp/report.h>
24#include <cci_configuration>
25#include <iostream>
26#include <string>
27#include <vector>
28#include <sstream>
29#include <getopt.h>
30#include <memory>
31
32extern "C" {
33#include <lauxlib.h>
34#include <lua.h>
35#include <lualib.h>
36
37int lua_cci_get_val(lua_State* L);
38}
39
41
52namespace gs {
54{
55 SCP_LOGGER();
56 using key_val_args = std::vector<std::pair<std::string, std::string>>;
57
58 std::string m_orig_name;
59
60 std::string rel(std::string& n) const;
61
62public:
64 LuaFile_Tool(std::string _orig_name = "");
65
67
85 int config(cci::cci_broker_handle a_broker, const char* a_config_file, char* a_images_dir = NULL);
86
87protected:
89
95 int setParamsFromLuaTable(cci::cci_broker_handle a_broker, lua_State* L, int t, char* level = NULL);
96
98
103 void set_g_vars_from_cmdline(lua_State* L, const key_val_args& a_lua_globalvars);
104};
105} // namespace gs
106
107#endif
Definition target.h:160
Definition luafile_tool.h:54
void set_g_vars_from_cmdline(lua_State *L, const key_val_args &a_lua_globalvars)
set global variables passed from command line arguments using -D | –define_luagvar
Definition luautils.cc:328
int setParamsFromLuaTable(cci::cci_broker_handle a_broker, lua_State *L, int t, char *level=NULL)
Traverse a Lua table setting global variables as parameters (recursive)
Definition luautils.cc:168
int config(cci::cci_broker_handle a_broker, const char *a_config_file, char *a_images_dir=NULL)
Makes the configuration.
Definition luautils.cc:73
Tool which reads a Lua configuration file and sets parameters.
Definition biflow.cc:10