layout: restructure into src/ tests/ android/ scripts/ tools/
- extension/src/{port,platform,codepage} -> src/; native_render -> src/host
(+ dxt, shaders/); libgr2 -> src/gr2; extension/third_party -> third_party
- extension/tests -> tests/port, libgr2/tests -> tests/gr2
- android-native -> android (build.sh, push-client.sh moved in)
- script -> scripts; tools/40250 -> tools/server; oracle -> tools/granny-oracle;
perf tools -> tools/perf
- all build trees under build/ (native, release, android, port-gate)
- xrender:: CMake aliases -> mt::; port-map ledger impl paths rewritten
No code changes. ctest 15/15, port_gate macos+android PASS, port_map check 0 errors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
70710477cf
commit
a46093104c
@@ -0,0 +1,196 @@
|
||||
// Platform skeleton for EterBase/Debug.h (40250 EterBase/Debug.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. Implemented
|
||||
// bodies follow the 40250 non-_DEBUG build (batch 2D: Trace*, TraceError to stderr).
|
||||
#include "EterBase/StdAfx.h"
|
||||
#include "EterBase/Debug.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
#include "EterBase/Timer.h"
|
||||
#include "LogBox.h"
|
||||
#include "TraceErrorObserver.h"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <string>
|
||||
|
||||
const DWORD DEBUG_STRING_MAX_LEN = 1024;
|
||||
|
||||
namespace
|
||||
{
|
||||
TraceErrorObserver g_trace_error_observer = nullptr;
|
||||
}
|
||||
|
||||
void SetTraceErrorObserver(TraceErrorObserver observer)
|
||||
{
|
||||
g_trace_error_observer = observer;
|
||||
}
|
||||
|
||||
auto SetLogLevel(UINT) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto Log(UINT, const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto Logn(UINT, const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto Logf(UINT, const char *, ...) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto Lognf(UINT, const char *, ...) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
void Trace(const char *)
|
||||
{
|
||||
// Non-_DEBUG 40250: written only to the log file (OpenLogFile, not implemented yet).
|
||||
}
|
||||
|
||||
void Tracen(const char *)
|
||||
{
|
||||
// Non-_DEBUG 40250: written only to the log file (OpenLogFile, not implemented yet).
|
||||
}
|
||||
|
||||
void Tracenf(const char *, ...)
|
||||
{
|
||||
// Non-_DEBUG 40250: written only to the log file (OpenLogFile, not implemented yet).
|
||||
}
|
||||
|
||||
void Tracef(const char *, ...)
|
||||
{
|
||||
// Non-_DEBUG 40250: written only to the log file (OpenLogFile, not implemented yet).
|
||||
}
|
||||
|
||||
void TraceError(const char* c_szFormat, ...)
|
||||
{
|
||||
#ifndef _DISTRIBUTE
|
||||
char szBuf[DEBUG_STRING_MAX_LEN+2];
|
||||
|
||||
strncpy(szBuf, "SYSERR: ", DEBUG_STRING_MAX_LEN);
|
||||
int len = strlen(szBuf);
|
||||
|
||||
va_list args;
|
||||
va_start(args, c_szFormat);
|
||||
len = _vsnprintf(szBuf + len, sizeof(szBuf) - (len + 1), c_szFormat, args) + len;
|
||||
va_end(args);
|
||||
|
||||
// PORT: _vsnprintf returns -1 on truncation; 40250 then writes the terminator before the buffer.
|
||||
if (len < 8)
|
||||
len = DEBUG_STRING_MAX_LEN;
|
||||
|
||||
szBuf[len] = '\n';
|
||||
szBuf[len + 1] = '\0';
|
||||
|
||||
time_t ct = time(0);
|
||||
struct tm ctm = *localtime(&ct);
|
||||
|
||||
fprintf(stderr, "%02d%02d %02d:%02d:%05d :: %s",
|
||||
ctm.tm_mon + 1,
|
||||
ctm.tm_mday,
|
||||
ctm.tm_hour,
|
||||
ctm.tm_min,
|
||||
ELTimer_GetMSec() % 60000,
|
||||
szBuf + 8);
|
||||
fflush(stderr);
|
||||
if (g_trace_error_observer)
|
||||
g_trace_error_observer(szBuf + 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
auto TraceErrorWithoutEnter(const char *, ...) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string& log_box_message()
|
||||
{
|
||||
static std::string message;
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& LastLogBoxMessage()
|
||||
{
|
||||
return log_box_message();
|
||||
}
|
||||
|
||||
void ClearLogBoxMessage()
|
||||
{
|
||||
log_box_message().clear();
|
||||
}
|
||||
|
||||
void LogBox(const char * c_szMsg, const char * c_szCaption, HWND)
|
||||
{
|
||||
// 40250 pops a MessageBox on g_PopupHwnd and Tracen()s the text. There is no window here and no
|
||||
// log file yet, so stderr is the whole of it; the text is also kept for the caller (LogBox.h),
|
||||
// because it is the only place a script traceback survives.
|
||||
std::string& message = log_box_message();
|
||||
message = c_szCaption ? c_szCaption : "LOG";
|
||||
message += ": ";
|
||||
message += c_szMsg ? c_szMsg : "";
|
||||
|
||||
fprintf(stderr, "%s\n", message.c_str());
|
||||
fflush(stderr);
|
||||
Tracen(c_szMsg);
|
||||
}
|
||||
|
||||
void LogBoxf(const char * c_szFormat, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, c_szFormat);
|
||||
|
||||
char szBuf[2048];
|
||||
_vsnprintf(szBuf, sizeof(szBuf), c_szFormat, args);
|
||||
va_end(args); // PORT: 40250 leaks the va_list; on this ABI va_end is not optional
|
||||
|
||||
// PORT: _vsnprintf does not terminate on truncation.
|
||||
szBuf[sizeof(szBuf) - 1] = '\0';
|
||||
LogBox(szBuf);
|
||||
}
|
||||
|
||||
auto LogFile(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto LogFilef(const char *, ...) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto OpenConsoleWindow() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CloseConsoleWindow() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto SetupLog() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto OpenLogFile(bool) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CloseLogFile() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
Reference in New Issue
Block a user