mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
AK: Rename printf.cpp to PrintfImplementation.h.
This commit is contained in:
parent
1d5a3507b2
commit
98eeb8f22d
5 changed files with 25 additions and 31 deletions
|
@ -1,17 +1,11 @@
|
||||||
typedef unsigned char byte;
|
#pragma once
|
||||||
typedef unsigned short word;
|
|
||||||
typedef unsigned int dword;
|
|
||||||
typedef long long unsigned int qword;
|
|
||||||
|
|
||||||
[[gnu::always_inline]] inline size_t strlen(const char* str)
|
#include <AK/Types.h>
|
||||||
{
|
#include <LibC/stdarg.h>
|
||||||
size_t len = 0;
|
|
||||||
while (*(str++))
|
|
||||||
++len;
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
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>
|
template<typename PutChFunc, typename T>
|
||||||
[[gnu::always_inline]] inline int print_hex(PutChFunc putch, char*& bufptr, T number, byte fields)
|
[[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;
|
byte shr_count = fields * 4;
|
||||||
while (shr_count) {
|
while (shr_count) {
|
||||||
shr_count -= 4;
|
shr_count -= 4;
|
||||||
putch(bufptr, h[(number >> shr_count) & 0x0F]);
|
putch(bufptr, printf_hex_digits[(number >> shr_count) & 0x0F]);
|
||||||
++ret;
|
++ret;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
|
@ -1,6 +1,6 @@
|
||||||
#include "StringBuilder.h"
|
#include <AK/PrintfImplementation.h>
|
||||||
#include "printf.cpp"
|
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
|
#include <AK/StringBuilder.h>
|
||||||
#include <LibC/stdarg.h>
|
#include <LibC/stdarg.h>
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#include <Kernel/kstdio.h>
|
#include <AK/PrintfImplementation.h>
|
||||||
|
#include <AK/Types.h>
|
||||||
#include <Kernel/Console.h>
|
#include <Kernel/Console.h>
|
||||||
#include <Kernel/IO.h>
|
#include <Kernel/IO.h>
|
||||||
#include <LibC/stdarg.h>
|
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
#include <AK/Types.h>
|
#include <Kernel/kstdio.h>
|
||||||
#include <AK/printf.cpp>
|
#include <LibC/stdarg.h>
|
||||||
|
|
||||||
static void console_putch(char*&, char ch)
|
static void console_putch(char*&, char ch)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
#include <stdio.h>
|
#include <AK/PrintfImplementation.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/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <AK/ValueRestorer.h>
|
#include <AK/ValueRestorer.h>
|
||||||
#include <Kernel/Syscall.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" {
|
extern "C" {
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
#include <AK/PrintfImplementation.h>
|
||||||
#include <LibCore/CIODevice.h>
|
#include <LibCore/CIODevice.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <AK/printf.cpp>
|
|
||||||
|
|
||||||
CIODevice::CIODevice(CObject* parent)
|
CIODevice::CIODevice(CObject* parent)
|
||||||
: CObject(parent)
|
: CObject(parent)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue