commit x64 compilation from lulu cause the other branch dont seems to compile properly at home

This commit is contained in:
2026-07-17 16:08:20 +02:00
parent c0f3eeb00d
commit 0efa4ee6f7
625 changed files with 117283 additions and 4426 deletions

View File

@ -0,0 +1,39 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#include <stdio.h>
#include "log/file_log.h"
#include "filesystem/filesystem.h"
#include "platform.h"
using namespace GS;
//------------------------------------------------------------------------------
void FileLog::NewLog(const char *log, char entry_level)
{
if (FILE *f = fopen(path, initial_write ? "w" : "a"))
{
initial_write = false;
if (do_timestamp)
{
String timestamp = Platform::Get().GetTime().toString() + ": ";
fwrite(timestamp.c_str(), 1, timestamp.Len(), f);
}
fwrite(log, 1, String::strlen(log), f);
fclose(f);
}
}
FileLog::FileLog(const char *_path, bool _do_timestamp) : path(_path), do_timestamp(_do_timestamp)
{
initial_write = true;
FILE *f = fopen(path, "w");
if(f)
fclose(f);
}
//------------------------------------------------------------------------------

View File

@ -0,0 +1,160 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#include <cstdio>
#include <cstring>
#include <iostream>
#include "log/log.h"
#include "nstring/nstring.h"
#include "thread/mutex.h"
#include "platform_config.h"
#include "alloc/ialloc.h"
using namespace GS;
template<> LogSystem *Singleton <LogSystem> ::i = NULL;
//------------------------------------------------------------------------------
LogSystem::LogSystem()
{ SetLog(); }
void LogSystem::SetLog(Log *l)
{
static Log s_log;
log = l ? l : &s_log;
}
Log &LogSystem::GetLog()
{ return *log; }
//------------------------------------------------------------------------------
#if __PLATFORM_LOG_SUPPORT__
//------------------------------------------------------------------------------
void Log::NewLog(const char *log, char)
{
// std::cout << log;
}
void Log::LogProcessed()
{
full_a[0] = 0;
full_b[0] = 0;
}
//------------------------------------------------------------------------------
#define _FORMAT_LOG(__F__, __V__) \
{\
Threading::MutexLock lock(mutex);\
if (a)\
{\
_snprintf(b, LOG_LINE_MAX_LEN - 1, __F__, a, __V__);\
char *swp = a; a = b; b = swp;\
}\
return *this;\
}
//------------------------------------------------------------------------------
Log &Log::operator << (const char v)
{ _FORMAT_LOG("%s%d", v) }
Log &Log::operator << (const short v)
{ _FORMAT_LOG("%s%d", v) }
Log &Log::operator << (const int v)
{ _FORMAT_LOG("%s%d", v) }
Log &Log::operator << (const uchar v)
{ _FORMAT_LOG("%s%d", v) }
Log &Log::operator << (const ushort v)
{ _FORMAT_LOG("%s%d", v) }
Log &Log::operator << (const uint v)
{ _FORMAT_LOG("%s%d", (int)v) }
Log &Log::operator << (const size_t v)
{ _FORMAT_LOG("%s%d", v) }
Log &Log::operator << (const float v)
{ _FORMAT_LOG("%s%.3f", v) }
Log &Log::operator << (const bool v)
{ _FORMAT_LOG("%s%s", v ? "True" : "False") }
Log &Log::operator << (const void *v)
{ _FORMAT_LOG("%s0x%p", v) }
Log &Log::operator << (const char *v)
{
if (a && v)
{
Threading::MutexLock lock(mutex);
_snprintf(b, LOG_LINE_MAX_LEN - 1, "%s%s", a, v);
char *swp = a; a = b; b = swp;
// Look out for ENDL.
for (const char *p = v; p[0]; ++p)
if (p[0] == '\n')
{
// Compute entry level.
char entry_level = EngineLogStandard;
if ((std::strlen(a) >= 3) && (a[0] == '[') && (a[2] == ']'))
switch (a[1])
{
case '*': entry_level |= EngineLogWarning; break;
case '!': entry_level |= EngineLogError; break;
case 'H': entry_level |= EngineLogHeader; break;
case 'V': entry_level |= EngineLogVerbose; break;
case 'S': entry_level |= EngineLogScript; break;
}
// Process output.
if (entry_level & log_level)
NewLog(a, entry_level);
LogProcessed();
}
}
return *this;
}
Log &Log::operator << (const String &v)
{ return *this << v.toUtf8(); }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
Log::Log()
{
LogProcessed();
a = full_a;
b = full_b;
log_level = (uint)EngineLogAll;
mutex = new Threading::Mutex;
}
Log::~Log()
{
_safe_delete(mutex);
}
//------------------------------------------------------------------------------
#else
//------------------------------------------------------------------------------
void Log::NewLog(const char *, char) {}
void Log::LogProcessed() {}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
Log &Log::operator << (const char) { return *this; }
Log &Log::operator << (const short) { return *this; }
Log &Log::operator << (const int) { return *this; }
Log &Log::operator << (const uchar) { return *this; }
Log &Log::operator << (const ushort) { return *this; }
Log &Log::operator << (const uint) { return *this; }
Log &Log::operator << (const size_t) { return *this; }
Log &Log::operator << (const float) { return *this; }
Log &Log::operator << (const bool) { return *this; }
Log &Log::operator << (const char *) { return *this; }
Log &Log::operator << (const String &) { return *this; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
Log::Log() {}
Log::~Log() {}
//------------------------------------------------------------------------------
#endif

View File

@ -34,7 +34,7 @@ namespace GS {
* __LOG_H__: Header (eg: __LOG_H__ << "Physics entry point.\n")
* __LOG_W__: Warning
* __LOG_E__: Error
* __LOG_E__: Non-maskable
* __LOG_N__: Non-maskable
Standard logs may be output to the __LOG__ stream.
@ -81,9 +81,9 @@ public:
Log &operator << (const uchar);
Log &operator << (const ushort);
Log &operator << (const uint);
#if __PLATFORM_IOS__
Log &operator << (const size_t);
#endif
Log &operator << (const float);
Log &operator << (const bool);
Log &operator << (const void *);
@ -117,7 +117,6 @@ public:
//------------------------------------------------------------------------------
#define __LOG__ GS::LogSystem::Get().GetLog() // Standard
#define __LOG_H__ __LOG__ << "[H] " // Header
#define __LOG_CAM__ __LOG__ << "[WEBCAM] " // Header
#if 0
#define __LOG_W__ __LOG__ << "[*] " << __FUNCTION__ << " (" << __FILE__ << ":" << __LINE__ << ") " // Warning
#define __LOG_E__ __LOG__ << "[!] " << __FUNCTION__ << " (" << __FILE__ << ":" << __LINE__ << ") " // Error
@ -126,6 +125,8 @@ public:
#define __LOG_E__ __LOG__ << "[!] "
#endif
#define __LOG_V__ __LOG__ << "[V] " // Verbose
#define __LOG_SENS__ __LOG__ << "[REALSENSE] " // Verbose
#define __LOG_CAM__ __LOG__ << "[WEBCAM] " // Verbose
#define __LOG_F__ __LOG__ << __FUNCTION__ << ": "
#define __LOG_FUNC__ __LOG_V__ << __FUNCTION__ << "\n";

View File

@ -0,0 +1,18 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#include "log/log_scope.h"
#include "log/log.h"
using namespace GS;
//------------------------------------------------------------------------------
LogScope::LogScope(const char *s, const char *e) : exit(e)
{ __LOG_H__ << s; }
LogScope::~LogScope()
{ __LOG_H__ << exit; }
//------------------------------------------------------------------------------