mirror of
https://github.com/asmjit/asmjit
synced 2026-06-08 13:13:30 +00:00
b56f4176cb
* Denested src folder to root, renamed testing to asmjit-testing
* Refactored how headers are included into <asmjit/...> form. This
is necessary as compilers would never simplify a path once a ..
appears in include directory - then paths such as ../core/../core
appeared in asserts, which was ugly
* Moved support utilities into asmjit/support/... (still included
by asmjit/core.h for convenience and compatibility)
* Added CMakePresets.json for making it easy to develop AsmJit
* Reworked CMakeLists to be shorter and use CMake option(),
etc... This simplifies it and makes it using more standard
features
* ASMJIT_EMBED now creates asmjit_embed INTERFACE library,
which is accessible via asmjit::asmjit target - this simplifies
embedding and makes it the same as library targets from a CMake
perspective
* Removed ASMJIT_DEPS - this is now provided by cmake target
aliases - 'asmjit::asmjit' so users should not need this variable
* Changed meaning of ASMJIT_LIBS - this now contains only AsmJit
dependencies without asmjit::asmjit target alias. Don't rely on
ASMJIT_LIBS anymore as it's only used internally
* Removed ASMJIT_NO_DEPRECATED option - AsmJit is not going
to provide controllable deprecations in the future
* Removed ASMJIT_NO_VALIDATION in favor of ASMJIT_NO_INTROSPECTION,
which now controls query, features, and validation API presence
* Removed ASMJIT_DIR option - it was never really needed
* Removed AMX_TRANSPOSE feature from instruction database (X86).
Intel has removed it as well, so it's a feature that won't
be siliconized
80 lines
1.6 KiB
C++
80 lines
1.6 KiB
C++
// This file is part of AsmJit project <https://asmjit.com>
|
|
//
|
|
// See <asmjit/core.h> or LICENSE.md for license and copyright information
|
|
// SPDX-License-Identifier: Zlib
|
|
|
|
#include <asmjit/core/api-build_p.h>
|
|
#ifndef ASMJIT_NO_LOGGING
|
|
|
|
#include <asmjit/core/logger.h>
|
|
#include <asmjit/core/string.h>
|
|
#include <asmjit/support/support.h>
|
|
|
|
ASMJIT_BEGIN_NAMESPACE
|
|
|
|
// Logger - Implementation
|
|
// =======================
|
|
|
|
Logger::Logger() noexcept
|
|
: _options() {}
|
|
Logger::~Logger() noexcept {}
|
|
|
|
// [[pure virtual]]
|
|
Error Logger::_log(const char* data, size_t size) noexcept {
|
|
Support::maybe_unused(data, size);
|
|
|
|
// Do not error in this case - the logger would just sink to /dev/null.
|
|
return Error::kOk;
|
|
}
|
|
|
|
Error Logger::logf(const char* fmt, ...) noexcept {
|
|
Error err;
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
err = logv(fmt, ap);
|
|
va_end(ap);
|
|
|
|
return err;
|
|
}
|
|
|
|
Error Logger::logv(const char* fmt, va_list ap) noexcept {
|
|
StringTmp<2048> sb;
|
|
ASMJIT_PROPAGATE(sb.append_vformat(fmt, ap));
|
|
return log(sb);
|
|
}
|
|
|
|
// FileLogger - Implementation
|
|
// ===========================
|
|
|
|
FileLogger::FileLogger(FILE* file) noexcept
|
|
: _file(file) {}
|
|
FileLogger::~FileLogger() noexcept {}
|
|
|
|
Error FileLogger::_log(const char* data, size_t size) noexcept {
|
|
if (!_file) {
|
|
return Error::kOk;
|
|
}
|
|
|
|
if (size == SIZE_MAX) {
|
|
size = strlen(data);
|
|
}
|
|
|
|
fwrite(data, 1, size, _file);
|
|
return Error::kOk;
|
|
}
|
|
|
|
// StringLogger - Implementation
|
|
// =============================
|
|
|
|
StringLogger::StringLogger() noexcept {}
|
|
StringLogger::~StringLogger() noexcept {}
|
|
|
|
Error StringLogger::_log(const char* data, size_t size) noexcept {
|
|
return _content.append(data, size);
|
|
}
|
|
|
|
ASMJIT_END_NAMESPACE
|
|
|
|
#endif
|