ug4
info_commands.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2015: G-CSC, Goethe University Frankfurt
3  * Author: Martin Rupp
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #include "externals/lua/lua.h"
34 #include "registry/registry.h"
35 #include <string>
36 
37 #ifndef __H__UG_SCRIPT__INFO_COMMANDS__
38 #define __H__UG_SCRIPT__INFO_COMMANDS__
39 
40 #include "common/ug_config.h"
41 
42 namespace ug
43 {
44 namespace bridge
45 {
46 
48 UG_API bool RegisterInfoCommands(bridge::Registry &reg, const char* grp);
49 
56 UG_API const ClassNameNode* GetClassNameNode(lua_State *L, int index);
57 
63 UG_API const std::vector<const char*> *GetClassNames(lua_State *L, int index);
64 
70 UG_API const std::vector<const char*> *GetClassNames(lua_State* L, const char *name);
71 
72 
80 UG_API std::string LuaClassMethodInfo(lua_State *L, int index, const ExportedMethod &thefunc);
81 
82 
83 
90 UG_API std::string FunctionInfo(lua_State *L, bool bComplete, const char *functionName=NULL);
91 
92 UG_API int UGTypeInfo(const char *p);
93 
94 UG_API bool GetLuaNamespace(lua_State* L, std::string name);
95 
102 UG_API double LuaGetNumber(lua_State *L, const char *name, double notAvailable);
103 
110 UG_API std::string LuaGetString(lua_State *L, const char *name, const char *notAvailable);
111 
118 UG_API bool LuaGetBoolean(lua_State *L, const char *name, bool notAvailable);
119 
124 UG_API std::string LuaCurrentLine(lua_State* L);
125 
131 UG_API void LuaGetLastLine(lua_State* L, lua_Debug entry);
132 
137 UG_API std::string LuaGetScriptFunctionString(lua_State *L, int index=-1);
138 
144 UG_API void LuaPrintTable(lua_State *L, size_t iSpace, int index=-1);
145 UG_API bool ClassInstantiations(const char *classname);
146 
147 
155 UG_API std::string GetLuaTypeString(lua_State* L, int index);
156 
158 
163 UG_API std::string LuaStackTraceString(lua_State* L, int fromLevel=0, int toLevel=-1);
164 
165 UG_API std::string LuaStackTraceString();
166 
168 UG_API void LuaStackTrace(int fromlevel);
169 
170 
172 UG_API std::string GetLuaFileAndLine(lua_State* L);
173 
176 
178 UG_API std::string GetLuaLine(lua_State* L);
179 
181 std::string GetLUAScriptFunctionDefined(const char *functionName);
182 
183 }
184 }
185 
186 #endif // __H__UG_SCRIPT__INFO_COMMANDS__
location name
Definition: checkpoint_util.lua:128
#define UG_API
Definition: ug_config.h:65
struct lua_State lua_State
Definition: lua_table_handle.h:40
bool LuaGetBoolean(lua_State *L, const char *name, bool notAvailable)
returns a boolean to a lua-variable.
Definition: info_commands.cpp:267
string LuaStackTraceString(lua_State *L, int fromLevel, int toLevel)
prints information about lua's call stack (file:line source).
Definition: info_commands.cpp:1094
string LuaCurrentLine(lua_State *L)
Definition: info_commands.cpp:1073
string GetLuaTypeString(lua_State *L, int index)
Definition: info_commands.cpp:1007
string FunctionInfo(lua_State *L, bool bComplete, const char *functionName)
prints out information for a lua function (a function defined in lua script)
Definition: info_commands.cpp:399
string GetLUAScriptFunctionDefined(const char *functionName)
returns file and line of defined script function
Definition: info_commands.cpp:368
int UGTypeInfo(const char *p)
Prints info to a lua type.
Definition: info_commands.cpp:443
void LuaPrintTable(lua_State *L, size_t iSpace, int index)
prints the source of a lua script function which is on top of the stack
Definition: info_commands.cpp:701
const std::vector< const char * > * GetClassNames(lua_State *L, int index)
Definition: info_commands.cpp:337
string LuaGetString(lua_State *L, const char *name, const char *notAvailable)
returns the string to a lua-variable.
Definition: info_commands.cpp:254
void LuaGetLastLine(lua_State *L, lua_Debug entry)
Definition: info_commands.cpp:1058
string LuaGetScriptFunctionString(lua_State *L, int index)
prints the source of a lua script function which is on top of the stack
Definition: info_commands.cpp:680
double LuaGetNumber(lua_State *L, const char *name, double notAvailable)
returns an integer to a lua-variable.
Definition: info_commands.cpp:241
void LuaStackTrace(int fromLevel)
prints information about lua's call stack (file:line source).
Definition: info_commands.cpp:1179
std::string GetLuaFileAndLineNumber(lua_State *L)
returns the current file and line-number
Definition: info_commands.cpp:1154
bool GetLuaNamespace(lua_State *L, string name)
searches for a namespaces (lists) and pushes it onto the stack
Definition: info_commands.cpp:289
bool ClassInstantiations(const char *classname)
this function prints all objects which are of a certain class
Definition: info_commands.cpp:562
bool RegisterInfoCommands(Registry &reg, const char *parentGroup)
registers info commands TypeInfo, ClassUsage and others
Definition: info_commands.cpp:1242
std::string GetLuaLine(lua_State *L)
returns the current line-content
Definition: info_commands.cpp:1163
const ClassNameNode * GetClassNameNode(lua_State *L, int index)
Definition: info_commands.cpp:320
bool GetLuaFileAndLine(lua_State *L, std::string &file, size_t &line)
returns the current file and line (
Definition: info_commands.cpp:1123
string LuaClassMethodInfo(lua_State *L, int index, const ExportedMethod &thefunc)
prints out information for a method of a class
Definition: info_commands.cpp:425
the ug namespace