Skip to content

Commit b2244e6

Browse files
committed
Reformat: xrScriptEngine
1 parent 00c727d commit b2244e6

38 files changed

+1825
-1992
lines changed

src/xrScriptEngine/BindingsDumper.cpp

Lines changed: 123 additions & 139 deletions
Large diffs are not rendered by default.
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
2-
#include "xrScriptEngine/xrScriptEngine.hpp"
32
#include "xrCore/xrCore.h"
3+
#include "xrScriptEngine/xrScriptEngine.hpp"
44

55
class BindingsDumper
66
{
@@ -13,41 +13,41 @@ class BindingsDumper
1313
};
1414

1515
private:
16-
IWriter *writer;
17-
lua_State *ls;
16+
IWriter* writer;
17+
lua_State* ls;
1818
Options options;
1919
int shiftLevel;
2020
xr_stack<luabind::iterator> functions;
2121
xr_stack<luabind::iterator> classes;
2222
xr_stack<luabind::iterator> namespaces;
23-
xr_map<luabind::string, const char *> operatorSubst;
23+
xr_map<luabind::string, const char*> operatorSubst;
2424

2525
private:
2626
struct SignatureFormatterParams
2727
{
28-
luabind::detail::function_object *Function;
29-
const void *Context;
28+
luabind::detail::function_object* Function;
29+
const void* Context;
3030
};
3131

32-
using SignatureFormatter = void(BindingsDumper::*)(const SignatureFormatterParams &params);
32+
using SignatureFormatter = void (BindingsDumper::*)(const SignatureFormatterParams& params);
3333

3434
int GetIdentSize() const;
35-
void Print(const char *s);
36-
void Print(const char *s, int len);
37-
void Printf(const char *format, ...);
38-
void PrintIndented(const char *s);
39-
void PrintfIndented(const char *format, ...);
40-
void PrintFunction(SignatureFormatter formatter, const void *fcontext = nullptr);
41-
void FormatStaticFunction(const SignatureFormatterParams &params);
35+
void Print(const char* s);
36+
void Print(const char* s, int len);
37+
void Printf(const char* format, ...);
38+
void PrintIndented(const char* s);
39+
void PrintfIndented(const char* format, ...);
40+
void PrintFunction(SignatureFormatter formatter, const void* fcontext = nullptr);
41+
void FormatStaticFunction(const SignatureFormatterParams& params);
4242
void PrintStaticFunction();
43-
void FormatMemberFunction(const SignatureFormatterParams &params);
43+
void FormatMemberFunction(const SignatureFormatterParams& params);
4444
void PrintMemberFunction(const char* className);
4545
void PrintFunction();
46-
void PrintIntConstant(const char *name, int value);
46+
void PrintIntConstant(const char* name, int value);
4747
void PrintClass();
48-
void PrintNamespace(luabind::object &namesp);
49-
48+
void PrintNamespace(luabind::object& namesp);
49+
5050
public:
5151
BindingsDumper();
52-
void Dump(lua_State *luaState, IWriter *outStream, const Options &opt);
52+
void Dump(lua_State* luaState, IWriter* outStream, const Options& opt);
5353
};

src/xrScriptEngine/DebugMacros.hpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,33 @@
22
#include "xrCore/xrCore.h"
33

