AK: Rename printf.cpp to PrintfImplementation.h.

This commit is contained in:
Andreas Kling 2019-06-07 11:41:11 +02:00
parent 1d5a3507b2
commit 98eeb8f22d
Notes: sideshowbarker 2024-07-19 13:41:55 +09:00
5 changed files with 25 additions and 31 deletions

View file

@ -1,17 +1,11 @@
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned int dword;
typedef long long unsigned int qword;
#pragma once
[[gnu::always_inline]] inline size_t strlen(const char* str)
{
size_t len = 0;
while (*(str++))
++len;
return len;
}
#include <AK/Types.h>
#include <LibC/stdarg.h>
static constexpr const char* h = "0123456789abcdef";
static constexpr const char* printf_hex_digits = "0123456789abcdef";
extern "C" size_t strlen(const char*);
template<typename PutChFunc, typename T>
[[gnu::always_inline]] inline int print_hex(PutChFunc putch, char*& bufptr, T number, byte fields)
@ -20,7 +14,7 @@ template<typename PutChFunc, typename T>
byte shr_count = fields * 4;
while (shr_count) {
shr_count -= 4;
putch(bufptr, h[(number >> shr_count) & 0x0F]);
putch(bufptr, printf_hex_digits[(number >> shr_count) & 0x0F]);
++ret;
}
return ret;

View file

@ -1,6 +1,6 @@
#include "StringBuilder.h"
#include "printf.cpp"
#include <AK/PrintfImplementation.h>
#include <AK/StdLibExtras.h>
#include <AK/StringBuilder.h>
#include <LibC/stdarg.h>
namespace AK {

View file

@ -1,10 +1,10 @@
#include <Kernel/kstdio.h>
#include <AK/PrintfImplementation.h>
#include <AK/Types.h>
#include <Kernel/Console.h>
#include <Kernel/IO.h>
#include <LibC/stdarg.h>
#include <Kernel/Process.h>
#include <AK/Types.h>
#include <AK/printf.cpp>
#include <Kernel/kstdio.h>
#include <LibC/stdarg.h>
static void console_putch(char*&, char ch)
{

View file

@ -1,17 +1,17 @@
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <AK/printf.cpp>
#include <AK/PrintfImplementation.h>
#include <AK/StdLibExtras.h>
#include <AK/ValueRestorer.h>
#include <Kernel/Syscall.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <unistd.h>
extern "C" {

View file

@ -1,9 +1,9 @@
#include <AK/PrintfImplementation.h>
#include <LibCore/CIODevice.h>
#include <stdio.h>
#include <sys/select.h>
#include <sys/time.h>
#include <unistd.h>
#include <AK/printf.cpp>
CIODevice::CIODevice(CObject* parent)
: CObject(parent)