mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)
Good-bye LogStream. Long live AK::Format!
This commit is contained in:
parent
423ed53396
commit
ef1e5db1d0
Notes:
sideshowbarker
2024-07-18 21:28:11 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ef1e5db1d06
@ -325,12 +325,6 @@ inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::copy(const void* data, size
|
||||
return ::adopt(*new ByteBufferImpl(data, size));
|
||||
}
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, const ByteBuffer& value)
|
||||
{
|
||||
stream.write((const char*)value.data(), value.size());
|
||||
return stream;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
using AK::ByteBuffer;
|
||||
|
@ -28,8 +28,13 @@
|
||||
#include <AK/GenericLexer.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/kstdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(__serenity__) && !defined(KERNEL)
|
||||
# include <serenity.h>
|
||||
#endif
|
||||
|
||||
#ifdef KERNEL
|
||||
# include <Kernel/Process.h>
|
||||
# include <Kernel/Thread.h>
|
||||
@ -416,12 +421,6 @@ void vformat(StringBuilder& builder, StringView fmtstr, TypeErasedFormatParams p
|
||||
|
||||
vformat_impl(params, fmtbuilder, parser);
|
||||
}
|
||||
void vformat(const LogStream& stream, StringView fmtstr, TypeErasedFormatParams params)
|
||||
{
|
||||
StringBuilder builder;
|
||||
vformat(builder, fmtstr, params);
|
||||
stream << builder.to_string();
|
||||
}
|
||||
|
||||
void StandardFormatter::parse(TypeErasedFormatParams& params, FormatParser& parser)
|
||||
{
|
||||
|
@ -364,7 +364,6 @@ struct Formatter<std::nullptr_t> : Formatter<FlatPtr> {
|
||||
};
|
||||
|
||||
void vformat(StringBuilder&, StringView fmtstr, TypeErasedFormatParams);
|
||||
void vformat(const LogStream& stream, StringView fmtstr, TypeErasedFormatParams);
|
||||
|
||||
#ifndef KERNEL
|
||||
void vout(FILE*, StringView fmtstr, TypeErasedFormatParams, bool newline = false);
|
||||
|
@ -32,12 +32,10 @@ namespace AK {
|
||||
|
||||
class Bitmap;
|
||||
class ByteBuffer;
|
||||
class DebugLogStream;
|
||||
class IPv4Address;
|
||||
class JsonArray;
|
||||
class JsonObject;
|
||||
class JsonValue;
|
||||
class LogStream;
|
||||
class StackInfo;
|
||||
class String;
|
||||
class StringBuilder;
|
||||
@ -143,7 +141,6 @@ using AK::ByteBuffer;
|
||||
using AK::Bytes;
|
||||
using AK::CircularDuplexStream;
|
||||
using AK::CircularQueue;
|
||||
using AK::DebugLogStream;
|
||||
using AK::DoublyLinkedList;
|
||||
using AK::DuplexMemoryStream;
|
||||
using AK::FlyString;
|
||||
@ -158,7 +155,6 @@ using AK::IPv4Address;
|
||||
using AK::JsonArray;
|
||||
using AK::JsonObject;
|
||||
using AK::JsonValue;
|
||||
using AK::LogStream;
|
||||
using AK::NonnullOwnPtr;
|
||||
using AK::NonnullOwnPtrVector;
|
||||
using AK::NonnullRefPtr;
|
||||
|
@ -27,7 +27,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <AK/HashFunctions.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/kmalloc.h>
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/HashTable.h>
|
||||
|
||||
namespace AK {
|
||||
|
@ -27,7 +27,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <AK/Endian.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
@ -143,11 +142,6 @@ struct Traits<IPv4Address> : public GenericTraits<IPv4Address> {
|
||||
static constexpr unsigned hash(const IPv4Address& address) { return int_hash(address.to_u32()); }
|
||||
};
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, const IPv4Address& value)
|
||||
{
|
||||
return stream << value.to_string();
|
||||
}
|
||||
|
||||
template<>
|
||||
struct Formatter<IPv4Address> : Formatter<String> {
|
||||
void format(FormatBuilder& builder, IPv4Address value)
|
||||
|
240
AK/LogStream.cpp
240
AK/LogStream.cpp
@ -1,240 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringView.h>
|
||||
|
||||
#ifdef KERNEL
|
||||
# include <Kernel/Process.h>
|
||||
# include <Kernel/Thread.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const String& value)
|
||||
{
|
||||
stream.write(value.characters(), value.length());
|
||||
return stream;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const FlyString& value)
|
||||
{
|
||||
return stream << value.view();
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const StringView& value)
|
||||
{
|
||||
stream.write(value.characters_without_null_termination(), value.length());
|
||||
return stream;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, int value)
|
||||
{
|
||||
char buffer[32];
|
||||
snprintf(buffer, sizeof(buffer), "%d", value);
|
||||
return stream << buffer;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, long value)
|
||||
{
|
||||
char buffer[32];
|
||||
snprintf(buffer, sizeof(buffer), "%ld", value);
|
||||
return stream << buffer;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, long long value)
|
||||
{
|
||||
char buffer[32];
|
||||
snprintf(buffer, sizeof(buffer), "%lld", value);
|
||||
return stream << buffer;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, unsigned value)
|
||||
{
|
||||
char buffer[32];
|
||||
snprintf(buffer, sizeof(buffer), "%u", value);
|
||||
return stream << buffer;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, unsigned long long value)
|
||||
{
|
||||
char buffer[32];
|
||||
snprintf(buffer, sizeof(buffer), "%llu", value);
|
||||
return stream << buffer;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, unsigned long value)
|
||||
{
|
||||
char buffer[32];
|
||||
snprintf(buffer, sizeof(buffer), "%lu", value);
|
||||
return stream << buffer;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const void* value)
|
||||
{
|
||||
char buffer[32];
|
||||
snprintf(buffer, sizeof(buffer), "%p", value);
|
||||
return stream << buffer;
|
||||
}
|
||||
|
||||
#if defined(__serenity__) && !defined(KERNEL)
|
||||
static TriState got_process_name = TriState::Unknown;
|
||||
static char process_name_buffer[256];
|
||||
#endif
|
||||
|
||||
DebugLogStream dbg()
|
||||
{
|
||||
DebugLogStream stream;
|
||||
|
||||
// FIXME: This logic is redundant with the stuff in Format.cpp.
|
||||
#if defined(__serenity__) && !defined(KERNEL)
|
||||
if (got_process_name == TriState::Unknown) {
|
||||
if (get_process_name(process_name_buffer, sizeof(process_name_buffer)) == 0)
|
||||
got_process_name = TriState::True;
|
||||
else
|
||||
got_process_name = TriState::False;
|
||||
}
|
||||
if (got_process_name == TriState::True)
|
||||
stream << "\033[33;1m" << process_name_buffer << '(' << getpid() << ")\033[0m: ";
|
||||
#endif
|
||||
#if defined(__serenity__) && defined(KERNEL)
|
||||
if (Kernel::Processor::is_initialized() && Kernel::Thread::current())
|
||||
stream << "\033[34;1m[#" << Kernel::Processor::id() << " " << *Kernel::Thread::current() << "]\033[0m: ";
|
||||
else
|
||||
stream << "\033[36;1m[Kernel]\033[0m: ";
|
||||
#endif
|
||||
return stream;
|
||||
}
|
||||
|
||||
#ifdef KERNEL
|
||||
KernelLogStream klog()
|
||||
{
|
||||
KernelLogStream stream;
|
||||
if (Kernel::Processor::is_initialized() && Kernel::Thread::current())
|
||||
stream << "\033[34;1m[#" << Kernel::Processor::id() << " " << *Kernel::Thread::current() << "]\033[0m: ";
|
||||
else
|
||||
stream << "\033[36;1m[Kernel]\033[0m: ";
|
||||
return stream;
|
||||
}
|
||||
#else
|
||||
DebugLogStream klog()
|
||||
{
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
return dbg();
|
||||
# pragma GCC diagnostic pop
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef KERNEL
|
||||
KernelLogStream::~KernelLogStream()
|
||||
{
|
||||
if (!empty()) {
|
||||
char newline = '\n';
|
||||
write(&newline, 1);
|
||||
kernelputstr(reinterpret_cast<char*>(data()), size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
DebugLogStream::~DebugLogStream()
|
||||
{
|
||||
if (!empty() && s_enabled) {
|
||||
char newline = '\n';
|
||||
write(&newline, 1);
|
||||
dbgputstr(reinterpret_cast<char*>(data()), size());
|
||||
}
|
||||
}
|
||||
|
||||
void DebugLogStream::set_enabled(bool enabled)
|
||||
{
|
||||
s_enabled = enabled;
|
||||
}
|
||||
|
||||
bool DebugLogStream::is_enabled()
|
||||
{
|
||||
return s_enabled;
|
||||
}
|
||||
|
||||
bool DebugLogStream::s_enabled = true;
|
||||
|
||||
#ifndef KERNEL
|
||||
const LogStream& operator<<(const LogStream& stream, double value)
|
||||
{
|
||||
return stream << String::format("%.4f", value);
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, float value)
|
||||
{
|
||||
return stream << String::format("%.4f", value);
|
||||
}
|
||||
#endif
|
||||
|
||||
void dump_bytes(ReadonlyBytes bytes)
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
u8 buffered_byte = 0;
|
||||
size_t nrepeat = 0;
|
||||
const char* prefix = "";
|
||||
|
||||
auto flush = [&]() {
|
||||
if (nrepeat > 0) {
|
||||
if (nrepeat == 1)
|
||||
builder.appendff("{}{:#02x}", prefix, static_cast<int>(buffered_byte));
|
||||
else
|
||||
builder.appendff("{}{} * {:#02x}", prefix, nrepeat, static_cast<int>(buffered_byte));
|
||||
|
||||
nrepeat = 0;
|
||||
prefix = ", ";
|
||||
}
|
||||
};
|
||||
|
||||
builder.append("{ ");
|
||||
|
||||
for (auto byte : bytes) {
|
||||
if (nrepeat > 0) {
|
||||
if (byte != buffered_byte)
|
||||
flush();
|
||||
|
||||
buffered_byte = byte;
|
||||
nrepeat++;
|
||||
} else {
|
||||
buffered_byte = byte;
|
||||
nrepeat = 1;
|
||||
}
|
||||
}
|
||||
flush();
|
||||
|
||||
builder.append(" }");
|
||||
|
||||
dbgln("{}", builder.string_view());
|
||||
}
|
||||
|
||||
}
|
196
AK/LogStream.h
196
AK/LogStream.h
@ -1,196 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/kmalloc.h>
|
||||
#include <AK/kstdio.h>
|
||||
|
||||
#if !defined(KERNEL)
|
||||
# include <AK/ScopedValueRollback.h>
|
||||
# include <AK/StringView.h>
|
||||
# include <errno.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
||||
class LogStream {
|
||||
public:
|
||||
LogStream()
|
||||
#if !defined(KERNEL)
|
||||
: m_errno_restorer(errno)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
virtual ~LogStream() = default;
|
||||
|
||||
virtual void write(const char*, int) const = 0;
|
||||
|
||||
private:
|
||||
#if !defined(KERNEL)
|
||||
ScopedValueRollback<int> m_errno_restorer;
|
||||
#endif
|
||||
};
|
||||
|
||||
class BufferedLogStream : public LogStream {
|
||||
mutable size_t m_size { 0 };
|
||||
mutable size_t m_capacity { 128 };
|
||||
union {
|
||||
mutable u8* m_buffer { nullptr };
|
||||
mutable u8 m_local_buffer[128];
|
||||
} u;
|
||||
|
||||
void grow(size_t bytes_needed) const
|
||||
{
|
||||
size_t new_capacity = (m_size + bytes_needed + 0x7F) & ~0x7F;
|
||||
u8* new_data = static_cast<u8*>(kmalloc(new_capacity));
|
||||
if (m_capacity <= sizeof(u.m_local_buffer)) {
|
||||
__builtin_memcpy(new_data, u.m_local_buffer, m_size);
|
||||
} else if (u.m_buffer) {
|
||||
__builtin_memcpy(new_data, u.m_buffer, m_size);
|
||||
kfree(u.m_buffer);
|
||||
}
|
||||
u.m_buffer = new_data;
|
||||
m_capacity = new_capacity;
|
||||
}
|
||||
|
||||
protected:
|
||||
u8* data() const
|
||||
{
|
||||
if (m_capacity <= sizeof(u.m_local_buffer))
|
||||
return u.m_local_buffer;
|
||||
return u.m_buffer;
|
||||
}
|
||||
|
||||
size_t size() const { return m_size; }
|
||||
|
||||
bool empty() const { return m_size == 0; }
|
||||
|
||||
public:
|
||||
BufferedLogStream() = default;
|
||||
|
||||
virtual ~BufferedLogStream() override
|
||||
{
|
||||
if (m_capacity > sizeof(u.m_local_buffer))
|
||||
kfree(u.m_buffer);
|
||||
}
|
||||
|
||||
virtual void write(const char* str, int len) const override
|
||||
{
|
||||
size_t new_size = m_size + len;
|
||||
if (new_size > m_capacity)
|
||||
grow(len);
|
||||
__builtin_memcpy(data() + m_size, str, len);
|
||||
m_size = new_size;
|
||||
}
|
||||
};
|
||||
|
||||
class DebugLogStream final : public BufferedLogStream {
|
||||
public:
|
||||
DebugLogStream() = default;
|
||||
virtual ~DebugLogStream() override;
|
||||
|
||||
// DebugLogStream only checks `enabled` and possibly generates output while the destructor runs.
|
||||
static void set_enabled(bool);
|
||||
static bool is_enabled();
|
||||
|
||||
private:
|
||||
static bool s_enabled;
|
||||
};
|
||||
|
||||
#ifdef KERNEL
|
||||
class KernelLogStream final : public BufferedLogStream {
|
||||
public:
|
||||
KernelLogStream() = default;
|
||||
virtual ~KernelLogStream() override;
|
||||
};
|
||||
#endif
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, const char* value)
|
||||
{
|
||||
if (!value)
|
||||
return stream << "(null)";
|
||||
int length = 0;
|
||||
const char* p = value;
|
||||
while (*(p++))
|
||||
++length;
|
||||
stream.write(value, length);
|
||||
return stream;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream&, const FlyString&);
|
||||
const LogStream& operator<<(const LogStream&, const String&);
|
||||
const LogStream& operator<<(const LogStream&, const StringView&);
|
||||
const LogStream& operator<<(const LogStream&, int);
|
||||
const LogStream& operator<<(const LogStream&, long);
|
||||
const LogStream& operator<<(const LogStream&, unsigned);
|
||||
const LogStream& operator<<(const LogStream&, long long);
|
||||
const LogStream& operator<<(const LogStream&, unsigned long);
|
||||
const LogStream& operator<<(const LogStream&, unsigned long long);
|
||||
|
||||
#if !defined(KERNEL)
|
||||
const LogStream& operator<<(const LogStream&, double);
|
||||
const LogStream& operator<<(const LogStream&, float);
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
const LogStream& operator<<(const LogStream& stream, Span<T> span)
|
||||
{
|
||||
return stream << "{ " << span.data() << ", " << span.size() << " }";
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream&, const void*);
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, char value)
|
||||
{
|
||||
stream.write(&value, 1);
|
||||
return stream;
|
||||
}
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, bool value)
|
||||
{
|
||||
return stream << (value ? "true" : "false");
|
||||
}
|
||||
|
||||
[[deprecated("Plase use dbgln in AK/Format.h instead.")]] DebugLogStream dbg();
|
||||
|
||||
#ifdef KERNEL
|
||||
KernelLogStream klog();
|
||||
#else
|
||||
DebugLogStream klog();
|
||||
#endif
|
||||
|
||||
void dump_bytes(ReadonlyBytes);
|
||||
|
||||
}
|
||||
|
||||
using AK::dbg;
|
||||
using AK::klog;
|
||||
using AK::LogStream;
|
@ -27,6 +27,7 @@
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/String.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -27,7 +27,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Traits.h>
|
||||
@ -183,12 +183,6 @@ struct Traits<NonnullOwnPtr<T>> : public GenericTraits<NonnullOwnPtr<T>> {
|
||||
static bool equals(const NonnullOwnPtr<T>& a, const NonnullOwnPtr<T>& b) { return a.ptr() == b.ptr(); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline const LogStream& operator<<(const LogStream& stream, const NonnullOwnPtr<T>& value)
|
||||
{
|
||||
return stream << value.ptr();
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
inline void swap(NonnullOwnPtr<T>& a, NonnullOwnPtr<U>& b)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Atomic.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Types.h>
|
||||
#ifdef KERNEL
|
||||
# include <Kernel/Arch/i386/CPU.h>
|
||||
@ -339,12 +339,6 @@ inline NonnullRefPtr<T> adopt(T& object)
|
||||
return NonnullRefPtr<T>(NonnullRefPtr<T>::Adopt, object);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline const LogStream& operator<<(const LogStream& stream, const NonnullRefPtr<T>& value)
|
||||
{
|
||||
return stream << value.ptr();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct Formatter<NonnullRefPtr<T>> : Formatter<const T*> {
|
||||
void format(FormatBuilder& builder, const NonnullRefPtr<T>& value)
|
||||
|
@ -27,6 +27,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace AK {
|
||||
|
@ -218,12 +218,6 @@ struct Traits<OwnPtr<T>> : public GenericTraits<OwnPtr<T>> {
|
||||
static bool equals(const OwnPtr<T>& a, const OwnPtr<T>& b) { return a.ptr() == b.ptr(); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline const LogStream& operator<<(const LogStream& stream, const OwnPtr<T>& value)
|
||||
{
|
||||
return stream << value.ptr();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
using AK::OwnPtr;
|
||||
|
@ -61,6 +61,7 @@
|
||||
#define FLATTEN [[gnu::flatten]]
|
||||
|
||||
#ifndef __serenity__
|
||||
# include <unistd.h>
|
||||
# define PAGE_SIZE sysconf(_SC_PAGESIZE)
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AK/Atomic.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Traits.h>
|
||||
@ -461,12 +461,6 @@ private:
|
||||
mutable Atomic<FlatPtr> m_bits { PtrTraits::default_null_value };
|
||||
};
|
||||
|
||||
template<typename T, typename PtrTraits = RefPtrTraits<T>>
|
||||
inline const LogStream& operator<<(const LogStream& stream, const RefPtr<T, PtrTraits>& value)
|
||||
{
|
||||
return stream << value.ptr();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct Formatter<RefPtr<T>> : Formatter<const T*> {
|
||||
void format(FormatBuilder& builder, const RefPtr<T>& value)
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Checked.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Time.h>
|
||||
|
||||
// Make a reasonable guess as to which timespec/timeval definition to use.
|
||||
|
5
AK/URL.h
5
AK/URL.h
@ -105,11 +105,6 @@ private:
|
||||
String m_data_payload;
|
||||
};
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, const URL& value)
|
||||
{
|
||||
return stream << value.to_string();
|
||||
}
|
||||
|
||||
template<>
|
||||
struct Formatter<URL> : Formatter<StringView> {
|
||||
void format(FormatBuilder& builder, const URL& value)
|
||||
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Utf8View.h>
|
||||
|
||||
namespace AK {
|
||||
|
12
AK/WeakPtr.h
12
AK/WeakPtr.h
@ -26,7 +26,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Weakable.h>
|
||||
|
||||
namespace AK {
|
||||
@ -236,17 +235,6 @@ inline WeakPtr<U> Weakable<T>::make_weak_ptr() const
|
||||
return weak_ptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline const LogStream& operator<<(const LogStream& stream, const WeakPtr<T>& value)
|
||||
{
|
||||
#ifdef KERNEL
|
||||
auto ref = value.strong_ref();
|
||||
return stream << ref.ptr();
|
||||
#else
|
||||
return stream << value.ptr();
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct Formatter<WeakPtr<T>> : Formatter<const T*> {
|
||||
void format(FormatBuilder& builder, const WeakPtr<T>& value)
|
||||
|
@ -33,21 +33,20 @@
|
||||
# include <AK/Types.h>
|
||||
# include <stdarg.h>
|
||||
extern "C" {
|
||||
int dbgputstr(const char*, ssize_t);
|
||||
void dbgputstr(const char*, size_t);
|
||||
int sprintf(char* buf, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int snprintf(char* buffer, size_t, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||
}
|
||||
# endif
|
||||
#else
|
||||
# include <stdio.h>
|
||||
inline int dbgputstr(const char* characters, ssize_t length)
|
||||
inline void dbgputstr(const char* characters, size_t length)
|
||||
{
|
||||
fwrite(characters, 1, length, stderr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
template<size_t N>
|
||||
inline int dbgputstr(const char (&array)[N])
|
||||
inline void dbgputstr(const char (&array)[N])
|
||||
{
|
||||
return ::dbgputstr(array, N);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/ACPI/Parser.h>
|
||||
#include <Kernel/Arch/PC/BIOS.h>
|
||||
@ -32,7 +33,6 @@
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/PCI/Access.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/TypedMapping.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -243,7 +243,6 @@ set(AK_SOURCES
|
||||
../AK/JsonParser.cpp
|
||||
../AK/JsonValue.cpp
|
||||
../AK/LexicalPath.cpp
|
||||
../AK/LogStream.cpp
|
||||
../AK/String.cpp
|
||||
../AK/StringBuilder.cpp
|
||||
../AK/StringImpl.cpp
|
||||
|
@ -24,6 +24,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Types.h>
|
||||
@ -31,7 +32,6 @@
|
||||
#include <Kernel/DMI.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
#include <Kernel/VM/MappedROM.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/TypedMapping.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <AK/Checked.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <Kernel/Debug.h>
|
||||
#include <Kernel/Devices/BXVGADevice.h>
|
||||
|
@ -72,12 +72,6 @@ private:
|
||||
InodeIndex m_index { 0 };
|
||||
};
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, const InodeIdentifier& value)
|
||||
{
|
||||
stream << value.fsid() << ':' << value.index().value();
|
||||
return stream;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template<>
|
||||
|
@ -27,7 +27,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Arch/i386/CPU.h>
|
||||
@ -157,11 +156,6 @@ private:
|
||||
u16 m_address { 0 };
|
||||
};
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, IOAddress value)
|
||||
{
|
||||
return stream << "IO " << String::formatted("{:x}", value.get());
|
||||
}
|
||||
|
||||
template<>
|
||||
struct AK::Formatter<IOAddress> : AK::Formatter<FormatString> {
|
||||
void format(FormatBuilder& builder, IOAddress value)
|
||||
|
@ -38,7 +38,6 @@
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Memory.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
@ -175,9 +174,4 @@ private:
|
||||
RefPtr<KBufferImpl> m_impl;
|
||||
};
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, const KBuffer& value)
|
||||
{
|
||||
return stream << StringView(value.data(), value.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Format.h>
|
||||
#include <Kernel/Modules/module_syms.h>
|
||||
|
||||
extern "C" const char module_name[] = "TestModule";
|
||||
|
@ -123,7 +123,6 @@ private:
|
||||
};
|
||||
|
||||
static_assert(sizeof(IPv4Packet) == 20);
|
||||
const LogStream& operator<<(const LogStream& stream, const IPv4Packet& packet);
|
||||
|
||||
inline NetworkOrdered<u16> internet_checksum(const void* ptr, size_t count)
|
||||
{
|
||||
|
@ -27,7 +27,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
@ -84,10 +83,7 @@ struct ID {
|
||||
return vendor_id != other.vendor_id || device_id != other.device_id;
|
||||
}
|
||||
};
|
||||
inline const LogStream& operator<<(const LogStream& stream, const ID value)
|
||||
{
|
||||
return stream << String::formatted("({:04x}:{:04x})", value.vendor_id, value.device_id);
|
||||
}
|
||||
|
||||
struct Address {
|
||||
public:
|
||||
Address() = default;
|
||||
@ -141,11 +137,6 @@ protected:
|
||||
u8 m_function { 0 };
|
||||
};
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, const Address value)
|
||||
{
|
||||
return stream << "PCI [" << String::formatted("{:04x}:{:02x}:{:02x}:{:02x}", value.seg(), value.bus(), value.device(), value.function()) << "]";
|
||||
}
|
||||
|
||||
struct ChangeableAddress : public Address {
|
||||
ChangeableAddress()
|
||||
: Address(0)
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
class PhysicalAddress {
|
||||
@ -61,11 +61,6 @@ private:
|
||||
FlatPtr m_address { 0 };
|
||||
};
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, PhysicalAddress value)
|
||||
{
|
||||
return stream << 'P' << value.as_ptr();
|
||||
}
|
||||
|
||||
template<>
|
||||
struct AK::Formatter<PhysicalAddress> : AK::Formatter<FormatString> {
|
||||
void format(FormatBuilder& builder, PhysicalAddress value)
|
||||
|
@ -719,11 +719,6 @@ inline ProcessID Thread::pid() const
|
||||
return m_process->pid();
|
||||
}
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, const Process& process)
|
||||
{
|
||||
return stream << process.name() << '(' << process.pid().value() << ')';
|
||||
}
|
||||
|
||||
#define REQUIRE_NO_PROMISES \
|
||||
do { \
|
||||
if (Process::current()->has_promises()) { \
|
||||
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Time.h>
|
||||
#include <Kernel/CMOS.h>
|
||||
#include <Kernel/RTC.h>
|
||||
|
@ -1027,11 +1027,6 @@ KResult Thread::make_thread_specific_region(Badge<Process>)
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const Thread& value)
|
||||
{
|
||||
return stream << value.process().name() << "(" << value.pid().value() << ":" << value.tid().value() << ")";
|
||||
}
|
||||
|
||||
RefPtr<Thread> Thread::from_tid(ThreadID tid)
|
||||
{
|
||||
RefPtr<Thread> found_thread;
|
||||
|
@ -1298,8 +1298,6 @@ inline IterationDecision Thread::for_each_in_state(State state, Callback callbac
|
||||
return IterationDecision::Continue;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream&, const Thread&);
|
||||
|
||||
}
|
||||
|
||||
template<>
|
||||
|
@ -475,7 +475,7 @@ PageFaultResponse MemoryManager::handle_page_fault(const PageFault& fault)
|
||||
dbgln_if(PAGE_FAULT_DEBUG, "MM: CPU[{}] handle_page_fault({:#04x}) at {}", Processor::id(), fault.code(), fault.vaddr());
|
||||
auto* region = find_region_from_vaddr(fault.vaddr());
|
||||
if (!region) {
|
||||
dmesgln("CPU[{}] NP(error) fault at invalid address {}", Processor::id(), fault.vaddr());
|
||||
Process::current()->space().dump_regions();
|
||||
return PageFaultResponse::ShouldCrash;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
class VirtualAddress {
|
||||
@ -71,11 +71,6 @@ inline VirtualAddress operator-(const VirtualAddress& a, const VirtualAddress& b
|
||||
return VirtualAddress(a.get() - b.get());
|
||||
}
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, VirtualAddress value)
|
||||
{
|
||||
return stream << 'V' << value.as_ptr();
|
||||
}
|
||||
|
||||
template<>
|
||||
struct AK::Formatter<VirtualAddress> : AK::Formatter<FormatString> {
|
||||
void format(FormatBuilder& builder, const VirtualAddress& value)
|
||||
|
@ -72,6 +72,7 @@
|
||||
#include <Kernel/Tasks/SyncTask.h>
|
||||
#include <Kernel/Time/TimeManagement.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/kstdio.h>
|
||||
|
||||
// Defined in the linker script
|
||||
typedef void (*ctor_func_t)();
|
||||
@ -337,7 +338,7 @@ void init_stage2(void*)
|
||||
|
||||
UNMAP_AFTER_INIT void setup_serial_debug()
|
||||
{
|
||||
// serial_debug will output all the klog() and dbgln() data to COM1 at
|
||||
// serial_debug will output all the dbgln() data to COM1 at
|
||||
// 8-N-1 57600 baud. this is particularly useful for debugging the boot
|
||||
// process on live hardware.
|
||||
if (StringView(kernel_cmdline).contains("serial_debug")) {
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
static bool serial_debug;
|
||||
// A recursive spinlock allows us to keep writing in the case where a
|
||||
// page fault happens in the middle of a dbgln(), klog(), etc
|
||||
// page fault happens in the middle of a dbgln(), etc
|
||||
static RecursiveSpinLock s_log_lock;
|
||||
|
||||
void set_serial_debug(bool on_or_off)
|
||||
@ -148,22 +148,20 @@ static void debugger_out(char ch)
|
||||
IO::out8(0xe9, ch);
|
||||
}
|
||||
|
||||
extern "C" int dbgputstr(const char* characters, int length)
|
||||
extern "C" void dbgputstr(const char* characters, size_t length)
|
||||
{
|
||||
if (!characters)
|
||||
return 0;
|
||||
return;
|
||||
ScopedSpinLock lock(s_log_lock);
|
||||
for (int i = 0; i < length; ++i)
|
||||
for (size_t i = 0; i < length; ++i)
|
||||
debugger_out(characters[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int kernelputstr(const char* characters, int length)
|
||||
extern "C" void kernelputstr(const char* characters, size_t length)
|
||||
{
|
||||
if (!characters)
|
||||
return 0;
|
||||
return;
|
||||
ScopedSpinLock lock(s_log_lock);
|
||||
for (int i = 0; i < length; ++i)
|
||||
for (size_t i = 0; i < length; ++i)
|
||||
console_out(characters[i]);
|
||||
return 0;
|
||||
}
|
||||
|
@ -29,8 +29,8 @@
|
||||
#include <AK/Types.h>
|
||||
|
||||
extern "C" {
|
||||
int dbgputstr(const char*, int);
|
||||
int kernelputstr(const char*, int);
|
||||
void dbgputstr(const char*, size_t);
|
||||
void kernelputstr(const char*, size_t);
|
||||
int snprintf(char* buf, size_t, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||
void set_serial_debug(bool on_or_off);
|
||||
int get_serial_debug();
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include "BookmarksBarWidget.h"
|
||||
#include "Browser.h"
|
||||
#include "InspectorWidget.h"
|
||||
#include "Tab.h"
|
||||
#include "WindowActions.h"
|
||||
#include <AK/StringBuilder.h>
|
||||
@ -47,6 +46,7 @@
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace Browser {
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -38,9 +38,9 @@
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
struct TitleAndText {
|
||||
String title;
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Demangle.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
|
@ -32,10 +32,10 @@
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/TabWidget.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <LibGfx/Point.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
#include <unistd.h>
|
||||
|
||||
enum IRCNumeric {
|
||||
RPL_WELCOME = 1,
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -44,14 +44,13 @@
|
||||
#include <LibGUI/Clipboard.h>
|
||||
#include <LibGUI/FilePicker.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/TableView.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Matrix4x4.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -24,14 +24,10 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "RunWindow.h"
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/StatusBar.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static const char* APP_NAME = "Space Analyzer";
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <LibJS/Parser.h>
|
||||
#include <LibJS/Runtime/Function.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace Spreadsheet {
|
||||
|
||||
|
@ -33,11 +33,11 @@
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Clipboard.h>
|
||||
#include <LibGUI/FilePicker.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Model.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <unistd.h>
|
||||
|
||||
class ColorRoleModel final : public GUI::Model {
|
||||
public:
|
||||
|
@ -37,10 +37,9 @@
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Matrix4x4.h>
|
||||
#include <LibGfx/Vector3.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const int WIDTH = 200;
|
||||
const int HEIGHT = 200;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define FIRE_WIDTH 320
|
||||
#define FIRE_HEIGHT 168
|
||||
|
@ -30,10 +30,10 @@
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibGfx/Path.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const int WIDTH = 780;
|
||||
const int HEIGHT = 600;
|
||||
|
@ -31,12 +31,12 @@
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGfx/Path.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
#include <LibGfx/WindowTheme.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const int WIDTH = 300;
|
||||
const int HEIGHT = 200;
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Path.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
class Screensaver final : public GUI::Widget {
|
||||
C_OBJECT(Screensaver)
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "FormWidget.h"
|
||||
#include "WidgetTreeModel.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include "GitWidget.h"
|
||||
#include "GitFilesModel.h"
|
||||
#include <AK/LogStream.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibDiff/Format.h>
|
||||
#include <LibGUI/Application.h>
|
||||
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "WidgetTool.h"
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Format.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Property.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/AutocompleteProvider.h>
|
||||
@ -45,6 +44,7 @@
|
||||
#include <LibGUI/TextEditor.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <LibX86/ELFSymbolProvider.h>
|
||||
#include <fcntl.h>
|
||||
#include <syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
# pragma GCC optimize("O3")
|
||||
|
@ -28,10 +28,10 @@
|
||||
#include "Emulator.h"
|
||||
#include "MmapRegion.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <mallocdefs.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace UserspaceEmulator {
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Format.h>
|
||||
|
||||
extern bool g_report_to_debug;
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
# pragma GCC optimize("O3")
|
||||
|
@ -25,16 +25,13 @@
|
||||
*/
|
||||
|
||||
#include "Emulator.h"
|
||||
#include "SoftCPU.h"
|
||||
#include <AK/Format.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibELF/Image.h>
|
||||
#include <getopt.h>
|
||||
#include <pthread.h>
|
||||
#include <serenity.h>
|
||||
#include <string.h>
|
||||
|
||||
bool g_report_to_debug = false;
|
||||
|
@ -24,7 +24,6 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/LogStream.h>
|
||||
#include <LibC/sys/internals.h>
|
||||
#include <LibC/unistd.h>
|
||||
#include <LibELF/AuxiliaryVector.h>
|
||||
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "misc.h"
|
||||
#include "AK/LogStream.h"
|
||||
#include <AK/Format.h>
|
||||
|
||||
extern "C" {
|
||||
const char* __cxa_demangle(const char*, void*, void*, int*)
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <LibGUI/Window.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/StandardCursor.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace Breakout {
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <spawn.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
Engine::~Engine()
|
||||
{
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -25,12 +25,13 @@
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Format.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/internals.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
@ -29,13 +29,11 @@
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibELF/DynamicLoader.h>
|
||||
#include <assert.h>
|
||||
#include <dlfcn.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// NOTE: The string here should never include a trailing newline (according to POSIX)
|
||||
String g_dlerror_msg;
|
||||
|
@ -24,7 +24,6 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/LogStream.h>
|
||||
#include <assert.h>
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/InlineLinkedList.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/ScopedValueRollback.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibELF/AuxiliaryVector.h>
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/GenericLexer.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -1048,10 +1048,9 @@ void dbgputch(char ch)
|
||||
syscall(SC_dbgputch, ch);
|
||||
}
|
||||
|
||||
int dbgputstr(const char* characters, ssize_t length)
|
||||
void dbgputstr(const char* characters, size_t length)
|
||||
{
|
||||
int rc = syscall(SC_dbgputstr, characters, length);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
syscall(SC_dbgputstr, characters, length);
|
||||
}
|
||||
|
||||
char* tmpnam(char*)
|
||||
|
@ -94,7 +94,7 @@ int vsnprintf(char* buffer, size_t, const char* fmt, va_list) __attribute__((for
|
||||
int fprintf(FILE*, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int printf(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||
void dbgputch(char);
|
||||
int dbgputstr(const char*, ssize_t);
|
||||
void dbgputstr(const char*, size_t);
|
||||
int sprintf(char* buffer, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int snprintf(char* buffer, size_t, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||
int putchar(int ch);
|
||||
|
@ -24,7 +24,6 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/LogStream.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <syscall.h>
|
||||
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Vector.h>
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <AK/Array.h>
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/BinarySearch.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/MemoryStream.h>
|
||||
|
||||
#include <LibCompress/Deflate.h>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user