Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Meta] POC: introduce clang-format #1203

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
BasedOnStyle: LLVM
UseTab: Always
TabWidth: 4
IndentWidth: 4
ColumnLimit: 160
SortIncludes: Never
---
Language: Cpp
Standard: c++11
70 changes: 27 additions & 43 deletions code/Ratl/ratl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "../qcommon/q_shared.h"

#if !defined(RATL_COMMON_INC)
#include "ratl_common.h"
#include "ratl_common.h"
#endif

#if 0
Expand All @@ -43,85 +43,69 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#endif

#if !defined(CTYPE_H_INC)
#include <ctype.h>
#define CTYPE_H_INC
#include <ctype.h>
#define CTYPE_H_INC
#endif

#if !defined(STDARG_H_INC)
#include <stdarg.h>
#define STDARG_H_INC
#include <stdarg.h>
#define STDARG_H_INC
#endif

#if !defined(STDIO_H_INC)
#include <stdio.h>
#define STDIO_H_INC
#include <stdio.h>
#define STDIO_H_INC
#endif


#if !defined(RUFL_HFILE_INC)
#include "../Rufl/hfile.h"
#include "../Rufl/hfile.h"
#endif

void (*ratl::ratl_base::OutputPrint)(const char *) = 0;

void (*ratl::ratl_base::OutputPrint)(const char*) = 0;



namespace ratl
{
namespace ratl {

#ifdef _DEBUG
int HandleSaltValue=1027; //this is used in debug for global uniqueness of handles
int FoolTheOptimizer=5; //this is used to make sure certain things aren't optimized out
int HandleSaltValue = 1027; // this is used in debug for global uniqueness of handles
int FoolTheOptimizer = 5; // this is used to make sure certain things aren't optimized out
#endif

void ratl_base::save(hfile &file) {}

void ratl_base::save(hfile& file)
{
}

void ratl_base::load(hfile& file)
{
}
void ratl_base::load(hfile &file) {}

////////////////////////////////////////////////////////////////////////////////////////
// A Profile Print Function
////////////////////////////////////////////////////////////////////////////////////////
#if !defined(FINAL_BUILD)
void ratl_base::ProfilePrint(const char * format, ...)
{
static char string[2][1024]; // in case this is called by nested functions
static int index = 0;
static char nFormat[300];
char* buf;
void ratl_base::ProfilePrint(const char *format, ...) {
static char string[2][1024]; // in case this is called by nested functions
static int index = 0;
static char nFormat[300];
char *buf;

// Tack On The Standard Format Around The Given Format
//-----------------------------------------------------
sprintf(nFormat, "[PROFILE] %s\n", format);


// Resolve Remaining Elipsis Parameters Into Newly Formated String
//-----------------------------------------------------------------
buf = string[index & 1];
index++;

va_list argptr;
va_start (argptr, format);
vsprintf (buf, nFormat, argptr);
va_end (argptr);
va_list argptr;
va_start(argptr, format);
vsprintf(buf, nFormat, argptr);
va_end(argptr);

// Print It To Debug Output Console
//----------------------------------
if (OutputPrint!=0)
{
void (*OutputPrintFcn)(const char* text) = (void (*)(const char*))OutputPrint;
if (OutputPrint != 0) {
void (*OutputPrintFcn)(const char *text) = (void (*)(const char *))OutputPrint;
OutputPrintFcn(buf);
}
}
#else
void ratl_base::ProfilePrint(const char * format, ...)
{
}
void ratl_base::ProfilePrint(const char *format, ...) {}
#endif
}

} // namespace ratl
Loading
Loading