44
#if XRAY_EXCEPTIONS
5-
#define THROW(expr)\
6-
do {\
7-
if (!(expr))\
8-
{\
9-
string4096 assertionInfo;\
10-
xrDebug::GatherInfo(assertionInfo, DEBUG_INFO, #expr, nullptr, nullptr, nullptr);\
11-
throw assertionInfo;\
12-
}\
13-
} while (false)
14-
#define THROW2(expr, msg0)\
15-
do {\
16-
if (!(expr))\
17-
{\
18-
string4096 assertionInfo;\
19-
xrDebug::GatherInfo(assertionInfo, DEBUG_INFO, #expr, msg0, nullptr, nullptr);\
20-
throw assertionInfo;\
21-
}\
22-
} while (false)
23-
#define THROW3(expr, msg0, msg1)\
24-
do {\
25-
if (!(expr))\
26-
{\
27-
string4096 assertionInfo;\
28-
xrDebug::GatherInfo(assertionInfo, DEBUG_INFO, #expr, msg0, msg1, nullptr);\
29-
throw assertionInfo;\
30-
}\
31-
} while (false)
5+
#define THROW(expr) \
6+
do \
7+
{ \
8+
if (!(expr)) { \
9+
string4096 assertionInfo; \
10+
xrDebug::GatherInfo(assertionInfo, DEBUG_INFO, #expr, nullptr, nullptr, nullptr); \
11+
throw assertionInfo; \
12+
} \
13+
} while (false)
14+
#define THROW2(expr, msg0) \
15+
do \
16+
{ \
17+
if (!(expr)) { \
18+
string4096 assertionInfo; \
19+
xrDebug::GatherInfo(assertionInfo, DEBUG_INFO, #expr, msg0, nullptr, nullptr); \
20+
throw assertionInfo; \
21+
} \
22+
} while (false)
23+
#define THROW3(expr, msg0, msg1) \
24+
do \
25+
{ \
26+
if (!(expr)) { \
27+
string4096 assertionInfo; \
28+
xrDebug::GatherInfo(assertionInfo, DEBUG_INFO, #expr, msg0, msg1, nullptr); \
29+
throw assertionInfo; \
30+
} \
31+
} while (false)
3232
#else
3333
#define THROW VERIFY
3434
#define THROW2 VERIFY2

src/xrScriptEngine/Functor.hpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22

3-
#include "xrScriptEngine/xrScriptEngine.hpp"
4-
#include <type_traits>
53
#include <luabind/detail/format_signature.hpp>
4+
#include <type_traits>
5+
#include "xrScriptEngine/xrScriptEngine.hpp"
66

77
namespace luabind
88
{
@@ -11,21 +11,20 @@ class functor : public adl::object
1111
{
1212
public:
1313
functor() {}
14-
functor(const adl::object &obj) : adl::object(obj) {}
15-
14+
functor(const adl::object& obj) : adl::object(obj) {}
1615
template <typename... Args>
17-
TResult operator()(Args &&...args) const
16+
TResult operator()(Args&&... args) const
1817
{
19-
auto obj = static_cast<const adl::object *>(this);
18+
auto obj = static_cast<const adl::object*>(this);
2019
return call_function<TResult, policy_list<Policies...>>(*obj, std::forward<Args>(args)...);
2120
}
2221
};
2322

2423
template <>
2524
template <typename... Args>
26-
void functor<void>::operator()(Args &&...args) const
25+
void functor<void>::operator()(Args&&... args) const
2726
{
28-
auto obj = static_cast<const adl::object *>(this);
27+
auto obj = static_cast<const adl::object*>(this);
2928
call_function<void, policy_list<>>(*obj, std::forward<Args>(args)...);
3029
}
3130

@@ -34,7 +33,7 @@ namespace detail
3433
template <typename T>
3534
struct type_to_string<functor<T>>
3635
{
37-
static void get(lua_State *L)
36+
static void get(lua_State* L)
3837
{
3938
lua_pushstring(L, "function<");
4039
type_to_string<T>::get(L);
@@ -47,25 +46,27 @@ struct type_to_string<functor<T>>
4746
template <typename T>
4847
struct default_converter<functor<T>> : native_converter_base<functor<T>>
4948
{
50-
static int compute_score(lua_State *luaState, int index)
51-
{ return lua_isfunction(luaState, index) || lua_isnil(luaState, index) ? 0 : no_match; }
49+
static int compute_score(lua_State* luaState, int index)
50+
{
51+
return lua_isfunction(luaState, index) || lua_isnil(luaState, index) ? 0 : no_match;
52+
}
5253

53-
static functor<T> to_cpp_deferred(lua_State *luaState, int index)
54+
static functor<T> to_cpp_deferred(lua_State* luaState, int index)
5455
{
55-
if (lua_isnil(luaState, index))
56-
return functor<T>();
56+
if (lua_isnil(luaState, index)) return functor<T>();
5757
return object(from_stack(luaState, index));
5858
}
5959

60-
static void to_lua_deferred(lua_State *luaState, functor<T> const& value)
61-
{ value.push(luaState); }
60+
static void to_lua_deferred(lua_State* luaState, functor<T> const& value) { value.push(luaState); }
6261
};
6362

6463
template <typename T>
6564
struct default_converter<const functor<T>> : default_converter<functor<T>>
66-
{};
65+
{
66+
};
6767

6868
template <typename T>
69-
struct default_converter<const functor<T> &> : default_converter<functor<T>>
70-
{};
69+
struct default_converter<const functor<T>&> : default_converter<functor<T>>
70+
{
71+
};
7172
}

src/xrScriptEngine/LuaStudio/Backend/Backend.hpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,16 @@ enum icon_type
4747
struct DECLSPEC_NOVTABLE backend
4848
{
4949
public:
50-
virtual void CS_LUA_STUDIO_BACKEND_CALL type_to_string(char *buffer, unsigned int size, lua_State *state, int index, bool &use_in_description) = 0;
51-
virtual void CS_LUA_STUDIO_BACKEND_CALL value_to_string(char *buffer, unsigned int size, lua_State *state, int index, icon_type &icon_type, bool full_description) = 0;
50+
virtual void CS_LUA_STUDIO_BACKEND_CALL type_to_string(
51+
char* buffer, unsigned int size, lua_State* state, int index, bool& use_in_description) = 0;
52+
virtual void CS_LUA_STUDIO_BACKEND_CALL value_to_string(
53+
char* buffer, unsigned int size, lua_State* state, int index, icon_type& icon_type, bool full_description) = 0;
5254
};
5355

5456
struct DECLSPEC_NOVTABLE value_to_expand
5557
{
56-
virtual void CS_LUA_STUDIO_BACKEND_CALL add_value(char const *id, char const *type, char const *value, icon_type icon_type) = 0;
58+
virtual void CS_LUA_STUDIO_BACKEND_CALL add_value(
59+
char const* id, char const* type, char const* value, icon_type icon_type) = 0;
5760
};
58-
} // namespace lua_studio
59-
} // namespace cs
61+
} // namespace lua_studio
62+
} // namespace cs

0 commit comments

Comments
 (0)