2020-01-18 11:38:21 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2018-10-16 15:33:16 +03:00
|
|
|
#pragma once
|
|
|
|
|
2022-10-10 00:23:23 +03:00
|
|
|
#include <AK/Platform.h>
|
|
|
|
|
|
|
|
#ifdef AK_OS_SERENITY
|
2020-05-16 13:00:04 +03:00
|
|
|
# ifdef KERNEL
|
|
|
|
# include <Kernel/kstdio.h>
|
2020-02-15 21:18:56 +03:00
|
|
|
# else
|
|
|
|
# include <AK/Types.h>
|
2020-08-06 14:36:06 +03:00
|
|
|
# include <stdarg.h>
|
2020-02-15 21:18:56 +03:00
|
|
|
extern "C" {
|
2022-04-01 20:58:27 +03:00
|
|
|
void dbgputstr(char const*, size_t);
|
|
|
|
int sprintf(char* buf, char const* fmt, ...) __attribute__((format(printf, 2, 3)));
|
|
|
|
int snprintf(char* buffer, size_t, char const* fmt, ...) __attribute__((format(printf, 3, 4)));
|
2020-02-15 21:18:56 +03:00
|
|
|
}
|
|
|
|
# endif
|
2019-06-18 09:53:26 +03:00
|
|
|
#else
|
2020-02-15 21:18:56 +03:00
|
|
|
# include <stdio.h>
|
2022-04-01 20:58:27 +03:00
|
|
|
inline void dbgputstr(char const* characters, size_t length)
|
2020-08-09 05:45:20 +03:00
|
|
|
{
|
2020-10-04 18:42:31 +03:00
|
|
|
fwrite(characters, 1, length, stderr);
|
2020-08-09 05:45:20 +03:00
|
|
|
}
|
2019-06-18 09:53:26 +03:00
|
|
|
#endif
|
2020-08-09 05:45:20 +03:00
|
|
|
template<size_t N>
|
2022-04-01 20:58:27 +03:00
|
|
|
inline void dbgputstr(char const (&array)[N])
|
2020-08-09 05:45:20 +03:00
|
|
|
{
|
|
|
|
return ::dbgputstr(array, N);
|
|
|
|
}
|