diff options
author | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
commit | cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch) | |
tree | f647b20e1823f1846af88e832cf82a4a02e96e69 /Tools/ToLuaDoxy | |
parent | Improve clang-format config file, remove automatically enforced code style from contrib guide. (diff) | |
download | cuberite-clang-format-codebase.tar cuberite-clang-format-codebase.tar.gz cuberite-clang-format-codebase.tar.bz2 cuberite-clang-format-codebase.tar.lz cuberite-clang-format-codebase.tar.xz cuberite-clang-format-codebase.tar.zst cuberite-clang-format-codebase.zip |
Diffstat (limited to 'Tools/ToLuaDoxy')
-rw-r--r-- | Tools/ToLuaDoxy/Globals.cpp | 4 | ||||
-rw-r--r-- | Tools/ToLuaDoxy/Globals.h | 64 | ||||
-rw-r--r-- | Tools/ToLuaDoxy/ToLuaDoxy.cpp | 31 |
3 files changed, 45 insertions, 54 deletions
diff --git a/Tools/ToLuaDoxy/Globals.cpp b/Tools/ToLuaDoxy/Globals.cpp index d73265a60..6d1b25cbc 100644 --- a/Tools/ToLuaDoxy/Globals.cpp +++ b/Tools/ToLuaDoxy/Globals.cpp @@ -4,7 +4,3 @@ // Used for precompiled header generation in MSVC #include "Globals.h" - - - - diff --git a/Tools/ToLuaDoxy/Globals.h b/Tools/ToLuaDoxy/Globals.h index 9dc94892a..5e366426d 100644 --- a/Tools/ToLuaDoxy/Globals.h +++ b/Tools/ToLuaDoxy/Globals.h @@ -8,41 +8,41 @@ // OS-dependent stuff: #ifdef _WIN32 - #define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN - #define _WIN32_WINNT 0x501 // We want to target WinXP and higher +#define _WIN32_WINNT 0x501 // We want to target WinXP and higher - #include <Windows.h> - #include <winsock2.h> - #include <Ws2tcpip.h> // IPv6 stuff +#include <Windows.h> +#include <winsock2.h> +#include <Ws2tcpip.h> // IPv6 stuff - // Windows SDK defines min and max macros, messing up with our std::min and std::max usage - #undef min - #undef max +// Windows SDK defines min and max macros, messing up with our std::min and std::max usage +#undef min +#undef max - // Windows SDK defines GetFreeSpace as a constant, probably a Win16 API remnant - #ifdef GetFreeSpace - #undef GetFreeSpace - #endif // GetFreeSpace +// Windows SDK defines GetFreeSpace as a constant, probably a Win16 API remnant +#ifdef GetFreeSpace +#undef GetFreeSpace +#endif // GetFreeSpace #else - #include <sys/types.h> - #include <sys/stat.h> // for mkdir - #include <sys/time.h> - #include <sys/socket.h> - #include <netinet/in.h> - #include <arpa/inet.h> - #include <netdb.h> - #include <time.h> - #include <dirent.h> - #include <errno.h> - #include <iostream> - - #include <cstdio> - #include <cstring> - #include <pthread.h> - #include <semaphore.h> - #include <errno.h> - #include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> // for mkdir +#include <sys/time.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <netdb.h> +#include <time.h> +#include <dirent.h> +#include <errno.h> +#include <iostream> + +#include <cstdio> +#include <cstring> +#include <pthread.h> +#include <semaphore.h> +#include <errno.h> +#include <fcntl.h> #endif @@ -87,7 +87,7 @@ #define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X))) /** Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)") */ -#define KiB * 1024 -#define MiB * 1024 * 1024 +#define KiB *1024 +#define MiB *1024 * 1024 #define ASSERT assert diff --git a/Tools/ToLuaDoxy/ToLuaDoxy.cpp b/Tools/ToLuaDoxy/ToLuaDoxy.cpp index 2a54192a4..e1a864091 100644 --- a/Tools/ToLuaDoxy/ToLuaDoxy.cpp +++ b/Tools/ToLuaDoxy/ToLuaDoxy.cpp @@ -19,19 +19,14 @@ typedef std::vector<AString> AStrings; class cProcessor { -public: + public: cProcessor(const AString & a_FileOut) : - m_Out(a_FileOut.c_str(), std::ios::out), - m_IsInToLua(false), - m_IsInComment(false) + m_Out(a_FileOut.c_str(), std::ios::out), m_IsInToLua(false), m_IsInComment(false) { } - bool IsGood(void) const - { - return !m_Out.fail(); - } + bool IsGood(void) const { return !m_Out.fail(); } void ProcessFile(const AString & a_FileIn) @@ -50,11 +45,11 @@ public: } } -protected: + protected: std::ofstream m_Out; - bool m_IsInToLua; ///< Set to true if inside a tolua_begin .. tolua_end block - bool m_IsInComment; ///< Set to true if previous line has started a multiline comment; only outside tolua blocks - AString m_LastComment; ///< Accumulator for a multiline comment preceding a tolua block + bool m_IsInToLua; ///< Set to true if inside a tolua_begin .. tolua_end block + bool m_IsInComment; ///< Set to true if previous line has started a multiline comment; only outside tolua blocks + AString m_LastComment; ///< Accumulator for a multiline comment preceding a tolua block void PushLine(const AString & a_Line) @@ -129,7 +124,7 @@ protected: m_LastComment.clear(); } } -} ; +}; @@ -188,14 +183,14 @@ void ProcessCFile(const AString & a_CFileIn, const AString & a_CFileOut) int main(int argc, char * argv[]) { AString BaseDir = (argc > 1) ? argv[1] : "."; - AString OutDir = (argc > 2) ? argv[2] : "Out"; + AString OutDir = (argc > 2) ? argv[2] : "Out"; - // Create the output directory: - #ifdef _WIN32 +// Create the output directory: +#ifdef _WIN32 CreateDirectory(OutDir.c_str(), NULL); - #else +#else mkdir(OutDir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO); - #endif +#endif // Parse the package file AStrings CFiles; |