Chi-Tech
chi_console.h File Reference
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include "chi_console_structs.h"
#include "parameters/parameter_block.h"
#include "parameters/input_parameters.h"
#include "chi_log_exceptions.h"
#include <vector>
#include <string>
#include <map>
#include <stack>

Go to the source code of this file.

Data Structures

class  chi::Console
 
struct  chi::Console::LuaFunctionRegistryEntry
 
struct  chi::Console::LuaFuncWrapperRegEntry
 

Namespaces

namespace  chi_physics
 
namespace  chi
 

Macros

#define ConsoleJoinWordsA(x, y)   x##y
 
#define ConsoleJoinWordsB(x, y)   ConsoleJoinWordsA(x, y)
 
#define RegisterLuaFunctionAsIs(func_name)
 
#define RegisterLuaFunction(function, namespace_name, func_name)
 
#define RegisterWrapperFunction( namespace_name, name_in_lua, syntax_function, actual_function)
 
#define RegisterLuaConstant(namespace_name, name_in_lua, value)
 
#define RegisterLuaConstantAsIs(name_in_lua, value)
 

Macro Definition Documentation

◆ ConsoleJoinWordsA

#define ConsoleJoinWordsA (   x,
 
)    x##y

Small utility macro for joining two words.

Definition at line 24 of file chi_console.h.

◆ ConsoleJoinWordsB

#define ConsoleJoinWordsB (   x,
 
)    ConsoleJoinWordsA(x, y)

IDK why this is needed. Seems like counter doesnt work properly without it

Definition at line 26 of file chi_console.h.

◆ RegisterLuaConstant

#define RegisterLuaConstant (   namespace_name,
  name_in_lua,
  value 
)
Value:
static char ConsoleJoinWordsB( \
unique_var_name_luaconst_##namespace_name##_##name_in_lua, __COUNTER__) = \
#namespace_name, #name_in_lua, value)
#define ConsoleJoinWordsB(x, y)
Definition: chi_console.h:26
static char AddLuaConstantToRegistry(const std::string &namespace_name, const std::string &constant_name, const chi_data_types::Varying &value)
Adds a constant to the lua state.

Definition at line 63 of file chi_console.h.

◆ RegisterLuaConstantAsIs

#define RegisterLuaConstantAsIs (   name_in_lua,
  value 
)
Value:
static char ConsoleJoinWordsB( \
unique_var_name_luaconst_##name_in_lua, __COUNTER__) = \
"", #name_in_lua, value)

Definition at line 69 of file chi_console.h.

◆ RegisterLuaFunction

#define RegisterLuaFunction (   function,
  namespace_name,
  func_name 
)
Value:
static char ConsoleJoinWordsB(unique_var_name_luacfunc_##func_name##_, \
__COUNTER__) = \
function, #namespace_name, #func_name)
static char AddFunctionToRegistryInNamespaceWithName(lua_CFunction function_ptr, const std::string &namespace_name, const std::string &function_name)
Adds a lua_CFunction to the registry. With namespace-table analogy.

Macro for registering a lua_CFunction within the Console singleton.

Parameters
functionLuaCFunction. The function to use.
namespace_nameNonQuotedString. May include scope resolution
func_nameNonQuotedString. The name of the function as it will appear in the lua console.

Definition at line 50 of file chi_console.h.

◆ RegisterLuaFunctionAsIs

#define RegisterLuaFunctionAsIs (   func_name)
Value:
static char ConsoleJoinWordsB(unique_var_name_luacfunc_##func_name##_, \
__COUNTER__) = \
func_name)
static char AddFunctionToRegistryGlobalNamespace(const std::string &raw_name_in_lua, lua_CFunction function_ptr)
Adds a lua_CFunction to the registry.

Macro for registering a lua_CFunction within the Console singleton, with the function being in the global namespace. Example:

ConsoleRegisterLuaFunction(chiSolverInitialize);
void chiSolverInitialize(int solver_handle)
Definition: lua_functions.c:92
Note
Remember to include the header "console/chi_console.h". The name supplied to this function cannot have scope resolution operators, i.e., "::".

Definition at line 37 of file chi_console.h.

◆ RegisterWrapperFunction

#define RegisterWrapperFunction (   namespace_name,
  name_in_lua,
  syntax_function,
  actual_function 
)
Value:
static char ConsoleJoinWordsB(unique_var_name_luacfunc_##name_in_lua##_, \
__COUNTER__) = \
#namespace_name, #name_in_lua, syntax_function, actual_function)
static char AddWrapperToRegistryInNamespaceWithName(const std::string &namespace_name, const std::string &name_in_lua, WrapperGetInParamsFunc syntax_function, WrapperCallFunc actual_function, bool ignore_null_call_func=false)
Adds a function wrapper to the lua registry.

Definition at line 56 of file chi_console.h.