ug4
UGShell

the shell for ug4 More...

Functions

int ug::bridge::CompletionFunction (char *buf, int len, int buflen, int iPrintCompletionList)
 A function to implement word completion of classes and functions of ugscript When entered Dom<tab>, it completes to Domain2d, for example. If Domain2d and Domain3d are registered, it completes to Domain and shows suggestions Domain2d and Domain3d. currently only works with Linenoise. todo: - not all completions must have same snipped length. change. More...
 
static size_t ug::bridge::GetClassesCompletitions (char *buf, int len, std::vector< string > &matches, size_t &sniplen, int iPrintCompletionList)
 
static bool ug::bridge::GetGlobalFunctionInfo (char *buf, int len)
 
static size_t ug::bridge::GetGlobalsCompletitions (char *buf, int len, std::vector< string > &matches, size_t &sniplen, int iPrintCompletionList)
 
static size_t ug::bridge::GetMemberFunctionCompletitions (char *buf, int len, std::vector< string > &matches, size_t &sniplen)
 
static bool ug::bridge::GetMemberFunctionInfo (char *buf, int len)
 
static size_t ug::bridge::GetNamespaceCompletitions (char *buf, int len, std::vector< string > &matches, size_t &sniplen, int iPrintCompletionList)
 
static size_t ug::bridge::GetOtherCompletitions (char *buf, int len, std::vector< string > &matches, size_t &sniplen)
 
size_t ug::bridge::GetPathCompletitions (char *buf, int len, std::vector< string > &matches, size_t &sniplen)
 
void quit_all_mpi_procs_in_parallel ()
 
void ug::bridge::SetOtherCompletions (const char **otherCompletions, int nr)
 
void ug_check_registry (bool &errorOccurred)
 
void ug_init_bridge (bool &errorOccurred)
 
void ug_init_luashell (int argc, char *argv[])
 
void ug_init_path (char *argv[], bool &errorOccurred)
 
void ug_init_plugins (bool &errorOccurred)
 
bool ugshell_get_call_command (int argc, char *argv[], std::string &callCommand)
 
int ugshell_main (int argc, char *argv[])
 
void ugshell_print_header ()
 

Variables

static const char * errSymb = " % "
 

Detailed Description

the shell for ug4

Function Documentation

◆ CompletionFunction()

int ug::bridge::CompletionFunction ( char *  buf,
int  len,
int  buflen,
int  iPrintCompletionList 
)

A function to implement word completion of classes and functions of ugscript When entered Dom<tab>, it completes to Domain2d, for example. If Domain2d and Domain3d are registered, it completes to Domain and shows suggestions Domain2d and Domain3d. currently only works with Linenoise. todo: - not all completions must have same snipped length. change.

See also
linenoiseSetCompletionFunction
Parameters
bufbuffer from linenoise to complete
lenlength of the buf
buflenmaximal length of the buffer buf
iPrintCompletitionListnumber of times <tab> has been pushed, so we can display next 5 matches each time <tab> has been pushed.

References ug::bridge::GetClassesCompletitions(), ug::bridge::GetGlobalFunctionInfo(), ug::bridge::GetGlobalsCompletitions(), ug::bridge::GetMemberFunctionCompletitions(), ug::bridge::GetMemberFunctionInfo(), ug::bridge::GetNamespaceCompletitions(), ug::bridge::GetOtherCompletitions(), ug::bridge::GetPathCompletitions(), and printf().

Referenced by ug::bridge::InitShell().

◆ GetClassesCompletitions()

static size_t ug::bridge::GetClassesCompletitions ( char *  buf,
int  len,
std::vector< string > &  matches,
size_t &  sniplen,
int  iPrintCompletionList 
)
static

◆ GetGlobalFunctionInfo()

static bool ug::bridge::GetGlobalFunctionInfo ( char *  buf,
int  len 
)
static

GetGlobalFunctionInfo if buf is something like "function(", we print the function info (like "void function(number a, number b)")

Returns
true if something like "function(" found, else false.

References ug::bridge::FunctionInfo(), ug::script::GetDefaultLuaState(), ug::bridge::GetUGRegistry(), LUA_STACK_CHECK, p, print(), and printf().

Referenced by ug::bridge::CompletionFunction().

◆ GetGlobalsCompletitions()

static size_t ug::bridge::GetGlobalsCompletitions ( char *  buf,
int  len,
std::vector< string > &  matches,
size_t &  sniplen,
int  iPrintCompletionList 
)
static

GetGlobalsCompletitions searches in the Lua string table for string that completes the string in buf if they are also globals, we add them to vector<string> matches.

Parameters
bufthe buffer to complete
lenthe length of buf
matchesput your matches here
sniplenhow much of buf we use (for example, completing "ex" to "example" is 2, completing "examp" to "example" is 5)
Returns
number of added matches

References ug::script::GetDefaultLuaState(), LUA_STACK_CHECK, p, UG_LOG, and ug::bridge::UGTypeInfo().

Referenced by ug::bridge::CompletionFunction().

◆ GetMemberFunctionCompletitions()

static size_t ug::bridge::GetMemberFunctionCompletitions ( char *  buf,
int  len,
std::vector< string > &  matches,
size_t &  sniplen 
)
static

GetMemberFunctionCompletitions gets completion of the word in p, based on the classname which is before p, and puts matching completions in matches.

Parameters
bufthe buffer to complete
lenthe length of buf
matchesput your matches here
sniplenhow much of buf we use (for example, completing "ex" to "example" is 2, completing "examp" to "example" is 5)
Returns
number of added matches

References ug::bridge::Registry::get_class(), ug::bridge::IExportedClass::get_const_method(), ug::bridge::IExportedClass::get_method(), ug::bridge::GetClassNames(), ug::script::GetDefaultLuaState(), ug::bridge::GetUGRegistry(), LUA_STACK_CHECK, name, ug::bridge::ExportedFunctionBase::name(), ug::bridge::IExportedClass::num_const_methods(), ug::bridge::IExportedClass::num_methods(), p, and UG_ASSERT.

Referenced by ug::bridge::CompletionFunction().

◆ GetMemberFunctionInfo()

static bool ug::bridge::GetMemberFunctionInfo ( char *  buf,
int  len 
)
static

◆ GetNamespaceCompletitions()

static size_t ug::bridge::GetNamespaceCompletitions ( char *  buf,
int  len,
std::vector< string > &  matches,
size_t &  sniplen,
int  iPrintCompletionList 
)
static

GetNamespaceCompletitions gets completion of the word in p, e.g. for math.pi (with '.') and puts matching completions in matches.

Parameters
bufthe buffer to complete
lenthe length of buf
matchesput your matches here
sniplenhow much of buf we use (for example, completing "ex" to "example" is 2, completing "examp" to "example" is 5)
Returns
number of added matches

References ug::script::GetDefaultLuaState(), ug::bridge::GetLuaNamespace(), LUA_STACK_CHECK, name, p, UG_ASSERT, UG_LOG, and ug::bridge::UGTypeInfo().

Referenced by ug::bridge::CompletionFunction().

◆ GetOtherCompletitions()

static size_t ug::bridge::GetOtherCompletitions ( char *  buf,
int  len,
std::vector< string > &  matches,
size_t &  sniplen 
)
static

GetOtherCompletitions puts in matches completitions of user-provided strings like "quit", "continue" etc.

Parameters
bufthe buffer to complete
lenthe length of buf
matchesput your matches here
sniplenhow much of buf we use (for example, completing "ex" to "example" is 2, completing "examp" to "example" is 5)
Returns
number of added matches

use pOtherCompletitions and iOtherCompletitionsLength to set an array with user-provided completition strings.

References ug::bridge::iOtherCompletitionsLength, p, and ug::bridge::pOtherCompletitions.

Referenced by ug::bridge::CompletionFunction().

◆ GetPathCompletitions()

size_t ug::bridge::GetPathCompletitions ( char *  buf,
int  len,
std::vector< string > &  matches,
size_t &  sniplen 
)

GetPathCompletitions puts in matches completitions of path in buf if possible

Parameters
bufthe buffer to complete
lenthe length of buf
matchesput your matches here
sniplenhow much of buf we use (for example, completing "ex" to "example" is 2, completing "examp" to "example" is 5)
Returns
number of added matches

References p.

Referenced by ug::bridge::CompletionFunction().

◆ quit_all_mpi_procs_in_parallel()

void quit_all_mpi_procs_in_parallel ( )

References pcl::Abort(), errSymb, pcl::NumProcs(), and UG_LOG.

Referenced by ugshell_main().

◆ SetOtherCompletions()

void ug::bridge::SetOtherCompletions ( const char **  otherCompletions,
int  nr 
)

◆ ug_check_registry()

◆ ug_init_bridge()

◆ ug_init_luashell()

◆ ug_init_path()

void ug_init_path ( char *  argv[],
bool &  errorOccurred 
)

◆ ug_init_plugins()

void ug_init_plugins ( bool &  errorOccurred)

◆ ugshell_get_call_command()

bool ugshell_get_call_command ( int  argc,
char *  argv[],
std::string &  callCommand 
)

References ug::GetParamIndex().

Referenced by ugshell_main().

◆ ugshell_main()

◆ ugshell_print_header()

Variable Documentation

◆ errSymb

const char* errSymb = " % "
static